cancel
Showing results for 
Search instead for 
Did you mean: 

SPC58EC-DISP USB to Serial connection

jchoi.1
Associate

I want to read and write data by serial connection.

For test, I import samples "SPC58ECxx_RLA SERIAL Test Application for Discovery" from application library.

In my understanding, the "main.c" function write "Hello World!" by serial connection.

my environment

RS232 connection (PC to SPC58EC_DISP)

putty

When I flash the code to my board, the putty write "cRK".

I cannot understand why my pc receive "cRK".

I think my pc receive the "Hello World".

please help!!

3 REPLIES 3
Giuseppe DI-GIORE
ST Employee

Please, make sure to have 38400-N81 UART configuration on your PC serial port.

Regards, 

jchoi.1
Associate

yes. I'm sure that I configure the PC serial port to 38400-N81. 

Nurlan13
Associate

Read this data (Hello Worl) from TX RX pins of SPC58. with USB to TTL module. 

import serial

# Set up serial communication parameters
com_port = 'COM4'  # Replace with your COM port (e.g., 'COM3' on Windows or '/dev/ttyUSB0' on Linux)
baud_rate = 38400  # Typical baud rate for RFD900x, adjust if needed
timeout = 3        # Set a timeout to avoid blocking indefinitely

try:
    # Open the serial port
    ser = serial.Serial(com_port, baud_rate, timeout=timeout)
    print(f"Connected to {com_port} at {baud_rate} baud.")

    # Continuously read data from the modem
    while True:
        if ser.in_waiting > 0:  # Check if there is data waiting
            received_data = ser.readline().decode('utf-8').strip()
            if received_data:
                print(f"Received: {received_data}")

except serial.SerialException as e:
    print(f"Error: {e}")
finally:
    # Ensure the serial port is closed when done
    if ser.is_open:
        ser.close()
        print("Serial connection closed.")

Run this python code in any IDE, change baud rate and COM port.
Nurlan13_0-1729238580289.png

A1 - GND
D1- TX

A10- RX