hm2 BSPI documentation, examples?

More
03 Aug 2023 01:31 #276806 by blazini36

I would definitely update to the latest master

The Ethernet latency issue can usually be fixed by using either an old (4.19)
or new kernel (current non release candidate is 6.4.6-rt8)

The dump shows a data read and write from the SPI FIFO so there maybe some
setup step missing

A 32 bit write to the SPI FIFO:

81c2 0055 efbe adde
= write 1 doubleword to 0x5500 = 0xdeadbeef
 

Well like I said I'm not a code guy but that little component I posted is basically a copy of the 7i65 component that does basically nothing but add the same functions. I would expect just to see some kind of action on the SPI pins since we're calling read and write functions.

The documentation and code notes on bspi are a bit hard to follow. It's confusing what is being referred to as an "instance" and a "channel", seems as if these are used to label the same thing in places. Typically a module instance is hm2.0.module.0, If I had 2 bspi firmware modules and sets of pins I would expect them to be "hm2.0.bspi.0" and "hm2.0.bspi.1" and to me, that is 2 instances. Everything I'm looking at is calling that address a "channel" and in some cases also and instance. I have 2 chips hooked up to 1 set of bspi pins with 2 chip selects, to me that is 1 instance with 2 channels. I figured my friend would sort this out but I'm not sure how far he's looked into it yet, I know it confuses me though. It looks like the 7i65 uses several bspi instances and several chips per instance so it's hard to figure out what's going on there.

I put the scope on to trigger the clock and the MOSI lines, if a write command hit the 7i92 at least just on startup (which you say it does) I'd expect to have seen some action on ether pin while starting linuxcnc at the very least but nothing. I suppose 1 other question is has a 7i65 or any other bspi daughtercard been confirmed to work on an ethernet card like the 7i92? The 7i65 is fairly old, probably only had pci/pcie cards back then and I don't know of any other bspi Mesa daughtercards. Can anyone confirm a working bspi anything on an ethernet card?

I don't mean to be a pain but first thing I do when I'm trying to figure out if a serial port works is a loopback or echo test before spending a bunch of time doing whatever else. Just trying to figure out how to make sure everything not related to my PCB or the component we'll have to create works.
 

Please Log in or Create an account to join the conversation.

More
03 Aug 2023 01:58 - 03 Aug 2023 02:30 #276809 by PCW
The 7I65 is known to work with the 7I80 Ethernet connected FPGA card

The 7I65 uses only one BSPI instance (but one with 8 channels)
Each BSPI instance can support up to 16 devices ( on 16 "channels" )
(your firmware has 2 channels)

If I get a chance later this week, I'll try your config with your code (and maybe the 7I65 code)
Last edit: 03 Aug 2023 02:30 by PCW.

Please Log in or Create an account to join the conversation.

More
03 Aug 2023 04:14 #276815 by blazini36
Honestly I glossed over when you mentioned a change in master for a bspi fix because I hate running master. I've got machines on 2.8, and 2.9 I really don't want to run master on this one...

I did find a commit, looks like it went into 2.8 and made it's way into 2.9 but it might be newer than when my version was compiled. The problem explained there isn't the same as mine but it looks like he changed both the 7i65 component and bspi.c, pretty sure we grabbed the 7i65 comp from master so that could be a problem. Doesn't look like anything special went into master, gonna see what version I can get away with and try running that.

Judging by this I don't know that those problems were actually resolved, but they look specific to the 7i65. github.com/LinuxCNC/linuxcnc/pull/2288
 

Please Log in or Create an account to join the conversation.

More
03 Aug 2023 23:34 #276849 by PCW
I checked both the 7I92 and 7I92T versions and get clocks and CS's

I did make one change (removed the /clear)

r = hm2_bspi_setup_chan(name, 0, 0, 32, 4, 0, 1, 0, 1, 0, 0);
r = hm2_bspi_setup_chan(name, 1, 1, 32, 4, 0, 1, 0, 1, 0, 0);

Please Log in or Create an account to join the conversation.

More
04 Aug 2023 10:10 #276876 by blazini36
That's good to hear, I tried briefly and still didn't get anything. I updated linuxcnc to the newest 2.9 apt version (2.9.0-pre1-1045-gab9a43033) and set /clear to 1 and recompiled. My kernel is what LinuxCNC stuffs in the Debian repo, 6.3.0-rt11-linuxcnc. That kernel was just updated, I was hoping it was new enough to resolve the ethernet latency but I still can't run better than a 2ms servo thread without "error finishing read". Planning on digging up a newer rt kernel when I get a chance, but I wouldn't think this would be the problem right?

Are you using 2.10, master? any details about your setup, can you share he config? I assume this was my component?

On another note, I have a 7i66 laying around and I figured I'd try using it for an analog input until I get this sorted. I have SS setup for mode 2 and I have the 4 analog input pins but they are very coarse, not sure if it's comparing the field voltage or what. I have FV powered with a 24v supply and I'm reading the wiper of a 5k pot that's supplied with 5v. The reading is roughly right, there's just no resolution. Any way to get this better for reading 0-5v?

Please Log in or Create an account to join the conversation.

More
04 Aug 2023 13:10 - 04 Aug 2023 13:11 #276886 by PCW
I am using 2.10 but can try 2.9. I don't think the LinuxCNC version would
make much of a difference (since the changes made would not affect activity)

I just used your component added to a standard hal file and got SPI activity
(signals on CS0/CS1/SCLK and DOUT)

On the 7I66, analog is used for reading the digital inputs
(so threshold and hysteresis are under software control)
This is done so the input spans the entire digital input range
= 36.3V full scale. The reported analog data is only 8 bits so
0 to 5V only gives you about 32 steps.

If you are reading a pot, I would run it at 24V.


On the latency, what host hardware and Ethernet MAC do you have?
Last edit: 04 Aug 2023 13:11 by PCW.

Please Log in or Create an account to join the conversation.

More
04 Aug 2023 20:15 #276932 by PCW
Just tested with 2.9 and works as expected, if I short DIN to DOUT I get the echo

step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef

Please Log in or Create an account to join the conversation.

More
04 Aug 2023 21:25 #276933 by blazini36
Thanks for taking the time to check that but now I'm even more baffled.

I pulled the 7i92t off my BoB and checked the spi pins to make sure I didn't damage them when desoldering/soldering the new box headers on. P2 pins 17-25 have continuity to pins 30 to 37ish ( hard to count tiny pins) of the 24bit bus switch on the side of the power connector and aren't shorted or anything.I then put the scope on SCK without the 7i92 attached to my PCB and got nothing while starting linuxcnc.

I'm not sure where that echo you mentioned prints to but I shorted MISO to MOSI and ran the tcpdump, posting that here if it's of use. 

File Attachment:

File Name: comdump_20...8-04.txt
File Size:4 KB


lshw might be a bit TMI  but I'll post that here along with my current hal and ini files because if it works for you I'm flat stumped at this point. I did upgrade the drivers on these NICs at some point to try to fix the problem but lshw shows the 2.5gb NICs as having 1gb capabillity so I'm not sure what that's about.Are you using the newer version of the bspi module? Besides that all I can think of is to flash a different bitfile so I can make sure the bus switch isn't bad on the bspi pins but I think that's a stretch. 

 

File Attachment:

File Name: lshw.txt
File Size:24 KB

 

File Attachment:

File Name: PnP.ini
File Size:6 KB

 

File Attachment:

File Name: PnP.hal
File Size:13 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
04 Aug 2023 21:41 #276934 by PCW
The echo data was from the console:
with no loopback, I get

step_drive: ffffffff
analog: ffffffff
step_drive: ffffffff
analog: ffffffff
step_drive: ffffffff
analog: ffffffff
step_drive: ffffffff
analog: ffffffff

With DIN looped back to DOUT  I get:

step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef
step_drive: deadbeef

This is with:

 

File Attachment:

File Name: pnp.comp.txt
File Size:2 KB


LinuxCNC 2.9 and  7I92 with 7i92_blazini3a.bit firmware


 
Attachments:

Please Log in or Create an account to join the conversation.

More
04 Aug 2023 22:20 - 04 Aug 2023 22:21 #276937 by blazini36
well unless 7i92t_blazini3a.bin makes some difference (I have a Trion card) I'll keep digging.....
 
Last edit: 04 Aug 2023 22:21 by blazini36. Reason: editor is buggy

Please Log in or Create an account to join the conversation.

Time to create page: 0.261 seconds
Powered by Kunena Forum