Quantcast
Viewing latest article 1
Browse Latest Browse All 1147

HATs and other add-ons • Re: 2 x SC16IS752 on different SPI's

I don't get the gift of your question, but here is python code that I can confirm working (at least on one of my projects.) It uses the pyserial library. Possible helpful installation info. here: https://seengreat.com/wiki/79/sg-se752-1a

Observe the data on the port by running screen e.g sudo screen /dev/ttySC0 <baud_rate>

Code:

import serialtry:    # Replace '/dev/ttySC0' with the UART device you want to use**    # It could be '/dev/ttySC0', '/dev/ttySC1', '/dev/ttySC2', or '/dev/ttySC3'    ser = serial.Serial('/dev/ttySC0', 9600)  # **Replace 9600 with your desired baud rate**    data_to_send = b'hello\r\n'  # The data to send, encoded as bytes. '\r\n' adds a newline.    ser.write(data_to_send)    print(f"Sent: {data_to_send}")    ser.close()except serial.SerialException as e:    print(f"Error opening or writing to serial port: {e}")
If running the script as a non-root user, you will have to give that <dial> permission to that user to use the 4 serial ports.

Statistics: Posted by Henderson Hood — Thu Apr 10, 2025 7:21 pm



Viewing latest article 1
Browse Latest Browse All 1147

Trending Articles