antirez / freakwan

A floor-routing WAN implementing a chat over bare-LoRa (no LoRaWAN).
BSD 2-Clause "Simplified" License
374 stars 17 forks source link

sx1262 support #13

Closed siddharth178 closed 4 months ago

siddharth178 commented 6 months ago

Hi, I will be getting my T3-S3 devices with sx1262 lora module in couple of weeks. I don't see any code related to sx1262 in the repo, and one post from March about it, so I assume work is still in progress. How can I help to take it forward?

Do we have anything that needs to be tested on this module? - I can do that when my hardware arrives. Do we have some code that needs to be completed? - I can give it a try.

Thanks!

siddharth178 commented 5 months ago

My hardware has arrived. Let me know if I can help with anything.

antirez commented 5 months ago

I have good news, yesterday I wrote an sx1262 driver that is API compatible with the one in FreakWAN and today I’ll start incorporating it to FreakWAN, so soon we will be able to support such devices.

Salvatore Sanfilippo

"My task is not difficult; all I would need is to be immortal to accomplish it." -- Jorge Luis Borges.

On Tue, 30 Jan 2024 at 05:43, Siddharth Karandikar @.***> wrote:

My hardware has arrived. Let me know if I can help with anything.

— Reply to this email directly, view it on GitHub https://github.com/antirez/freakwan/issues/13#issuecomment-1916065685, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQAYDGGGCUABEYRNDSEVDYRB277AVCNFSM6AAAAABAWJDVASVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJWGA3DKNRYGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

siddharth178 commented 5 months ago

Awesome timing. 😃 I will try it out immediately after you finish with your integration work. Thanks a lot!

antirez commented 5 months ago

Thanks! For now the driver lives here: https://github.com/antirez/t-watch-s3-micropython, but the official source will be this repository soon. For the T3-S3 it should be very simple because the display and all the rest is likely the same? I'm not sure. Anyway once we support the t-watch here, to port to T3-S3 will be a matter of messing a bit around. Cheers.

antirez commented 5 months ago

Dear @siddharth178, now in the t-watch branch there is everything you should need to make it working. Please, if you are able to do a devices/device_config.py for your device (see the examples inside), I would love if you could contribute yours for your device. I'm here if you need any help. Thanks.

siddharth178 commented 5 months ago

if you are able to do a devices/device_config.py for your device - yes, definitely. i will give it a try soon. haven't got my setup working with these devices yet.

antirez commented 5 months ago

Thanks, in the meantime everything got merged into the main branch.

On Thu, Feb 1, 2024 at 4:20 PM Siddharth Karandikar < @.***> wrote:

if you are able to do a devices/device_config.py for your device - yes, definitely. i will give it a try soon. haven't got my setup working with devices yet.

— Reply to this email directly, view it on GitHub https://github.com/antirez/freakwan/issues/13#issuecomment-1921573670, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQAYFHLVBAX722VV3APJLYROXD5AVCNFSM6AAAAABAWJDVASVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRRGU3TGNRXGA . You are receiving this because you commented.Message ID: @.***>

-- Salvatore Sanfilippo

"My task is not difficult; all I would need is to be immortal to accomplish it." -- Jorge Luis Borges.

siddharth178 commented 5 months ago

I am not able to flash my board (LILYGO T3S3 v1.2) with pre-built firmware from micropython's site.

Here is actual command and corresponding error. (I tried both 0x0000 and 0x1000 addresses as it was discussed in one of LILYGO threads).

~/lilygo-t3s3$ sudo -E env PATH=$PATH esptool.py -b 115200 --port /dev/ttyACM0 write_flash -z 0x1000 LILYGO_TTGO_LORA32-20240105-v1.22.1.bin
esptool.py v4.7.0
Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (QFN56) (revision v0.1)
Features: WiFi, BLE, Embedded Flash 4MB (XMC), Embedded PSRAM 2MB (AP_3v3)
Crystal is 40MHz
MAC: dc:54:75:e1:9c:44
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Unexpected chip id in image. Expected 9 but value was 0. Is this image for a different chip model?

A fatal error occurred: LILYGO_TTGO_LORA32-20240105-v1.22.1.bin is not an ESP32-S3 image. Use --force to flash anyway.

If the firmware is not available, can it be built for ESP32S3? Where can I find instructions to do the same?

antirez commented 5 months ago

Don’t bother with the Firmware for the old boards, just install the generic MicroPython firmware for the esp32 s3 following the instructions on the MicroPython page.

Salvatore Sanfilippo

"My task is not difficult; all I would need is to be immortal to accomplish it." -- Jorge Luis Borges.

On Sun, 4 Feb 2024 at 06:29, Siddharth Karandikar @.***> wrote:

I am not able to flash my board (LILYGO T3S3 v1.2) with pre-built firmware https://micropython.org/download/LILYGO_TTGO_LORA32/ from micropython's site.

Here is actual command and corresponding error. (I tried both 0x0000 and 0x1000 addresses as it was discussed in on of LILYGO threads).

~/lilygo-t3s3$ sudo -E env PATH=$PATH esptool.py -b 115200 --port /dev/ttyACM0 write_flash -z 0x1000 LILYGO_TTGO_LORA32-20240105-v1.22.1.bin esptool.py v4.7.0 Serial port /dev/ttyACM0 Connecting... Detecting chip type... ESP32-S3 Chip is ESP32-S3 (QFN56) (revision v0.1) Features: WiFi, BLE, Embedded Flash 4MB (XMC), Embedded PSRAM 2MB (AP_3v3) Crystal is 40MHz MAC: dc:54:75:e1:9c:44 Uploading stub... Running stub... Stub running... Configuring flash size... Unexpected chip id in image. Expected 9 but value was 0. Is this image for a different chip model?

A fatal error occurred: LILYGO_TTGO_LORA32-20240105-v1.22.1.bin is not an ESP32-S3 image. Use --force to flash anyway.

If the firmware is not available, can it be built for ESP32S3? Where can I find instructions to do the same?

— Reply to this email directly, view it on GitHub https://github.com/antirez/freakwan/issues/13#issuecomment-1925587522, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQAYEURVUWHHN2HQ6SED3YR4MDXAVCNFSM6AAAAABAWJDVASVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRVGU4DONJSGI . You are receiving this because you commented.Message ID: @.***>

siddharth178 commented 5 months ago

Thanks a lot @antirez

Atleast I could make some progress on flashing and getting micropython working on my board. Another thing that I was doing wrong was the uf2 image, I needed the normal .bin image and with the SPIRAM support. I didn't know my board has that. I have to understand lot more about this, but for now basic things look to be working.

$ sudo -E env PATH=$PATH esptool.py --chip esp32s3 -b 115200 --port /dev/ttyACM0 write_flash -z 0 ~/lilygo-t3s3/ESP32_GENERIC_S3-SPIRAM_OCT-20240105-v1.22.1.bin 
esptool.py v4.7.0
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-S3 (QFN56) (revision v0.1)
Features: WiFi, BLE, Embedded Flash 4MB (XMC), Embedded PSRAM 2MB (AP_3v3)
Crystal is 40MHz
MAC: dc:54:75:e1:9c:44
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x0018efff...
Compressed 1631504 bytes to 1068949...
Wrote 1631504 bytes (1068949 compressed) at 0x00000000 in 14.8 seconds (effective 882.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
$ sudo ./talk32 /dev/ttyACM0 repl
Entering REPL mode: type "~~.." or CTRL+X to exit.

MicroPython v1.22.1 on 2024-01-05; Generic ESP32S3 module with Octal-SPIRAM with ESP32S3
Type "help()" for more information.
>>> 1 + 2
3
>>> import machine
>>> machine.freq()
240000000
>>> import time
>>> time.sleep(1)
>>> time.localtime()
(2000, 1, 1, 0, 4, 14, 5, 1)
antirez commented 5 months ago

@siddharth178 good! Starting from a working MicroPython, I believe you will have FreakWAN running very soon. I will document that this version is the best for the T3-S3 version. Thanks.

antirez commented 5 months ago

P.S. please note that this version of MicroPython is known to have issues with BLE, but you will be able to use FreakWAN via the Serial interface without issues. I'm also checking what is in your board to understand the hardware differences with the models we support. The SX1262 is not a problem now, but other things may be different as well.

antirez commented 5 months ago

Another info: the BUSY pin in your board should be pin 36. It is not in the image in the LILYGO site, but I found it in the example code.

antirez commented 4 months ago

@siddharth178 finally we have the T3-S3 support :) Cheers.