lopy to raspberry pi 3 serial connection



  • @zappfinger That#s what @thomand1000 tried first. And it still could be used. The only thing that does not work is UART methods. Instead you have to use input() and print(), or sys.stdin.readxxx() and sys.stdout.writexxx(). Both input() and sys.stdin.readxxx() calls however are blocking, and there is no safe way to tell whether data is waiting.



  • @thomand1000 Another approach is to not use the GPIO at all. Just connect the Pi3 and LoPy via USB. That way the LoPy also gets it's power form the Pi, while you can use serial comms over the USB. Works very well with <-Pi->Arduino. I see no reason why it should not work with the LoPy. Another advantage is that you do not expose the vulnerable GPIO pins...



  • @thomand1000 remove the lopy, so you just use the USB/Serial adapter of the expansion board.



  • @thomand1000
    Yes, in code it is but did you connected cables to P3/P4?
    Sometimes simplest thing is right.
    If all is connected right (GND have priority)
    then try @robert-hh advice and look if you got something on PC from and also to lopy

    Also try code without LORA between RPi and Lopy



  • @livius Yes.
    uart1 = UART(1, 115200, bits=8, parity=None, stop=1)
    uart1.init(baudrate=115200, bits=8, parity=None, stop=1, timout_chars=2, pins=("P3","P4")
    uart1.write("Connected...")

    And then in a loop check if uart1.any() and uart1.readall()

    But nothing.

    Thanks for the reply



  • @thomand1000
    Are you sure that you use UART1 not UART0?
    P3/P4 or G11/G24



  • Thanks for the quick answer. I didn't quite understand everything you said. I'm trying a 2-way communication channel so I thought it was tx (lopy)->rx (rpi) and tx(rpi) -> rx(lopy). And Gnd (lopy) to gnd (rpi). But this is wrong?

    What do you mean by "pull of the lopy"?

    Thanks! @robert-hh



  • @thomand1000 First of all: the GND connection is a MUST. Besides that, the connection is RX-RX and RX-TX. Then I would check is the RPI is actually sending. You could a USB/Serial adapter to connect it to your PC. If you don't have one, but the pycom expansion board, you can use that one: pull of take out the LoPy and connect P1 and GND to TX and GND of your rpi, using patch cables. In the PC setup you use to have the REPL, you should see what the RPI is sending.
    If it does, you can re-plug the LoPy , connect P1 to P4 and use you PC keyboard as input source. If you get something, then you know, that the connections are right.
    Then it's up to the code.



Pycom on Twitter