It looks like you're new here. If you want to get involved, click one of these buttons!
So if I understand you correctly, the “pin usage” configuration of the cape EEPROM on the Logi-Bone (as shipped from the mfg) is currently not setup for doing SPI on the P9 header pins 28 and 29. On the other hand 30 and 31 should already be fine even without configuration since these pins are used for serial FPGA bitstream loading. To enable SPI behavior an P9 pins 28 and 29, I would have to download the provided debian image from dropbox, dd it onto a sd memory card, boot it, locate the “cape_eeprom” directory and run the shell script “init_eeprom.sh” to update the cape EEPROM to a pin configuration that supports that mode. Will that change anything else or just update the pin usage? In the current EEPROM file (https://github.com/fpga-logi/
After consulting the Beaglebone Black SRM and the Ti AM3358 TRM I’m guessing at the following values for the pin configuration in the cape EEPROM:
BB_SPI_SS (P9 pin 28) à 1 10 000000 0 0 10 011 (0xC013) à In use, output, fast slew, rx disable, pullup & enabled, pinmux mode 3
BB_SPI_MISO (P9 pin 29) à 1 01 000000 0 1 01 011 (0xA02B) à In use, input, fast slew, rx enable, pull disabled, pinmux mode 3
BB_SPI_MOSI (P9 pin 30) à 1 10 000000 0 0 01 011 (0xC00B) à In use, output, fast slew, rx disable, pull disabled, pinmux mode 3
BB_SPI_SCK (P9 pin 31) à 1 10 000000 0 0 01 011 (0xC00B) à In use, output, fast slew, rx disable, pull disabled, pinmux mode 3
Is this correct or should I get the updated data.eeprom from the debian image? I’m writing this mail from my workplace where I cannot access dropbox due to firewall policy restrictions. But I will download the image once I get back home tonight and then hopefully be able to boot the image tomorrow. Please get back to me if something is wrong with my understanding of the procedure outlined above.
And while I’m confident at handling linux (my BBB is currently running Gentoo and at this very moment compiling a kernel, hope the SoC doesn’t overheat J), I’m not yet totally comfortable with handling the beaglebone device tree internals and stuff. The Logi-Bone and Logi-Pi got me started on those ARM platforms, so please bear with me J
Three quick follow-up questions:
a) If I read the schematic correctly, you are using I/O-Expander U3 to control FPGA pins M[1:0], INIT_B and PROGRAM_M while at the same time keeping the flash U8 in reset. The configuration bitstream is then shifted into the FPGA via CFG_CCLK and CFG_DIN. These pins are shared with the “user” SPI functionality. Once the configuration is done, the FPGA pins behave as configured in the bitstream. Is there any change necessary on the BBB pin configuration at runtime once the logi_loader is done? I’m guessing not since the bitstream loading is also kind of “one-way SPI” isn’t it?
b) Do I need to patch the BBB kernel if I’m going to use simple SPI communication only? I would favor a solution that is most portable between Logi-Bone and Logi-Pi since I have both and if possible want be able to use out-of-the-box boards with simple userspace SPI via /dev/spidev*
c) I’ve read “somewhere on the internet” that I need to disable the HDMI interface in order to operate SPI Port #1 on the BBB. However, in the BBB SRM table 13 on p. 86 it says that GPIO3_21 (P9 pin 25) is affected but this pin is unconnected on the Logi-Bone according to the schematic. Is it safe then or am I wrong?
Thank you and have a nice day J
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Regards,
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I successfully downloaded and deployed your debian image and updated the cape EEPROM as described using init_eeprom.sh. I’ve not yet received the EEPROM configuration by mail from you, so I checked the data.eeprom file from within the image against the BBB SRM spec. rev C.1 (table 17 on p. 101) and found the following in your file: (I hope my and/or your MUA didn’t/doesn’t mess up the formatting)
debian@arm:~/cape_eeprom$ hexdump -C data.eeprom
00000000 aa 55 33 ee 41 30 42 42 2d 42 4f 4e 45 2d 4c 4f |.U3.A0BB-BONE-LO|
00000010 47 49 42 4f 4e 45 00 00 00 00 00 00 00 00 00 00 |GIBONE..........|
00000020 00 00 00 00 00 00 30 30 52 31 56 41 4c 45 4e 54 |......00R1VALENT|
00000030 46 58 00 00 00 00 00 00 00 00 42 42 2d 42 4f 4e |FX........BB-BON|
00000040 45 2d 4c 4f 47 49 42 4f 4e 45 00 19 30 31 31 31 |E-LOGIBONE..0111|
00000050 31 39 38 33 00 00 00 00 00 00 00 00 00 00 00 00 |1983............|
00000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000070 00 00 00 00 e0 30 e0 30 e0 30 e0 30 00 00 00 00 |.....0.0.0.0....|
00000080 e0 30 e0 30 e0 30 e0 30 e0 30 e0 30 e0 30 e0 30 |.0.0.0.0.0.0.0.0|
00000090 e0 30 e0 30 e0 30 e0 30 00 00 00 00 00 00 00 00 |.0.0.0.0........|
000000a0 c0 08 00 00 c0 08 00 00 c0 28 c0 08 c0 08 c0 08 |.........(......|
000000b0 c0 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000000d0 00 00 c0 33 00 00 c0 13 00 00 00 00 00 00 00 00 |...3............|
000000e0 00 00 00 00 00 00 00 00 00 00 00 00 00 fa 01 f4 |................|
000000f0 00 fa 00 00
000000f4
P9 pin 29, SPI1_D0 (MISO), 0xC033, configured, output (why? BBB is SPI master), fast slew, RX enabled, pull-up enabled, MUX mode 3
P9 pin 30, SPI1_D1 (MOSI), 0x0000, unconfigured
P9 pin 28, SPI1_CS0, 0xC013, configured, output, fast slew, RX disabled, pull-up enabled, MUX mode 3
P9 pin 31, SPI1_SCLK, 0x0000, unconfigured
I’m guessing SPI won’t work with this configuration: MISO being an output on the BBB and the clock and MOSI unconnected seems wrong or am I mistaken? I’m not (yet J) adept with BBB pin mux configuration and device tree.
Would the following be an acceptable configuration (with byte 0x4B updated to 0x1B to reflect two more configured pins)?
P9 pin 29, SPI1_D0 (MISO), 0xA023, configured, input, fast slew, RX enable, pull-down enabled, MUX mode 3
P9 pin 30, SPI1_D1 (MOSI), 0xC00B, configured, output, fast slew, RX disable, pull disabled, MUX mode 3
P9 pin 28, SPI1_CS0, 0xC00B, configured, output, fast slew, RX disable, pull disabled, MUX mode 3
P9 pin 31, SPI1_SCLK, 0xC00B, configured, output, fast slew, RX disable, pull disabled, MUX mode 3
I’m not quite sure about the pull-up/-down usage, it seems pointless on outputs. Should MISO have pull-down or pull-up?
Another topic:
When testing the provided “logibone_r1_blink.bit”, LED0 on the Logi-Bone show puzzling behavior. LED1 blinks with approx. 1.5 Hz in a 50/50 duty cycle as expected from the HDL source. However, LED0 blinks a pattern like two short flashes followed by a longer pause and repeating. When I put the HDL from github into ISE here and load the produced bitfile, it works as expected with both LEDs showing a 50/50 duty cycle and LED0 twice as fast. Is your “logibone_r1_blink.bit” (md5sum see below) really from the same HDL? On the Logi-Pi, the bitfile from logi-apps/blink_led_app/
Also, the SDRAM test (from directory /home/debian/sdram_test) shows erratic behavior with the bitfile “80” on the Logi-Bone:
./launch_test.sh 80 makes LED0 flash continuously at ~5 Hz after a couple of seconds and LED1 toggle at a much slower rate (I guess on for 10 seconds, then off for another 10 seconds and repeating).
./launch_test.sh 100 as well as 160 has LED0 off all the time and LED1 produce the same slow on-for-10-then-off-for-
Then I tried to generate my own bitfile for the 80 test case. However, the translate process wasn’t able to proceed on the design with constant test_frequency : natural := 80_000_000/32; set in top_level.vhd:32, failing with the following errors:
ERROR:LIT:242 - Attribute CLKOUT0_DIVIDE on PLL_BASE instance "PLL_BASE_inst" has value 160, which is outside the bounds required for this attribute. CLKOUT0_DIVIDE should have a value between 1 and 128, inclusive.
ERROR:LIT:242 - Attribute CLKOUT1_DIVIDE on PLL_BASE instance "PLL_BASE_inst" has value 160, which is outside the bounds required for this attribute. CLKOUT1_DIVIDE should have a value between 1 and 128, inclusive.
Since the bitfiles for 100 and 160 are working as expected (so it seems from my point of view) I’m confident that the rapid error flashing is an issue with the bitfile 80 and the SDRAM chip itself is ok. Any thoughts?
md5sums of tested bitfiles from the image:
logibone_r1_blink.bit:
sdram_test_80.bit:
sdram_test_100.bit:
sdram_test_160.bit:
Thank you for looking into this & regards
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Regards,
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Regards,
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Comments
Thank you for posting your success with SPI and logibone. I also have managed to get SPI working on the logibone R1. Since SPI1 on beaglebone is used for both programming and communicating with FPGA, I had to add a bone-pinmux-helper overlay to the DTS. Please see my DTS file attached.
I had to modify logi_loader script to add the multiplexor when programming:
#!/bin/sh
OCP="$(ls /sys/devices/ | grep ocp)"
MUX="$(ls /sys/devices/$OCP | grep spi_pinmux_helper)"
sh -c "echo cfg > /sys/devices/"${OCP}"/"${MUX}"/state"
dd if=$1 of=/dev/logibone bs=4M
sh -c "echo spi > /sys/devices/"${OCP}"/"${MUX}"/state"
On HW side, I started with logibone-wishbone project for beaglebone, and replaced gpmc_wishbone_wrapper with spi_wishbone_wrapper instance.
I then also had to modify https://github.com/fpga-logi/logi-projects/blob/master/logi-wishbone/sw/logipi/wishbone_wrapper.c and change spi0.0 to spi1.0.
I was then able to read/write registers on logibone using the supplied read/write_wishbone utilities from logipi
Hope this helps anyone who wishes to work with logibone over SPI with beaglebone black and would like to work with existing HDL from logibone github.
Latest logibone kernel integration supports spi out of the box. The device tree file was modified to use the spi in pin muxing and the logo loader tool was updated to use spi. It means that the FPGA loading can now be performed with a user space tool instead of being integrated to the kernel module. I will share an updated logibone Debian image with latest logibone kernel support very soon.
Regards,
Jonathan piat
I have found the DTS file you mention here: https://github.com/fpga-logi-dev/linux-dev/commits/am33x-v3.8
Could you please point a link to the source, where one can find the new logi-loader tool that uses SPI? I was unable to find the updated files here.
Thanks
https://github.com/fpga-logi-dev/logi-kernel/blob/master/beaglebone-black/logibone_r1/BB-BONE-LOGIBONE-00R1.dts
the device-tree files are inspired by the spi device tree overlay available in the kernel sources. I'am not sure if the pull-up are required but the experienced proved me that we should stick to what works ..; an example of this is that the clock must be configured as an input (suprinsingly) for the spi to work with reads ... I don't really know if the spi controller of the BBB always drive the outputs, this is something that need to be tested.
Regards,
Jonathan Piat