pycom / pycom-micropython-sigfox

A fork of MicroPython with the ESP32 port customized to run on Pycom's IoT multi-network modules.
MIT License
200 stars 166 forks source link

Lwip support for SLIP | Pycom devices | FiPy/ LoPy #458

Open bitvijays opened 4 years ago

bitvijays commented 4 years ago

Dear Pycom Team,

Hope you are doing well. Thank you for the awesome work you have been doing. Currently, I am using FiPy and LoPy.

Pycom MicroPython 1.20.2.rc7 [v1.11-6d01270] on 2020-05-04; LoPy with ESP32

I wanted to ask if it is possible to send tcp/ip packets to Pycom device via UART using SLIP? Something like

Host Machine (Raspberry Pi)

slattach -L -p slip -s 115200 /dev/ttyUSB0 &
ifconfig sl0 192.168.5.1 pointopoint 192.168.5.2 mtu 1500

Pycom device (LoPy/ FiPy) (Currently, the below code is for pyboard taken from lwIP module for micropython)

import lwip
import pyb
lwip.reset()
tim = pyb.Timer(7)
tim.init(freq=20)
tim.callback(lambda t:lwip.callback())

u = pyb.UART(2, 115200, read_buf_len=3100)
sl = lwip.slip(2, "192.168.5.2", "192.168.5.1"
sock = lwip.socket(lwip.AF_INET, lwip.SOCK_STREAM)
sock.connect(("192.168.5.1", 22))
print(sock.recv(1024))
sock.close()

The requirement is to enable data transfer from Single Board Computers (Raspberry Pi/ Jetson nano) to PyCom devices (FiPy/ LoPy) and send the data via different networks (SigFox/ Lora/ Wi-Fi/ NB-IoT).

We would be grateful if you could guide us in this direction.

Yours Sincerely, Vijay