Monday, February 3, 2014

bladeRF FPGA programmed with Quartus GUI and blinking LEDs revisited

Finally success with the blinking LEDs

Last time I deleted the whole work directory… That was not so clever.

By the way I did all this in Windows 7

Recreate bladerf-master and start again

But first save C:\bladeRF-master\hdl\fpga\platforms\bladerf\vhdl\bladerf-hosted.vhd  to  c:\temp
Unzip bladerf-master.zip to c:\bladerf-master
Copy c:\temp\ bladerf-hosted.vhd  to  C:\bladeRF-master\hdl\fpga\platforms\bladerf\vhdl\  (overwrite existing file)

Now start NIOS-shell

Oeps: too bad, error in the file I edited:

Info (12021): Found 2 design units, including 1 entities, in source file /bladerf-master/hdl/fpga/platforms/bladerf/vhdl/fx3_gpif.vhd
    Info (12022): Found design unit 1: fx3_gpif-sample_shuffler
    Info (12023): Found entity 1: fx3_gpif
Error (10500): VHDL syntax error at bladerf-hosted.vhd(591) near text "=";  expecting "(", or "'", or "." File: C:/bladerf-master/hdl/fpga/platforms/bladerf/vhdl/bladerf-hoste
d.vhd Line: 591
Info (12021): Found 0 design units, including 0 entities, in source file /bladerf-master/hdl/fpga/platforms/bladerf/vhdl/bladerf-hosted.vhd
Info (144001): Generated suppressed messages file C:/bladerf-master/hdl/quartus/work/output_files/hosted.map.smsg
Error: Quartus II 32-bit Analysis & Synthesis was unsuccessful. 1 error, 2 warnings
    Error: Peak virtual memory: 397 megabytes
    Error: Processing ended: Mon Feb 03 22:05:23 2014
    Error: Elapsed time: 00:00:06
    Error: Total CPU time (on all processors): 00:00:06
Result: ERROR: Error(s) found while running an executable. See report file(s) for error message(s). Message log indicates which executable was run last.

ERROR: Analysis & Synthesis Failed
Error (23031): Evaluation of Tcl script ../build.tcl unsuccessful
Error: Quartus II 32-bit Shell was unsuccessful. 7 errors, 2 warnings
    Error: Peak virtual memory: 198 megabytes
    Error: Processing ended: Mon Feb 03 22:05:24 2014
    Error: Elapsed time: 00:00:35
    Error: Total CPU time (on all processors): 00:00:02

lonneke@lonneke-VAIO /cygdrive/c/bladerf-master/hdl/quartus
$

But perhaps now I can get my GUI and solve the problem?

Double-click on C:\bladeRF-master\hdl\quartus\work\ bladerf.qpf

I get my Quartus GUI with the bladerf-project!
And the following notice:



OK, solve that problem later

I found the error in my change to bladerf-hosted.vhd, I used ‘=’, but should use ‘<=’

    led(2) = '1';                             -- KdG 2-Feb-2014

changed to:

    led(2) <= '1';                          -- KdG 2-Feb-2014

Now try to recompile from with the GUI

On the upper bar click Processing, Start Compilation
After a few minutes processing:

 YEP!! There it is: C:\bladeRF-master\hdl\quartus\work\output_files\ hosted.rbf

 At C:\Program Files (x86)\bladeRF there is already an hosted.rbf, so rename to hosted01.rbf

Copy hosted.rbf to this location.

And now start bladerf-cli en load fpga hosted.rbf!!!

[WARNING] extract_field: Field checksum mismatch
[WARNING] Could not extract VCTCXO trim value
[WARNING] extract_field: Field checksum mismatch
[WARNING] Could not extract FPGA size
bladeRF> load fpga hosted.rbf
Loading fpga from hosted.rbf...
Done.
bladeRF>

On the bladerf-board now LED1 is off, LED2 is blinking about 5 times in 10 seconds, LED3 is permanently on

So,
led(1) = LED2
led(2) = LED3
led(3) = LED1

Another change in bladerf-hosted.vhd to be sure:

--    led(2) <= tx_underflow_led ;
    led(2) <= '1';                          -- KdG 2-Feb-2014
--    led(3) <= rx_overflow_led ;
    led(3) <= not led(1) ;

Now I expect LED1 and LED2 to blink alternately and LED3 is still on

Compilation successful

At C:\Program Files (x86)\bladeRF there is already an hosted.rbf, so rename to hosted02.rbf

Load fpga hosted.rbf

Oeps: LED1 is off, LED2 and LED3 blink alternatively!

LED1 = led(2)
LED2 = led(1)
LED3 = led(3)

Perhaps LED1 is active low?

I’ll change led(2) to be 0
--    led(2) <= tx_underflow_led ;
    led(2) <= '0';                          -- KdG 2-Feb-2014
--    led(3) <= rx_overflow_led ;
    led(3) <= not led(1) ;

save all

Processing, start compilation

Compilation successful

At C:\Program Files (x86)\bladeRF there is already an hosted.rbf, so rename to hosted03.rbf

Load fpga hosted.rbf

Interesting:

LED1 is permanently on, so obviously is ‘active low’
LED2 and LED3 blink alternatively

I guess LED2 and LED3 are also ‘active low’??

Set all three LEDs to a ‘0’, if all three are permanently on, then they are all active low (what I expect)

           if( count = 0 ) then
--                count := 100_000_00 ;
                count := 100_000_000 ;                                -- KdG 2-Feb-2014                                         
--                led(1) <= not led(1) ;
            end if ;
        end if ;
    end process ;

    led(1) <= '0' ;                 
--    led(2) <= tx_underflow_led ;
    led(2) <= '0';                          -- KdG 2-Feb-2014
--    led(3) <= rx_overflow_led ;
    led(3) <= '0' ;

YEP: all three are on now!

By the way: why is the outputfile named hosted.rbf?? I would expect hostedx115.rbf


 Summary

I found out experimentally that the LEDs are active low.
LED1 = led(2)
LED2 = led(1)
LED3 = led(3)
I managed to set up the bladerf project in Quartus and now I can use the GUI
I managed to edit a .vhd file from the Quartus GUI
I managed to compile the whole project and get an hosted.rbf
I managed to load the hosted.rbf into the bladerf-FPGA
Now I have a good starting-point for serious FPGA-programming!
Incredible how far you can come with a few words in an email: thanks a lot, Brian!




No comments:

Post a Comment