Showing results for 
Search instead for 
Did you mean: 
Honored Contributor I

Accessing GPIO (Serail transmit is working but GPIO LED is not working)

Hai Team, 


Thanks for the support. 


I had more questions regarding the Standalone programming. 


first i shall explain with what i had done. 

1. I had created a preloader.img file using bsp-editor. 

2. I programmed the preloader.img file to qspi flash memory at 0x0000 location using quatrus_hps.exe software. 

3. After reseting the board, the Preloader starts to executes and I could receive the serial communication data at Terminal window. 


4. Next I had written a program for transmit the characters "Hello" using ARM-DS5 compiler.(The program(hello.c) is shared below). The output of the program is ELF file 


5. I created .bin file from .axf and then converted the .bin file to ubootimage file using mkimage.exe.  


6. Programed the uboot image to qspi flash at location 0x60000. 


7. After reseting the board, Preloader.img at location 0x0000 gets executed. Next hello.c stored at location 0x60000 gets executed. i.e I got the serial communication output as "Hello" in terminal window. 


As the serial communication is initialized in Preloader.img, trasmitting is worked.  



query is  


But in the same program i had written the code for HPS LED ON. But the LED is not swithced ON.  


Could you please help if I missed some initialization to make the LED glow. 



I am using the boot source as QSPI flash memory. 


My program is  





// initialising the memory locations of the registers using# include# define gpio1_gpio_swporta_ddr (*((volatile unsigned long *) 0xFF709004))# define gpio1_gpio_swporta_dr (*((volatile unsigned long *) 0xFF709000))# define gpio1_gpio_config_reg2 (*((volatile unsigned long *) 0xFF709070))# define gpio1_gpio_config_reg1 (*((volatile unsigned long *) 0xFF709074))# define clkmgr_bypass (*((volatile unsigned long *) 0xFFD04004))# define clkmgr_en (*((volatile unsigned long *) 0xFFD04060))# define clkmgr_ctrl (*((volatile unsigned long *) 0xFFD04000))# define clkmgr_vco (*((volatile unsigned long *) 0xFFD04040))# define clkmgr_maindiv (*((volatile unsigned long *) 0xFFD04064))# define clkmgr_l4src (*((volatile unsigned long *) 0xFFD04070))# define USR_uart0 (*((volatile unsigned long *) 0xFFc0207C))# define rbr_thr_dll (*((volatile unsigned long *) 0xFFc02000)) 







void Init_LED(void); 

void Init_clock(void); 

void Init_uart(void) ; 



void sendchar(char Character) 




while((USR_uart0 & 0x00000004) != 0x00000004); 





void sendstring(char *pString) 

/* Continue sending the characters till a NULL character is encountered 

(End of string).*/ 

while (*pString) TsFlashLoaderTarget_sendChar(*(pString++)); 



int main() 









while((USR_uart0 & 0x00000004) != 0x00000004); 











void Init_LED(void) 

gpio1_gpio_swporta_ddr |= 0x0000F000; 

/*LED is switched ON*/ 

gpio1_gpio_swporta_dr &= 0xFFFF0FFF; 



void Init_clock(void) 

//clkmgr_vco = 0x80000000; 

clkmgr_ctrl = 0x00000000; 

clkmgr_bypass = 0x00000000; 



clkmgr_vco |= 0x00003002; 

clkmgr_en |= 0x00000004; 

clkmgr_maindiv = 0x00000010; 

clkmgr_l4src = 0x00000000; 

void Init_uart(void) 

/*do nothing*/ 

0 Kudos
0 Replies