[solved] Need help with RV901T as MESA 7i90: SPI isn't working
24 Mar 2024 21:53 #296653
by ago_tm
Need help with RV901T as MESA 7i90: SPI isn't working was created by ago_tm
Hello,
I prepared the bitstream under Xilinx ISE 14.7 according to the changes described in github.com/q3k/chubby75/issues/85#issuecomment-1105762488. Here are the changes compared to basic hostmot2 for 7i90 from MESA site: github.com/golyakoff/hostmot2-rv901t-7i9...abf87a09ed5a3145c7d2.
I could flash the RV901 directly via JTAG from ISE iMPACT with the generic 72 GPIO bitstream.
But I could not connect to the device from Raspberry using SPI0:
Raspberry PI with Debian 12 from linuxcnc:
Linux pi-cnc 6.1.77-rt24-v8-ago #1 SMP PREEMPT_RT Sat Mar 16 18:05:52 MSK 2024 aarch64 GNU/Linux
In boot/broadcom/config.txt I enabled SPI0 with custom CE/CS pin:
dtparam=spi=on
dtoverlay=spi0-1cs,cs0_pin=22
When running the command
ago@pi-cnc:~$ sudo mesaflash --device 7i90 --spi --addr /dev/spidev0.0 --readhmid
Is see:
unable to set bpw32, fallback to bpw8
Unexpected cookie at 0100..0110:
00000000 00000000 00000000
On the logic analyzer I see the following error:
The initial (idle) state of the CLK line does not match the settings (see attachments)
I used the short enough SPI cable (~50-70mm)
Could you please advise?
I prepared the bitstream under Xilinx ISE 14.7 according to the changes described in github.com/q3k/chubby75/issues/85#issuecomment-1105762488. Here are the changes compared to basic hostmot2 for 7i90 from MESA site: github.com/golyakoff/hostmot2-rv901t-7i9...abf87a09ed5a3145c7d2.
I could flash the RV901 directly via JTAG from ISE iMPACT with the generic 72 GPIO bitstream.
But I could not connect to the device from Raspberry using SPI0:
Raspberry PI with Debian 12 from linuxcnc:
Linux pi-cnc 6.1.77-rt24-v8-ago #1 SMP PREEMPT_RT Sat Mar 16 18:05:52 MSK 2024 aarch64 GNU/Linux
In boot/broadcom/config.txt I enabled SPI0 with custom CE/CS pin:
dtparam=spi=on
dtoverlay=spi0-1cs,cs0_pin=22
When running the command
ago@pi-cnc:~$ sudo mesaflash --device 7i90 --spi --addr /dev/spidev0.0 --readhmid
Is see:
unable to set bpw32, fallback to bpw8
Unexpected cookie at 0100..0110:
00000000 00000000 00000000
On the logic analyzer I see the following error:
The initial (idle) state of the CLK line does not match the settings (see attachments)
I used the short enough SPI cable (~50-70mm)
Could you please advise?
Please Log in or Create an account to join the conversation.
24 Mar 2024 22:10 #296655
by cakeslob
Replied by cakeslob on topic Need help with RV901T as MESA 7i90: SPI isn't working
you seem to know what your doing, but any reason you are using an alternate pin for the SPI cs?
Please Log in or Create an account to join the conversation.
24 Mar 2024 22:19 #296656
by ago_tm
Hello, I just selected the closest in a row to avoid double-row pins. this GPIO is general purpose as I understand.
Replied by ago_tm on topic Need help with RV901T as MESA 7i90: SPI isn't working
you seem to know what your doing, but any reason you are using an alternate pin for the
SPI cs?
Hello, I just selected the closest in a row to avoid double-row pins. this GPIO is general purpose as I understand.
Please Log in or Create an account to join the conversation.
25 Mar 2024 00:32 #296662
by cakeslob
Replied by cakeslob on topic Need help with RV901T as MESA 7i90: SPI isn't working
yeah, i mean, it should work
but since its not working, possibly eliminate that as a variable first just to be sure?
but since its not working, possibly eliminate that as a variable first just to be sure?
Please Log in or Create an account to join the conversation.
25 Mar 2024 01:34 #296670
by cornholio
Replied by cornholio on topic Need help with RV901T as MESA 7i90: SPI isn't working
Old mate is right, it'll work fine using the standard SPI pinout on the RPi4 (don't try a Rpi5). I've played around with this board a bit using SPI, EPP and with modded SSerial code and used it as a smart serial device.
I found the best way to achieve 3.3v to 5v translation is to replace all the buffers on the non commoned lines with SN74CBT3245 and power the board with 4.2v. Tho on the "outside world side" the signal will need pulling up to 5v via a resistor.
I found the best way to achieve 3.3v to 5v translation is to replace all the buffers on the non commoned lines with SN74CBT3245 and power the board with 4.2v. Tho on the "outside world side" the signal will need pulling up to 5v via a resistor.
Please Log in or Create an account to join the conversation.
25 Mar 2024 04:25 #296681
by ago_tm
Replied by ago_tm on topic Need help with RV901T as MESA 7i90: SPI isn't working
You are right, thanks!
I'll give a try to standard pinout of SPI0 today and as a second attempt SPI1 (I am not sure, but just see that SPI0 isn't a popular solution for some reasons).
Thanks, I will keep you in touch!
I'll give a try to standard pinout of SPI0 today and as a second attempt SPI1 (I am not sure, but just see that SPI0 isn't a popular solution for some reasons).
Thanks, I will keep you in touch!
Please Log in or Create an account to join the conversation.
25 Mar 2024 05:07 #296684
by cornholio
Replied by cornholio on topic Need help with RV901T as MESA 7i90: SPI isn't working
And those reasons would be ?
Based on what ideas ?
Based on what ideas ?
Please Log in or Create an account to join the conversation.
25 Mar 2024 07:01 - 25 Mar 2024 07:03 #296688
by ago_tm
I did the upgrade according to the IlyaKw suggestion forum.linuxcnc.org/27-driver-boards/4773...901t?start=30#272597 and then just downgraded the input voltage of RV901T to 3.5V - it was enough to flash the bitstream to FPGA with the Xilinx ISE. So I decided to still with that solution for a while, but I ordered the SN74CBT3245 already, thanks!
I am not sure about the reasons honestly, I spent about an hour in order to understand how to enable SPI or my rpi4. In STM32 with CubeMX it was not so big challenge). But I took into account two points:
1. I did not see solutions with GPIO7-11 of SPI0 in the internet success stories related to rv901t and rpi
2. I do not actually know whether SPI0 is already taken with some internal peripheral sensors or eeprom or somewhat else.
gives: /dev/spidev0.0
shows tons of the output - not sure how to interpret the results...
I know that I didn't use SPI0 explicitly but not sure that some internal sensor or board chip is not connected there for system needs.
Replied by ago_tm on topic Need help with RV901T as MESA 7i90: SPI isn't working
Old mate is right, it'll work fine using the standard SPI pinout on the RPi4 (don't try a Rpi5). I've played around with this board a bit using SPI, EPP and with modded SSerial code and used it as a smart serial device.
I found the best way to achieve 3.3v to 5v translation is to replace all the buffers on the non commoned lines with SN74CBT3245 and power the board with 4.2v. Tho on the "outside world side" the signal will need pulling up to 5v via a resistor.
I did the upgrade according to the IlyaKw suggestion forum.linuxcnc.org/27-driver-boards/4773...901t?start=30#272597 and then just downgraded the input voltage of RV901T to 3.5V - it was enough to flash the bitstream to FPGA with the Xilinx ISE. So I decided to still with that solution for a while, but I ordered the SN74CBT3245 already, thanks!
And those reasons would be ?
Based on what ideas ?
I am not sure about the reasons honestly, I spent about an hour in order to understand how to enable SPI or my rpi4. In STM32 with CubeMX it was not so big challenge). But I took into account two points:
1. I did not see solutions with GPIO7-11 of SPI0 in the internet success stories related to rv901t and rpi
2. I do not actually know whether SPI0 is already taken with some internal peripheral sensors or eeprom or somewhat else.
ls /dev | grep spi
lsmod
I know that I didn't use SPI0 explicitly but not sure that some internal sensor or board chip is not connected there for system needs.
Last edit: 25 Mar 2024 07:03 by ago_tm.
Please Log in or Create an account to join the conversation.
25 Mar 2024 08:10 - 25 Mar 2024 08:13 #296690
by cornholio
Replied by cornholio on topic Need help with RV901T as MESA 7i90: SPI isn't working
There's no need to mess around with any spi defaults.
All that is required is to enable SPI is add this line to config.txt
dtparam=spi=on
I wouldn't worry too much looking into what drivers are loaded, if you have /dev/spidev0.0 all is good.
I've run various dev boards with modified versions of 7c81 & 7i90 firmware using the vanilla SPI interface and it all runs fine.
So if you enable the SPI interface without playing around with CS it will work fine. There's a few threads relating to using Mesa firmware on some Aliexpress dev boards, it works fine on a Mimas Spartan 6 dev board, just the dcm values need to be adjusted and to make sure the SPI comms is on the correct bank, but this comes during the compilation stage of the firmware.
The Linuxcnc-RIO project uses lattice fpgas and SPI on the RPi4 with no modifications required to the SPI pins.
Even the 7c81 doesn't require any messing about with.
As regarding your idea that something maybe connected to the SPI interface, that would be fine if the interface was enabled by default.
Once the default SPI interface is enabled it's all plug & play with the Mesa boards.Easier than ethernet as there's no IP addresses to set.
And honestly I've found these type on boards to end up being more expensive than a genuine Mesa product, but unfortunately the 7i90 is out of stock. At face value they appear cheaper, but as they are they are not entirely suitable, electrically, for a cnc machine. And if we're being honest a mess of dupont cables with eventually give you trouble.
This is an example of the way I've gone.
forum.linuxcnc.org/show-your-stuff/51142...tan-6-fpga-card-9d60
I actually modified the Linuxcnc driver & mesaflash utility to support the card with a custom ID I gave to the card, as well as the IP Port arrangement. Although it will work fine with 7c81 with only mods to the DCM setup, to allow for a 100MHz crystal.
All that is required is to enable SPI is add this line to config.txt
dtparam=spi=on
I wouldn't worry too much looking into what drivers are loaded, if you have /dev/spidev0.0 all is good.
I've run various dev boards with modified versions of 7c81 & 7i90 firmware using the vanilla SPI interface and it all runs fine.
So if you enable the SPI interface without playing around with CS it will work fine. There's a few threads relating to using Mesa firmware on some Aliexpress dev boards, it works fine on a Mimas Spartan 6 dev board, just the dcm values need to be adjusted and to make sure the SPI comms is on the correct bank, but this comes during the compilation stage of the firmware.
The Linuxcnc-RIO project uses lattice fpgas and SPI on the RPi4 with no modifications required to the SPI pins.
Even the 7c81 doesn't require any messing about with.
As regarding your idea that something maybe connected to the SPI interface, that would be fine if the interface was enabled by default.
Once the default SPI interface is enabled it's all plug & play with the Mesa boards.Easier than ethernet as there's no IP addresses to set.
And honestly I've found these type on boards to end up being more expensive than a genuine Mesa product, but unfortunately the 7i90 is out of stock. At face value they appear cheaper, but as they are they are not entirely suitable, electrically, for a cnc machine. And if we're being honest a mess of dupont cables with eventually give you trouble.
This is an example of the way I've gone.
forum.linuxcnc.org/show-your-stuff/51142...tan-6-fpga-card-9d60
I actually modified the Linuxcnc driver & mesaflash utility to support the card with a custom ID I gave to the card, as well as the IP Port arrangement. Although it will work fine with 7c81 with only mods to the DCM setup, to allow for a 100MHz crystal.
Last edit: 25 Mar 2024 08:13 by cornholio.
The following user(s) said Thank You: ago_tm
Please Log in or Create an account to join the conversation.
25 Mar 2024 08:15 #296691
by cornholio
Replied by cornholio on topic Need help with RV901T as MESA 7i90: SPI isn't working
Some other info that maybe of help
forum.linuxcnc.org/38-general-linuxcnc-q...-7c81?start=0#273546
forum.linuxcnc.org/27-driver-boards/3639...i90hd?start=0#130972
forum.linuxcnc.org/38-general-linuxcnc-q...-7c81?start=0#273546
forum.linuxcnc.org/27-driver-boards/3639...i90hd?start=0#130972
The following user(s) said Thank You: ago_tm
Please Log in or Create an account to join the conversation.
Time to create page: 0.087 seconds