Caught a Sad USB to Serial Converter using "Log IO" function...
-
Greetings, all:
I've been using USB to Serial converters on my little Linux Based Mango devices for my business. I've had varying luck by brand, and I figured this is as good a place as any to talk about by mest brand so far, and some troubles they've had.
The ones I use are the DTech USB 2.0 to RS 422/ RS 485 adapters. These units are based on the FTDI Chipset, and I generally have Good Luck. I've probably installed clost to 50 of these things, with so far 3 failures- One due to a direct lightning hit, and the other two Very Odd, Indeed.
It's this "very odd indeed" one that I want to comment on, as a sort of Use Case for how Super Useful the "Log IO" function can be in Mango. I was doing final testing on a product that was too ship, and found that the Modbus Serial data source was behaving all weirdly-- Sometimes polling correctly, but generally Failing Wholesale.
I was just about geared about to post a mango thread about wondering if the latest Modbus module had some bugs in it, but lo and behold, the "Log IO" showed me something was weird.
So:
The poll should look like this (Using the CAS Modbus Scanning Tool, if you ever need a Modbus Doodad, that's a great little test tool)
[22:21:24] => Poll: C8 04 00 00 00 14 E1 9C
[22:21:25] <= Response: C8 04 28 00 6E 00 9A 08 8D 08 84 08 81 08 8F 08 87 08 A1 00 D4 01 AF 20 E2 00 0E 00 21 00 20 00 00 00 6C 00 00 00 00 00 00 09 28 AD 11Mango was seeing this:
2019/08/29-22:12:21,943 O c80400000014e19c
2019/08/29-22:12:21,955 I 6feeffffffd73d8efe
2019/08/29-22:12:22,023 I c80428006e00a708da08d808da
2019/08/29-22:12:22,025 I 08e708da
2019/08/29-22:12:22,026 I 08f5
2019/08/29-22:12:22,027 I 00
2019/08/29-22:12:22,027 I d401
2019/08/29-22:12:22,028 I c320
2019/08/29-22:12:22,049 I e1000a002a00250000007000000000000008f8eb71I was thinking-- OKay, maybe there's a bug in the serial driver? You can see Mango originating the proper request "c80400000014e19c " which is a read input registers starting at 0 for 20.
Then, Mess starts coming back into the device almost immediatly after. You can see the start of my Slave device talking back, "c80428006e00a708da08d808da" .. But before that is this "6feeffffffd73d8efe"
Turns out that Mess was coming from the RS485 chip-- It looks almost as if the Serial device server isn't actually swapping RX/TX direction (It's a single duplex, 19200 link for this connection), and is scrambling itself up. So I plugged in that USB adapter into my Windows Box, and CAS Modbus Scanner says the same mess:
[22:19:12] => Poll: C8 04 00 00 00 14 E1 9C
[22:19:12] <= Response: 6F EE FF FF FF D7 3D 8E FE C8 04 28 00 6E 00 8F 08 6E 08 69 08 5E 08 71 08 65 08 7E 00 D4 01 B6 20 E2 00 0B 00 11 00 0D 00 00 00 6E 00 00 00 00 00 00 09 20 B2 34There's the valid poll, followed by the Huge Mess of Whatever.
This was a brand new converter, right out of the box. If I have a chance, I'll look at it under the microscope and see if I can figure out why it's broken, just for my own edification.
So: Anyways, lesson learned here: If Mango is showing Bizarre Things with Serial, check your USB adapter first.. I had another one of these adapters fail sort of randomly, and that one is here on the floor next to me. I'll see if this one has the same random problem.
Speaking of this, does anyone have any other trustworthy but sub $50 USB to Serial 485 devices? There seems to be a certain lack of these things out there that don't suck, and I use a LOT of 485... I've used several brands, and these DTech ones are the least achy-breaky of the ones I've tried. If my projects had higher budgets, I'd be getting Name Branded Units , but I can't justify $300 converters on these devices...
Cheers,
-Greg Linder