#linuxcnc-devel Logs

Mar 18 2023

#linuxcnc-devel Calendar

05:24 AM -!- #linuxcnc-devel mode set to +v by ChanServ
05:42 AM linuxcnc-build2: Build [#611](http://buildbot2.highlab.com/buildbot/#builders/14/builds/611) of `10-rip.debian-10-buster-rtpreempt-amd64` 4failed.
05:42 AM linuxcnc-build2: Build [#611](http://buildbot2.highlab.com/buildbot/#builders/7/builds/611) of `10-rip.debian-11-bullseye-rtpreempt-amd64` 4failed.
05:55 AM linuxcnc-build2: Build [#612](http://buildbot2.highlab.com/buildbot/#builders/14/builds/612) of `10-rip.debian-10-buster-rtpreempt-amd64` 8completed with warnings.
05:56 AM linuxcnc-build2: Build [#612](http://buildbot2.highlab.com/buildbot/#builders/7/builds/612) of `10-rip.debian-11-bullseye-rtpreempt-amd64` 8completed with warnings.
05:59 AM linuxcnc-build2: Build [#615](http://buildbot2.highlab.com/buildbot/#builders/11/builds/615) of `10-rip.debian-12-bookworm-rtpreempt-amd64` 8completed with warnings.
09:31 AM linuxcnc-build2: Worker `checkin` is missing. It was seen last on Sat Mar 18 07:30:34 2023.
10:46 AM seb_kuzminsky: i moved to my "good" test computer, an old amd64 machine running bookworm that gets ~40 µs latency running fully loaded overnight
10:46 AM seb_kuzminsky: within a few seconds of pinging a 7i93, i get max rtt up in the multi-second range
10:46 AM seb_kuzminsky: so i must be doing something wrong, but i dont know what :-(
10:48 AM seb_kuzminsky: i've turned off hyperthreading in the bios, so it shows up as two cpus (according to /proc/cpuinfo and `getconf _NPROCESSORS_ONLN`
10:48 AM seb_kuzminsky: cmdline is `irqaffinity=0 rcu_nocbs=1 rcu_nocb_poll isolcpus=domain,managed_irq,1 sysctl.kernel.sched_rt_runtime_us=-1`
10:49 AM seb_kuzminsky: 8041 packets transmitted, 8040 received, 0.0124363% packet loss, time 8047ms
10:50 AM seb_kuzminsky: rtt min/avg/max/mdev = 0.048/0.051/7.961/0.088 ms
10:53 AM seb_kuzminsky: my /etc/network/interfaces has this:
10:53 AM seb_kuzminsky: iface enp3s0 inet static address 192.168.1.1/24 hardware-irq-coalesce-rx-usecs 0
10:53 AM seb_kuzminsky: (except with correct whitespace/linebreaks)
10:54 AM seb_kuzminsky: the 7i93 is connected directly to my nic with a single cable, no switch or anything, nothing else on that network
10:54 AM seb_kuzminsky: 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Giga
10:54 AM seb_kuzminsky: bit Ethernet Controller (rev 03)
10:54 AM seb_kuzminsky: any advise for what to check next?
11:16 AM pcw-home: what kernel?
11:17 AM seb_kuzminsky: latest Bookworm kernel: Linux cnctest 6.1.0-6-rt-amd64 #1 SMP PREEMPT_RT Debian 6.1.15-1 (2023-03-05) x86_64 GNU/Linux
11:19 AM pcw-home: People on the forum have found that Debian real time kernels are pretty bad
11:21 AM pcw-home: also theres a suggestion the later Realtek drivers are no good but I have not verified that
11:21 AM seb_kuzminsky: i tried two different ethernet cables, same results
11:21 AM pcw-home: you could eliminate the hardware by pinging localhost
11:21 AM seb_kuzminsky: i get similar ping times on my rpi4 running debian bookworm, but i dont trust that platform all that much
11:22 AM seb_kuzminsky: pinging the loopback looks good, 0% packet loss and 38 µs max rtt after 10k packets
11:23 AM seb_kuzminsky: i'll see if i have an intel nic i can plug into this machine
11:23 AM seb_kuzminsky: thanks for the suggestion
11:23 AM seb_kuzminsky: i'll be back later
11:23 AM pcw-home: Supposedly the driver from RealTek helps
11:27 AM pcw-home: Also I'd do the localhost ping for an hour or so (latency excursions I have seen are much less frequent pinging localhost but just as bad)
02:00 PM rmu: for me pinging localhost works but using a 7i93 from realtek ethernet card on debian 6.1.0 rt immediately (a few seconds) gets timeouts. machine is stable under 4.9.something
02:01 PM rmu: even non-preempt-rt 6.1.0 seems to work, but that's probably more by accident
03:16 PM andypugh: Does anyone (but especally pcw-home ) understand UARTS? (Probably Manchester encoding)
03:17 PM andypugh: I am trying to work out if these are the same, one is from a USB-serial dongle, and the other from a Mesa PktUART.
03:18 PM andypugh: https://photos.app.goo.gl/UUp9wKGiUB53BFVH8
03:19 PM andypugh: https://photos.app.goo.gl/zJrT1PnKnU9LryrX7
03:46 PM pcw-home: <rmu> I think that's the Debian "real time look" kernel
03:47 PM pcw-home: andypugh: neither of those look like manchester encoding
03:49 PM pcw-home: Manchester has a minimum of one transition per bit
03:53 PM pcw-home: Those pictures look like normal RS-485 Async
03:53 PM andypugh: pcw-home: Yes. One is actually the output from my 7i74 runnning PktYART
03:53 PM andypugh: I am trying to work out why one works, and one doesn’t.
03:54 PM andypugh: Would you expect to need to invert the output of the uart.07.tx ?
03:54 PM andypugh: If I do that then the two traces look identical apart from amplitude.
03:54 PM pcw-home: or swap +/-
03:55 PM andypugh: Swapping +/- doesn’t have exactlty the same effect, it seems.
03:55 PM andypugh: Inverting the output makes the two look the same, but the Mesa UART still doesn’t operate the device.
03:58 PM andypugh: The USB/serial widget has a 9V swig, the Mesa is 4V. But 4V should be plenty, as far as I can see from the standards. But then the widget might not be very standard.
03:59 PM andypugh: This is all the documentation I have found on it. http://www.icstation.com/rs485-modbus-4bit-relay-module-channel-switch-controller-arduino-p-14750.html
03:59 PM pcw-home: 9V is way high for RS-485
03:59 PM andypugh: There are two pushbuttons on the board, completely undocumented.
04:02 PM pcw-home: If the relay module has a RS-485 receiver, even 1V should work
04:05 PM pcw-home: Ahh yes inverting is different because of the idle state bias
04:05 PM pcw-home: (of the RS-485 lines)
04:06 PM andypugh: https://datasheet.lcsc.com/lcsc/1811071713_3PEAK-TP8485E-SR_C94206.pdf
04:06 PM andypugh: Seems ot be thr transciever
04:06 PM pcw-home: non-driven state bias I should say
04:07 PM pcw-home: Yeah receiver has ~100 mv sensitivity
04:08 PM andypugh: I was wondering if it was a parity/stop bit difference but as far as I can tell the waveforms are now identical excepf for amplitude.
04:08 PM andypugh: (I am not seeing how to program stop bits with the PktUART?)
04:09 PM pcw-home: is the undriven state the same?
04:09 PM pcw-home: I think the PktUART is fixed at 2 stop bits
04:10 PM andypugh: Oh….
04:10 PM andypugh: The widget wants 1. And I set the USB-serial to 1.
04:10 PM andypugh: I will see if two stops the USB-serial from working
04:11 PM pcw-home: Should make no difference (just a longer delay between characters)
04:12 PM andypugh: https://photos.app.goo.gl/PriFJtT7NobcjcHL7 is with the tx pin inverted
04:14 PM andypugh: No it isn’t, https://photos.app.goo.gl/vmXqZ6nbRkwt4dfw8
04:15 PM andypugh: (I got the photos mixed up)
04:24 PM pcw-home: They look the same except there is a longer idle time before the start bit (low) on the USB device
04:29 PM pcw-home: (looks like one bit time)
04:31 PM andypugh: Is there any setting that I can try to alter that?
04:32 PM pcw-home: The PKTUART only has very small delay setting because its assumed its just the driver chip enable time
04:34 PM pcw-home: The un-driven line bias should have kept the input idle for a long time before the data is sent
04:34 PM pcw-home: you might 'scope the RS-485 receiver output
04:37 PM pcw-home: (on the relay card)
04:37 PM andypugh: Sounds like an idea.
04:38 PM pcw-home: Then they should really be identical
04:39 PM andypugh: I tried a number of combinations of parity and stop bits in the stty settings for the USB thingy, and it made no difference at all.
04:39 PM andypugh: (as in, it still worked fine)
04:40 PM pcw-home: I checked, the PKTUART only does 1 stop (2 stops could be added if need be)
04:40 PM andypugh: I think I only want one, so that’s fine.
04:41 PM andypugh: Time to eat and think of other thigns.
04:41 PM pcw-home: are your scope charts with the relay thing connected?
04:42 PM pcw-home: 'night
04:59 PM andypugh: pcw-home: Yes
04:59 PM andypugh: But, there is something odd going on, looking at the far side of the transciever
05:00 PM andypugh: https://photos.google.com/search/_tra_/photo/AF1QipMXMm-AElqoTuNY0Vs058K6JCoUqJBrUVkvi4GW
05:01 PM andypugh: This is the 7i74: https://photos.app.goo.gl/QimPXbnQAzECBzXo8
05:02 PM andypugh: This is the USB-serial: https://photos.app.goo.gl/GKTuXg9212peZCo79
05:02 PM andypugh: (they both look a bit ropy..)
05:03 PM andypugh: Maybe I will try with the UART TX enable not on auto?
05:03 PM pcw-home: They are inverted from one another
05:04 PM pcw-home: No, the idle state is wrong
05:05 PM pcw-home: Idle state bias is wrong
05:05 PM andypugh: In which one?
05:06 PM pcw-home: maybe you need to swap TX/RX (you need to swap both) and remove the invert
05:07 PM pcw-home: note that you need to measure idle state bias differentially
05:08 PM pcw-home: normally idle state bias is done on the RS-485 RX pair
05:09 PM andypugh: I have it working.
05:09 PM pcw-home: Yay!
05:09 PM andypugh: Setting the TX enable permanently high (bit 6 rather than but 5)
05:11 PM pcw-home: But that prevents RX from working...
05:11 PM pcw-home: The way to get full duplex is to get the BIAS correct so an undriven line is idle
05:12 PM pcw-home: basically you get a line break when undriven if the BIAS is backwards
05:13 PM andypugh: I am pretty sure that I already tried swapping the wires.
05:13 PM andypugh: But I can try again.
05:14 PM pcw-home: Check the bias(voltmeter across the pair) when connected
05:17 PM pcw-home: The bias is fixed on the 7I74 so the polarity and bias need to both be right
05:19 PM andypugh: I tried all the combinations, and the only one that works seems to be normal polarity, tx inverted, permanent enable.
05:20 PM andypugh: Which I know isn’t viable
05:22 PM pcw-home: TX inverted seems wrong because that means the BIAS is backwards (line break when idle = low on RS-485 chip RX output)
05:23 PM andypugh: Yeah, I know something is not right.
05:23 PM pcw-home: I would say swap RX/TX + and - and no TX invert and check the signal on the relay board
05:23 PM andypugh: But it could be the actual device.
05:23 PM andypugh: https://youtu.be/EdKigumCmak
05:26 PM pcw-home: The error (that requies full time drive enable) is because the undriven BIAS is backwards this is a consequence of inverting TX rather than swapping the RX/TX pairs
05:27 PM pcw-home: (RX is critical here also because that's where the BIAS comes from)
05:30 PM andypugh: With the conventional wiring I see -0.7V between A+ B- (GND on B-) without the RX LED lit, and that goes up to -4.3V with the LED lit.
05:30 PM andypugh: (Gnd on B - )
05:33 PM pcw-home: what do you get with the USB interface
05:36 PM pcw-home: The A pins on the 7I74 (RJ45 1 and 3) should idle high
05:38 PM pcw-home: you should not invert the TX and make sure that the pin that idles high matches the pin that Idles high on the USB and relay card
05:39 PM andypugh: It’s hard to say what the USB polarity is. It’s 4V betwwn the green wire and the white wire...
05:39 PM pcw-home: always?
05:40 PM pcw-home: probably because no termination
05:40 PM andypugh: Yes, that was with it not plugged in to anything other than the USB port.
05:41 PM pcw-home: (the 7I74 has ~100 ohm termination so you only get the 0.7V undriven bias)
05:41 PM andypugh: The only combination that works is normal polarity wires, inverted TX, permanent enable.
05:41 PM andypugh: switched wires and no invert does not work, with or without enable.
05:41 PM pcw-home: OK but you cannot invert TX
05:43 PM pcw-home: always TX+ to RX+ and TX-to RX- and the swap the pair
05:43 PM pcw-home: "switched wires and no invert does not work, with or without enable."
05:44 PM pcw-home: That really makes no sense unless there is a wiring error (open maybe)
05:45 PM pcw-home: inverting TX is exactly the same as swapping TX+ and TX- (ignoring RX/BIAS issues)
05:48 PM andypugh: Well, it looks like we can’t ignore bias issues?
05:49 PM pcw-home: no you cannot (with RS-485 async)
05:49 PM pcw-home: the line state must be idle when undriven
05:50 PM pcw-home: idle meaning high at the uproc RX pin
05:53 PM pcw-home: that's why you cannot invert the TX line (because they must connect to matching RX lines)
05:55 PM pcw-home: you might have to trace down why swapping the pair does no do the same in inverting TX (starting at the relay card TTL side of RS-485 receiver)
05:57 PM pcw-home: not do the same as
05:59 PM andypugh: https://www.ebay.co.uk/itm/144884176327
05:59 PM andypugh: Is the widget, if you fancy having a play about.
06:00 PM andypugh: I suppose it would make sense to separate the TX and RX lines at this point?
06:00 PM andypugh: (Though the 7i74 manual does say that they should be connected together at the 7i74)
06:01 PM andypugh: I will admit that I actually connected them at the device, but the cable is only a foot long.
06:02 PM pcw-home: at 9600 baud wiring does not matter much
06:02 PM pcw-home: RX+ must connect to TX+ and TX- must connect to RX- for RS-485
06:03 PM pcw-home: BIAS comes from the RX lines
06:06 PM pcw-home: And inverting TX is not supportable with RS-485 as that would require swaping the RX line and that reverses the bias
06:06 PM pcw-home: I would check for open pins
06:07 PM pcw-home: or some other mis-wiring
06:08 PM andypugh: There isn’t all that much scope for mis-wiring, though I suppose it could be a didgy DB25 cable.
06:09 PM pcw-home: I would not expect a DB25 issue as TX is working
06:12 PM pcw-home: its the RS-485 TX+,TX- I would worry about as inverting FPGA TX is identical to swapping TX+ and TX- (barring electrical/wiring issues)
06:14 PM pcw-home: I'll buy one of those relay modules and try it out
06:23 PM andypugh: With the invert reverted, and the wires swapped, the pattern looks OK, but the idle state is wrong.
06:24 PM andypugh: https://photos.app.goo.gl/pQuXQ5HhogWQPuBB7
06:24 PM andypugh: Well, not _wrong_ as such. Just not working with this hardware.
06:25 PM andypugh: The CAT5 cable buzzed out correctly too.
06:27 PM pcw-home: what pin is that?
06:28 PM andypugh: That’s the modbus terminals
06:28 PM pcw-home: Which 7I74 pin?
06:30 PM andypugh: TX+RX+ and TX-RX-
06:30 PM pcw-home: Which cat 5 pin?
06:30 PM andypugh: They are linked.
06:30 PM pcw-home: 1,3 or 2,6
06:31 PM pcw-home: (I am assuming you are using a single ended scope probe)
06:32 PM andypugh: I am using a little pocket scope, which has a red clip and a black clip.
06:32 PM andypugh: So black clip on 1/3 and red clip on 2/6
06:33 PM pcw-home: so that's reversed
06:33 PM andypugh: ?
06:33 PM pcw-home: (since 1,3 are +)
06:34 PM andypugh: Not according to the manual
06:35 PM andypugh: (Actually, I mis-described that anyway, at the moment red is on A+ and black is in B-. And I have 1/2 in A+ and 2/6 in B- because I swapped them.
06:39 PM pcw-home: Yeah the manual uses EIA-RS423 names but 1,3 are non inverted and should idle high
06:40 PM pcw-home: looks like TX is still inverted
06:41 PM andypugh: I took the invert out of the HAL.
06:42 PM andypugh: So it should’t be inverted.
06:42 PM andypugh: Bot, as I said, I have the wires swapped.
06:43 PM andypugh: What works: TX inverted, 2/6 to A+ 1/3 to A- pemanent enable:
06:43 PM andypugh: What doesn’t work: Every other combination.
06:44 PM andypugh: Maybe I need termination or something?
06:46 PM andypugh: The modbus unit is floating wrt to 7i74/PC gnd. Perhaps that matters?
06:50 PM pcw-home: if permanent enable (removes all idle issues) and swapping TX lines +no invert does not work, it has to be an electrical issue
06:54 PM pcw-home: Actually If you are measuring differentially you should get close to 9V P-P
06:54 PM pcw-home: maybe the 7I74 has a bad output
06:54 PM pcw-home: (check both relative to GND)
06:57 PM pcw-home: (I did not realize you were measuring differentially)
07:00 PM andypugh: Both are zero to gnd… (the mutlimeter seems to pull them down)
07:01 PM pcw-home: Must not be enabled
07:01 PM andypugh: I should measire with the permanent enable?
07:01 PM pcw-home: Yes
07:03 PM pcw-home: If your 7I74 uses the normal ISL32174 drivers, they have a typical 4V output into 100 Ohms so would expect ~8V PP differentially
07:04 PM andypugh: I get 4.4V differentially with enable on, and 0.7V with it off.
07:04 PM andypugh: (In both cases the multimeter pulls the pins to GND and measures at zero)
07:05 PM pcw-home: When enabled you get 0 from both pins to GND?
07:05 PM andypugh: Yes. But 4.4V between them
07:06 PM andypugh: That’s to 7i74 GND
07:07 PM pcw-home: If its enabled (Ch 7) and you measure 0V from both to ground, the driver chip is likely bad or theres a bad connector or something
07:08 PM pcw-home: that is when enabled one pin must be high relative to gnd and the other must be low
07:11 PM pcw-home: If working and enabled pin 1 should be high (near 5V) and pin 2 low (near GND) when idle
07:12 PM pcw-home: also if working and enabled with TX inverted pin 1 should be low and pin 2 high when idle
07:16 PM pcw-home: sounds like one TX output is dead
07:19 PM andypugh: The device works on Channel 0 with wires swapped and no invert.
07:19 PM andypugh: (but channel 0 is not bidirectional?)
07:20 PM pcw-home: no
07:21 PM pcw-home: permanently enabled
07:21 PM pcw-home: all but ch 7 on a 7I74 are RS-422 only
07:22 PM pcw-home: (all channels on a 7I44(the 50 pin version) have RS-485 capability)
07:24 PM andypugh: I have a 7i44. But I think the only option I have for driving it is a 7i43 or a 7i90HD
07:27 PM pcw-home: You can cludge bidrectionality by adding say a 100 ohm resistor from TX+ to RX+ and another from TX- to RX-
07:27 PM pcw-home: (then connecting the RS-485 pair to the RX pins)
07:29 PM pcw-home: this will allow the relay module to overdrive the 7I74 TX when the relay module is xmiting
07:31 PM andypugh: Just out of a sense of curiosity, can the 7i94 do RS-485?
07:31 PM pcw-home: yes on all channels
07:33 PM pcw-home: also 7I96S, 7I96, 7I95 7I97 7I76E (rev C and D) 7I77, 7I78
07:33 PM andypugh: Ah, I have a 7i96 too.
07:34 PM pcw-home: I think 7I96 with a PktUART is standard firmware
07:38 PM pcw-home: 7i96_pktd.bit
07:38 PM andypugh: Yes, just looking through the pin file.
07:38 PM andypugh: Same wiring scheme?
07:39 PM andypugh: Anyway, I have a train to catch in 7 hours, time for bed.
07:39 PM pcw-home: 'nite