I'm using a genuine Arduino Uno R3
Maybe someone could suggest why I get square boxes/backwards question marks when using Serial.write() to output the data? I'm very confident that this is not a baud rate issue, but everything I google online suggests fixing the baud rate. If it's not a baud rate issue, what else could be causing this?
You get what you see because you set inverse logic to true. Your RS-232 adapter already has inverted it and you are inverting it again!
Okay but like I've said a few times now, when I don't invert I get absolutely no response at all through the arduino. Why is this?
Hi,
You do have the serial monitor in the IDE set to 9600, I would bump that up to 115200.
Tom...
![]()
I have inverse_logic = 0 and am now just seeing FF output from the sensor. Any ideas?
EDITING TO ADD: I only see FFFFFFFFF output when I use Serial.write() When I use Serial.print() I get no response.
The scope screenshot is ok. I'm a bit behind the curve with those fancy scope screens but if I'm reading the screenshot correctly, then your timebase is 200us per division. So that's 2ms across the whole screen - I think. The signal is a good 5V - 0V swing.
At 4800 baud, each bit should take around 208us - so roughly one of the on screen graticule boxes per bit horizontally. That's not what I see.
Or have I got it completely wrong ....
Good catch Mark, it looks like you are correct and a bit is taking about 10.9us. I'm not sure what to do with this information though, because the sensor definitely works at 4800 baud rate. Is the MAX232 changing the baud rate as it passes through?
And you are using this specific cable: NMEA 0183 (RS232), correct?
Yes. Cable is correct.
No, the MAX232 is a dumb device that just changes the voltage levels to/from 5V logic and RS232 levels.
At 10.9us, that's somewhere between 76,800 and 115,200 baud - something's not right.
Does your fancy scope do waveform decoding?
What's on the screenshot doesn't look like serial data. At 4800 baud, it's around 2ms per byte.
One other thing, the USB adapter DOES implement ALL the RS-232 protocol pins. Do you have any documentation on your sensor other than the sales web site?
Nope. It's a very expensive sensor that they want you to integrate with their own equipment. Documentation is very limited, that's all I could find.
I see. Then you may need to implement the rest of the pins. The CTS pin set high, the DTR pin set high. You can try to jumper the RTS pin to the CTS. And jumper the DSR pin to the DTR pin on the supplied data cable.
Maybe hook it up to the PC again and verify the baud rate.
Just did that, looking at the scope each bit is ~208us in length. So it's like it goes through the MAX232 and gibberish comes out the other end. Looks like the sensor outputs data between -5 and +5 on its end. Maybe the MAX232 cannot convert that level properly?
The cable does not have pinouts for the CTS/ DTR. Are you saying I should set the pins directly feeding into the MAX232? What voltage level is considered HIGH?
Could be wiring. This is interesting:
- Output: Via a single cable (various lengths available)
- NMEA 0183 protocol over RS232 interface and NMEA 2000® protocol over CAN BUS
Then how did you connect it to the USB adapter? Is the connector a DB9 or a DB25? Either way, the pin identification has been standard for decades.
Mentioned this earlier. Let me know if you need more clarification.
EDIT: Page 18 in this manual is what I've used for the cable pinout. https://www.airmar.com/uploads/InstallGuide/17-461-01.pdf