Modbus Client Port

Hi everyone. I was following the example Cellular Modbus Client - Accelerators - Blues Developers to communicate a Modbus device with my Swan MCU (I’m using the starter kit).

I followed all the steps for connecting the NoteCarrier F to the RS-485 Transceiver Breakout.

I had some trouble compiling the firmware, as some instructions didn’t seem to apply to the current version of Platform IO, but I finally managed to compile and upload it.

However, when I tried to run communication tests, it didn’t seem to detect the serial connection. When I ran the pio device list command in a terminal, it only showed the USB serial port where the STLINK was connected.

And when I run the pio device monitor command, the result is this:

PlatformIO\Projects\modbus_client> pio device monitor
— Terminal on COM7 | 9600 8-N-1
— Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
— More details at Redirecting...
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H

I’m not sure if I’m missing a command to “enable” the alternative serial connection mentioned in the tutorial: The command output lists all the serial devices and their logical names - look for the port corresponding to SWAN_R5 CDC in FS Mode.

Thanks in advance.

Hi @Juan_Cossio and welcome to the Blues community!

If I’m understanding the issue, I recently experienced this on Windows as well. The problem is your Swan isn’t enumerating under “Ports (COM & LPT)” in Device Manager, but rather under USB devices. Here’s what I had to do to fix this:

  1. Open Device Manager
  2. Locate your SWAN_R5 CDC in FS Mode device (likely under “Universal Serial Bus devices”).
  3. Right-click the device and select “Update driver”.
  4. Select “Browse my computer for drivers.”
  5. Select “Let me pick from a list of available drivers on my computer.”
  6. From the list, pick “USB Serial Device” or “STMicroelectronics Virtual COM Port” (whichever appears…pretty sure it’s “USB Serial Device”).
  7. Once installed, your Swan should re-enumerate under “Ports (COM & LPT)” in Device Manager. At that point, your chosen serial console (PuTTY, etc.) will see a COM port instead of the generic USB device.

Let me know if that helps!

Rob

hi @RobLauer thanks, for the quick response, and thanks for the welcome.

Although your recommendation doesn’t solve my problem, it does clarify that the pio device list and pio device monitor commands display and monitor the COM ports available on the PC, but not on the Swan MCU.

The point is that at the other end of the RS-485 Transceiver Breakout, there isn’t an RS-485 to USB converter connected to a PC. Instead, there’s a power meter with Modbus communication, from which I want to extract data.

Therefore, what I need is a tool that allows me to verify this connection. Currently, when I send a requests.qi note, I get the following response:

The RTS LED on the RS-485 Transceiver Breakout blinks for one second, which makes me think the physical connection is okay.

We support Modbus communication over RS-485 on our custom ESP32S3 board with the Notecard. If I understand your question correctly, when I want to test my code, I run the Simply Modbus Slave 8.1.3 app on my PC using a USB to RS-485 converter.

With the Simply Modbus Slave app, I can see the modbus message, and I can also frame a response. In general, when I get a timeout response from a modbus slave device, it’s usually telling my I either have the wrong slave address or the wrong modbus register address.

Once I’m seeing correct communication with the Simply Modbus Slave app, then I connect the actual device and continue testing.

Karl