Forum Discussion

MCOUNSELL's avatar
MCOUNSELL
Icon for Occasional Contributor rankOccasional Contributor
7 years ago

Bare metal access to HPS GPIO pins

Hi,

Do I need anything to init the HPS GPIO before I start using it from a bare metal application?

I start debugging from DS5 and it never gets past alt_setbits_word()

Does the FPGA have to be initialised before hand?? Or do the HPS GPIO work regardless of the FPGA programming status?

Doubt I'll get any answers/help ---- p***ing into the wind here...

#define GPIO_SPAN 0x1000 // 4 KB  4096DECIMAL
#define GPIO0_BASE_ADDRESS 0xFF208000
#define GPIO1_BASE_ADDRESS 0xFF209000
#define GPIO2_BASE_ADDRESS 0xFF20A000
 
#define gpio_swporta_dr	0x0	// 32	RW	0x0	Port A Data Register
#define gpio_swporta_ddr	0x4	// 32	RW	0x0	Port A Data Direction Register
 
 
int main(void) {
 
	alt_setbits_word( GPIO1_BASE_ADDRESS + gpio_swporta_ddr, USER_IO_DIR );
	alt_setbits_word( GPIO1_BASE_ADDRESS + gpio_swporta_dr, BIT_LED );
 
	while(1)
	{
		puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
	}
 
	return EXIT_SUCCESS;
}

3 Replies