effevee / loraE32

A MicroPython class for the Ebyte E32 Series LoRa modules
GNU General Public License v3.0
35 stars 6 forks source link

Raspberry Pico #1

Closed varna9000 closed 3 years ago

varna9000 commented 3 years ago

Hi, first of all thanks for the great library! I successfully used it with esp32. I'm now trying to get it working on Raspberry Pico. I've hardcoded the UART config in the start() function, since micropython Pico port doesn't have uart.init() built in. Therefore I initialise itt like this:

self.serdev=UART(1, 9600,tx=Pin(8),rx=Pin(9)) 

However the start function is stuck on sending the config bytes:

UART(1, baudrate=9600, bits=8, parity=None, stop=1, tx=8, rx=9)
1 1 1
[192, 0, 2, 26, 2, 68]

In the above debug message, I'm printing the uart instance and the values of the three pins: m0,m1 and aux - in this case they are struck on high.

Do you know where the problem could be? Module works ok and emits the signal, if I write a string to it directly like this:

uart.write('test')
varna9000 commented 3 years ago

Ok, found the problem. You are currently waiting fixed 50 milliseconds after writing a command to the module UART. if you remove the sleep and wrap the data wait in if self.serdev.any(): it works.

nicklf3nick commented 3 years ago

Does this lib be used on raspberry pi rather than ESP32?

effevee commented 3 years ago

It was developed for ESP32, but can be adapted for any microcontroller supported by MicroPython which can do simple UART

Op wo 14 jul. 2021 om 09:53 schreef nicklf3nick @.***>:

Does this lib be used on raspberry pi rather than ESP32?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/effevee/loraE32/issues/1#issuecomment-879677746, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3LGQKMOMFNLZXFWOBZYVTTXU66DANCNFSM4ZAZZWBA .

-- Bezoek Effevee's reisblog op www.effevee.be

nicklf3nick commented 3 years ago

It was developed for ESP32, but can be adapted for any microcontroller supported by MicroPython which can do simple UART

Op wo 14 jul. 2021 om 09:53 schreef nicklf3nick @.***>:

Does this lib be used on raspberry pi rather than ESP32?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/effevee/loraE32/issues/1#issuecomment-879677746, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3LGQKMOMFNLZXFWOBZYVTTXU66DANCNFSM4ZAZZWBA .

-- Bezoek Effevee's reisblog op www.effevee.be

Thanks for your reply!!

But i have a problem that RPi may not support the lib "machine", are there any solutions for it?

effevee commented 3 years ago

A Raspberry Pi is not a microcontroller and does not support micropython. The MicroPython code could be ported to Python, but there would be timing problems as the Raspberry Pi runs an operating system which has to do lots of things besides running a program.

Op wo 14 jul. 2021 om 11:23 schreef nicklf3nick @.***>:

It was developed for ESP32, but can be adapted for any microcontroller supported by MicroPython which can do simple UART

Op wo 14 jul. 2021 om 09:53 schreef nicklf3nick @.***>:

Does this lib be used on raspberry pi rather than ESP32?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub

1 (comment)

https://github.com/effevee/loraE32/issues/1#issuecomment-879677746, or unsubscribe

https://github.com/notifications/unsubscribe-auth/AN3LGQKMOMFNLZXFWOBZYVTTXU66DANCNFSM4ZAZZWBA .

-- Bezoek Effevee's reisblog op www.effevee.be

Thanks for your reply!!

But i have a problem that RPi may not support the lib "machine", are there any solutions for it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/effevee/loraE32/issues/1#issuecomment-879738651, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3LGQPRIQ3HS3FQXMLQ7ZTTXVJQJANCNFSM4ZAZZWBA .

-- Bezoek Effevee's reisblog op www.effevee.be

varna9000 commented 3 years ago

A while ago I modified it to work with Raspberry Pi, but I don't have it on GitHub. Basically you have to change how UART works i.e. replace machine.UART with pyserial module which enables Serial for Rasperry Pi.

nicklf3nick commented 3 years ago

A while ago I modified it to work with Raspberry Pi, but I don't have it on GitHub. Basically you have to change how UART works i.e. replace machine.UART with pyserial module which enables Serial for Rasperry Pi.

Thanks for your reply:)

I tried it. Because i am unfamiliar with pyserial module and UART module, so there still some error occurred.