0

I accessed the hardware by connecting it to GPIO pins (TX-RX) and wrote a code that that could send instructions to that hardware and receive outputs from it successfully.

The first few lines of code are:

ser = serial.Serial( port = '/dev/ttyS0', ...) 

then I made the same hardware connection using UART to TTL connector (Connected my hardware to UART to TTL device and plugged UART to TTL in Rpi).

dmesg | grep tty

tells that this device is connected as ttyUSB0

so I changed my code to

ser = serial.Serial(port = '\dev\ttyUSB0', ...)

Now, I can't get back any message from the device which implies that the hardware I have connected isn't getting any instructions at first place (or else, I would have at least received an error message)

Is there any more changes that I should make? Or is there any other way to connect with such devices? Code language is Python.

4
  • There is nothing obviously wrong with what you have tried. We probably need to see all relevant parts of the script and know what the hardware device is to help.
    – joan
    Mar 15, 2019 at 9:11
  • Hi! @joan, can't write complete script because it is related to my workplace but the hardware is Lora module and I'm dealing with AT Commands. Like AT+VER should show software version of the Lora.
    – Breakpoint
    Mar 15, 2019 at 9:16
  • @joan are you the writer (coder) of pigpio? Huge fan this side! I can't believe such an important person replied to my question here.
    – Breakpoint
    Mar 15, 2019 at 9:30
  • Not sure if it makes a difference in Python, but have you tried using forward slashes (/) instead of backward ones (): /dev/ttyUSB0? You could also check if it works in a comms program like minicom, picocom, etc
    – Dirk
    Mar 15, 2019 at 12:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.