Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20834 ディスカッション

HSMC board flash LED from Linux

Altera_Forum
名誉コントリビューター II
1,033件の閲覧回数

Hi I am new to the Altera products and I am busy learning how to develop on it 

I have the Altera Cyclone V Soc dev kit with the HSMC debug header plugged in 

I already flashed the LED's on the board itself using the provided libraries 

# !/bin/sh insmod /lib/modules/3.7.0/kernel/drivers/gpio/gpio-generic.ko insmod /lib/modules/3.7.0/kernel/drivers/gpio/gpio-dw.ko insmod /lib/modules/3.7.0/kernel/drivers/gpio/gpio-altera.ko insmod /lib/modules/3.7.0/kernel/drivers/leds/led-class.ko insmod /lib/modules/3.7.0/kernel/drivers/leds/leds-gpio.ko //Switch LED On echo 1 > /sys/class/leds/fpga_led0/brightness sleep 1 //Switch LED Off echo 0 > /sys/class/leds/hps_led0/brightness  

and via "RAW" access using the code  

//Set All LEDS off (put IO's High to switch Off) alt_clrbits_word( ( virtual_base + ( ( uint32_t )( ALT_LWFPGASLVS_OFST + LED_PIO_BASE ) & ( uint32_t )( HW_REGS_MASK ) ) ), 0x0000000F ); //Turn LED_FPGA_0 On (put IO low to switch the LED On) alt_setbits_word( ( virtual_base + ( ( uint32_t )( ALT_LWFPGASLVS_OFST + LED_PIO_BASE ) & ( uint32_t )( HW_REGS_MASK ) ) ), 0x00000001 );  

 

Now I want to do the same for the LED on the HSMC board 

I need to set this pin LOW 

DIFFIO_TX_T18p,DQ3T (Altera Pin A4) 

and I need to set this pin High 

DIFFIO_RX_T39p,DQ5T (Altera Pin F9) 

 

But I do not know where to find the memory map to show me what memory to write to. 

 

Can anybody please guide me in the correct direction? 

 

Thanks 

Walter
0 件の賞賛
2 返答(返信)
Altera_Forum
名誉コントリビューター II
313件の閲覧回数

Hi There! 

 

I was trying the same thing and found your thread. Was bookmarking this until I figured it out by myself. 

There are some steps you need to do: 

1. Add parallel I/O connection output to your fpga system on Qsys. Just follow leds_pio. Give appropriate width (mine was 8), so it will have, 

for instance, hsmc_pio_out_exported[7:0] pin from your system. Also, don't forget to connect it to hps master & configure the address mapping. 

Generate. 

2. Edit your top_system verilog, add for example, "output wire [7:0] hsmc_pio" connect your hsmc_pio_out_exported to it. 

3. Assign your pin, for example, hsmc_pio[0] to PIN_A4, and hsmc_pio[1] to PIN_F9.  

4. Edit socfpga.dtb (device tree blob), you can use sopc2dts. And put it into your SDCard partition 1 (mmcblk0p1), replace the old one. 

5. The rest is yours.
Altera_Forum
名誉コントリビューター II
313件の閲覧回数

Oh yeah, don't forget to compile and reprogram your fpga using the compiled .sof or .rbf

返信