Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Transmitting from NUCLEO-G431KB USART to NI-9871 Module w/ RS-485

I am attempting to transmit bytes from an STM32 board to a cRIO 9068 but I am having problems verifying if anything has been received. One end is a NUCLEO-G431KB board, where I am using one of it's USART ports to transmit a the following string: "Serial Message Test X". The USART TX/RX lines are connected to a MAX485 RS485 transceiver module (HCMODU0081), which has a DE/-RE hardware switching line. The DE line is held in Drive mode via a GPIO on the Nucleo while the USART outputs the previously mentioned char with the settings shown in "Settings.png". The code was written with the STM32CubeIDE and is included in "main.c".

 

The MAX485 transceiver module outputs in half-duplex mode RS-485 to a 1ft shielded cable with three conductors, (one twisted pair and a single conductor) A+/B-/COM. At the other end, approximately an inch from Port 2 of the NI-9871 module, A+ and B- are terminated with a 120ohm resistor. The A+ wire is soldered to the RX+/TX+ wires of an RJ-50 cable that has been cut to access wires. B- is soldered to RX-/TX-, and COM to COM (per this link's diagram: https://www.ni.com/docs/en-US/bundle/ni-9871-getting-started/page/overview.html). The NI-9871 module and the cRIO-9068 chassis it is plugged into are powered by a more than sufficient 24V supply.

 

For LabVIEW, I have taken the "NI-987X Serial Loopback" example project and have adjusted it to fit my application:

  • I have changed the FPGA VI to reference my NI-9871 instead of the default 9870
  • In the same VI, I made the Write command access Port 1 of the NI-9871, while the Read command accesses Port 2 (I read this was necessary to accommodate a half-duplex setup)
  • I have changed port settings for all four ports of the NI-9871 to what is shown in "ports.png"
  • I have changed the EOS byte to 88 to match with the last character in my sent string from the Nucleo

Everything compiles correctly, there are no broken VIs, and it all deploys without error. At this point, I set the Nucleo to constantly sent out the string, using a "transmit complete" callback to initiate another transmit, endlessly. What is happening is that every time the Host VI is run, the timeout for the byte Read hits and stops the process ("timeout.png"). Prior to that, the data is written to Port 1 without issue even with no cable connected. None of the bytes being sent from the Nucleo to Port 2 of the NI-9871 seem to be read, or if they are, the code is not saving or displaying them, and I can't find out why. There are no errors being marked, the code just reaches a natural end after the Read timeout. The LabVIEW project is included in "Examples.zip".

 

Troubleshooting so far: 

  • I made sure that both the NI-9871 ports and the Nucleo are set to 9600 baud, no parity, 1 stop bit, 8 data bits. 
  • I have individually tested the transmit of the Nucleo and of the NI-9871 (in the same port I'm trying to receive) using an RS-485-to-TLL dongle I plug into my computer via USB. I can receive strings in putty, log them, and ensure the data rate lines up without issue from both devices.
  • I connected an oscilloscope to the A+/B- lines going into the RJ-50 connector at the NI-9871 port, immediately after the termination resistor with ground leads connecting to COM, to check for noise. The results are in "debug.jpg". I understand it's not a great picture, but I believe it still shows that there isn't any significant noise and that the data rate lines up.
  • I attempted to disable the EOS check as well, to no change.

 

Any help would be greatly appreciated on this matter, thanks in advance!

0 Kudos
Message 1 of 1
(596 Views)