meshtastic / firmware

Meshtastic device firmware
https://meshtastic.org
GNU General Public License v3.0
3.07k stars 741 forks source link

[Board]: elecrow gateway #3837

Closed Szetya closed 1 month ago

Szetya commented 2 months ago

SOC

ESP32

Lora IC

RA01H-868 (&915)

Product Link

https://m.elecrow.com/pages/shop/product/details?id=207182&

Description

I recently found this device on Aliexpress. It would make a perfect station. Any chance of it being meshtastic compatible? All information is available at the link below. https://wiki.elecrow.com/index.php?title=Lora_Basic_Gateway_Module

todd-herbert commented 2 months ago

The LoRa module is considered outdated now.. I think? I do have one of these devices so I'll probably play around with getting Meshtastic on it at some point.

Szetya commented 2 months ago

The LoRa module is considered outdated now.. I think? I do have one of these devices so I'll probably play around with getting Meshtastic on it at some point.

Yes I know the old lora module is outdated. Still, it's a nice device and the price isn't horrible. Colour touch screen, ethernet connection (not PoE), housing (not waterproof). Thank you so much!

roha-github commented 2 months ago

Why RA-08H is outdated? At Aliexpress you can find a lot of very cheap LoRa dev boards.

RA-08H has less power consumtion than ESP32 boards.

todd-herbert commented 2 months ago

Oh, I probably need to be clearer sorry. I was talking about the RA-01H version, which is based on SX1276. I think even the RA-08H version is still attached to the original ESP32 processor with this device though(?)

Szetya commented 2 months ago

Why RA-08H is outdated? At Aliexpress you can find a lot of very cheap LoRa dev boards.

RA-08H has less power consumtion than ESP32 boards.

It's not RA08H, it's actually RA01H (SX1276). Similar to SX1278 (as far as I know). (@todd-herbert faster response 😉)

Szetya commented 2 months ago

Oh, I probably need to be clearer sorry. I was talking about the RA-01H version, which is based on SX1276. I think even the RA-08H version is still attached to the original ESP32 processor with this device though(?)

RA08H is mentioned in the wiki as a client.

todd-herbert commented 2 months ago

I've definitely seen a version with some sort of upgrade to RA-08H, but not sure exactly what it was. I don't think RadioLib supports the RA-08H's ASR6501 chipset though, so maybe not suitable for Meshtastic right now? (Not sure, happy to learn otherwise!)

roha-github commented 2 months ago

There are RPi dev boards with this LoRa chip ...

https://wiki.elecrow.com/index.php?title=Lora_RA-08H_Node_Board

Szetya commented 2 months ago

I've definitely seen a version with some sort of upgrade to RA-08H, but not sure exactly what it was. I don't think RadioLib supports the RA-08H's ASR6501 chipset though, so maybe not suitable for Meshtastic right now? (Not sure, happy to learn otherwise!)

I'll go through everything this afternoon. If RA08H is not suitable (works with AT commands). However, if RA01H then it should be compatible without any further problems.

Szetya commented 2 months ago

There are RPi dev boards with this LoRa chip ...

https://wiki.elecrow.com/index.php?title=Lora_RA-08H_Node_Board

That is not what I said in the question. The gateway I was asking about. https://m.elecrow.com/pages/shop/product/details?id=207182&

Szetya commented 2 months ago

Of course, the first thing I did when I got home from work was to take it apart and have a look inside. SOC: ESP32-WROOM-32UE Radio: RA01H AI-Thinker (also mentioned in the documentation) Lan: SMSC 8720A Display: 128*160 SPI TFT ST7735S + touch (I will attach two photos in the next message) I have printed the wiring diagram from SCH to PDF, attached. gateway_sch.pdf

Szetya commented 2 months ago

IMG_20240509_151704 IMG_20240509_151640

garthvh commented 2 months ago

To date all of these modules have been UART and unsupportable.

garthvh commented 2 months ago

Ra-08 is an LoRa module designed and developed by Shenzhen Ai-Thinker Technology Co., Ltd. The module is used for ultra-long distance spread spectrum communications. Its chip ASR6601 is a universal LPWAN wireless communication SOC, integrated with RF transceivers, modems, and a 32-bit RISC MCU. The MCU adopts an ARM core with a working frequency of 48MHz. The Ra-08 module supports LoRa modulation and traditional (G) FSK modulation under the LPWAN. At the same time, the transmitter also supports BPSK modulation and (G) MSK modulation, receiver support (G) MSK modulation.

garthvh commented 2 months ago

This module has a RISC MCU and is doing AT commands, not suitable for meshtastic.

Szetya commented 2 months ago

To date all of these modules have been UART and unsupportable.

@garthvh And all this on an SPI bus? 😂 I want to mention again: RA01H as in the photo and not RA08H as you say. Screenshot_20240510_043049_com google android apps docs

Szetya commented 2 months ago

IMG_20240511_082812

todd-herbert commented 2 months ago

Well.. now I'm gonna have to find something else to tinker with instead! :wink:

Szetya commented 2 months ago

There are still problems. SPI is fine. Log shows that the radio is on the desired frequency. However, I get critical fault #3 error on the display. The chatter2 was the basis which seemed to be a good choice because of the display but I'm not sure about the radio configuration. I have chosen RFM (MOSI, MISO, SCK, NSS, BUSY PINs are ok). I had about an hour because I had to go to a guest. I've never tried to modify meshtastic code (but, once). So I'm only doing it on an amateur level. Currently only the esp is running, the radio half and the display. But the direction is good.

Szetya commented 2 months ago

It will definitely not work with RFM95 or you will have to change the class to SX1276. The board uses the DIO1 and DIO4 pins of the LoRa radio. You will probably need DIOmapping as well. I tried using the #ifdef directive in RF95Interface.h to specify the DIO1 IRQ but it didn't help:

ifndef USE_SX1276

virtual void enableInterrupt(void (*callback)()) { lora->setDio0Action(callback, RISING); }
#else
virtual void enableInterrupt(void (*callback)()) { lora->setDio1Action(callback, RISING); }
#endif

It boots and after a while it hangs up. (I separated the log with ---- after it freezes) After a while it reboots. LOG:

clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:1184 load:0x40078000,len:13192 load:0x40080400,len:3028 entry 0x400805e4 E (833) esp_core_dump_flash: No core dum ���ѥѥ���found! E (833) esp_core_dump_flash: No core dump partition found! [ 12][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz �� @INFO | ??:??:?? 0

//\ E S H T /\ S T / C

INFO | ??:??:?? 0 Booted, wake cause 0 (boot count 1), reset_reason=reset DEBUG | ??:??:?? 0 Filesystem files (16384/1048576 Bytes): DEBUG | ??:??:?? 0 /prefs/channels.proto (57 Bytes) DEBUG | ??:??:?? 0 /prefs/config.proto (101 Bytes) DEBUG | ??:??:?? 0 /prefs/db.proto (314 Bytes) DEBUG | ??:??:?? 0 /prefs/module.proto (108 Bytes) INFO | ??:??:?? 0 No I2C devices found DEBUG | ??:??:?? 0 acc_info = 0 INFO | ??:??:?? 0 Meshtastic hwvendor=56, swver=2.3.10 DEBUG | ??:??:?? 0 Setting random seed 1561364533 DEBUG | ??:??:?? 0 Total heap: 194256 DEBUG | ??:??:?? 0 Free heap: 160472 DEBUG | ??:??:?? 0 Total PSRAM: 0 DEBUG | ??:??:?? 0 Free PSRAM: 0 DEBUG | ??:??:?? 0 NVS: UsedEntries 90, FreeEntries 540, AllEntries 630, NameSpaces 3 DEBUG | ??:??:?? 0 Setup Preferences in Flash Storage DEBUG | ??:??:?? 0 Number of Device Reboots: 52 ESP_ERROR_CHECK_WITHOUT_ABORT failed: esp_err_t 0x105 (ESP_ERR_NOT_FOUND) at 0x40096a8f file: "src/platform/esp32/BleOta.cpp" line 16 func: static const esp_partition_t* BleOta::findEspOtaAppPartition() expression: esp_ota_get_partition_description(part, &app_desc) ESP_ERROR_CHECK_WITHOUT_ABORT failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG) at 0x40096a8f file: "src/platform/esp32/BleOta.cpp" line 30 func: static String BleOta::getOtaAppVersion() expression: esp_ota_get_partition_description(part, &app_desc) DEBUG | ??:??:?? 0 No OTA firmware available INFO | ??:??:?? 0 Initializing NodeDB INFO | ??:??:?? 0 Loading /prefs/db.proto INFO | ??:??:?? 0 Loaded /prefs/db.proto successfully INFO | ??:??:?? 0 Loaded saved devicestate version 22, with nodecount: 1 INFO | ??:??:?? 0 Loading /prefs/config.proto INFO | ??:??:?? 0 Loaded /prefs/config.proto successfully INFO | ??:??:?? 0 Loaded saved config version 22 INFO | ??:??:?? 0 Loading /prefs/module.proto INFO | ??:??:?? 0 Loaded /prefs/module.proto successfully INFO | ??:??:?? 0 Loaded saved moduleConfig version 22 INFO | ??:??:?? 0 Loading /prefs/channels.proto INFO | ??:??:?? 0 Loaded /prefs/channels.proto successfully INFO | ??:??:?? 0 Loaded saved channelFile version 22 [ 456][E][vfs_api.cpp:105] open(): /littlefs/oem/oem.proto does not exist, no permits for creation INFO | ??:??:?? 0 File /oem/oem.proto not found DEBUG | ??:??:?? 0 cleanupMeshDB purged 0 entries DEBUG | ??:??:?? 0 Using nodenum 0x38db3f8c DEBUG | ??:??:?? 0 Number of Device Reboots: 52 DEBUG | ??:??:?? 0 Expanding short PSK #1 INFO | ??:??:?? 0 Wanted region 3, using EU_868 INFO | ??:??:?? 0 Saving /prefs/db.proto DEBUG | ??:??:?? 0 Using GPIO00 for button DEBUG | ??:??:?? 0 SPI.begin(SCK=33, MISO=35, MOSI=32, NSS=14) DEBUG | ??:??:?? 0 TFTDisplay! DEBUG | ??:??:?? 0 Set Timezone to GMT0 DEBUG | ??:??:?? 0 Read RTC time as 0 DEBUG | ??:??:?? 0 NeighborInfoModule is disabled INFO | ??:??:?? 0 External Notification Module Disabled INFO | ??:??:?? 0 Doing TFT init INFO | ??:??:?? 1 Turning on screen DEBUG | ??:??:?? 1 Module wants a UI Frame DEBUG | ??:??:?? 1 RF95Interface(cs=14, irq=34, rst=12, busy=13) INFO | ??:??:?? 1 Starting meshradio init... DEBUG | ??:??:?? 1 (bw=250, sf=11, cr=4/5) packet symLen=8 ms, payloadSize=0, time 231 ms DEBUG | ??:??:?? 1 (bw=250, sf=11, cr=4/5) packet symLen=8 ms, payloadSize=253, time 2115 ms INFO | ??:??:?? 1 Radio freq=869.525, config.lora.frequency_offset=0.000 INFO | ??:??:?? 1 Set radio: region=EU_868, name=LongFast, config=0, ch=0, power=27 INFO | ??:??:?? 1 Radio myRegion->freqStart -> myRegion->freqEnd: 869.400024 -> 869.650024 (0.250000 mhz) INFO | ??:??:?? 1 Radio myRegion->numChannels: 1 x 250.000kHz INFO | ??:??:?? 1 Radio channel_num: 1 INFO | ??:??:?? 1 Radio frequency: 869.525024 INFO | ??:??:?? 1 Slot time: 42 msec INFO | ??:??:?? 1 Set radio: final power level=20 DEBUG | ??:??:?? 1 Current limit set to 100.000000 DEBUG | ??:??:?? 1 Current limit set result 0 INFO | ??:??:?? 1 RF95 init result 0 INFO | ??:??:?? 1 Frequency set to 869.525024 INFO | ??:??:?? 1 Bandwidth set to 250.000000 INFO | ??:??:?? 1 Power output set to 20 INFO | ??:??:?? 1 RF95 Radio init succeeded, using RF95 radio INFO | ??:??:?? 1 Not using WIFI DEBUG | ??:??:?? 1 (bw=250, sf=11, cr=4/5) packet symLen=8 ms, payloadSize=237, time 2000 ms DEBUG | ??:??:?? 1 LoRA bĭ�ate = 118.500000 bytes / sec INFO | ??:??:?? 1 PowerFSM init, USB power=1 DEBUG | ??:??:?? 1 Enter state: BOOT [ 1678][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 320 / 4 = 80 Mhz, APB: 80000000 Hz DEBUG | ??:??:?? 1 [Screen] Screen: Started... INFO | ??:??:?? 1 [RangeTestModule] Range Test Module - Disabled INFO | ??:??:?? 4 [PowerFSM] Initialise the NimBLE bluetooth module INFO | ??:??:?? 7 [Screen] Done with boot screen... DEBUG | ??:??:?? 7 [Screen] showing standard frames DEBUG | ??:??:?? 7 [Screen] Showing 0 module frames DEBUG | ??:??:?? 7 [Screen] Total frame count: 103 DEBUG | ??:??:?? 7 [Screen] Added modules. numframes: 0 DEBUG | ??:??:?? 7 [Screen] Finished building frames. numframes: 2

INFO | ??:??:?? 30 [NodeInfoModule] Sending our nodeinfo to mesh (wantReplies=1) INFO | ??:??:?? 30 [NodeInfoModule] sending owner !38db3f8c/Meshtastic 3f8c/3f8c DEBUG | ??:??:?? 30 [NodeInfoModule] Initial packet id 329009676, numPacketId 4294967295 DEBUG | ??:??:?? 30 [NodeInfoModule] Update DB node 0x38db3f8c, rx_time=0 DEBUG | ??:??:?? 30 [NodeInfoModule] handleReceived(LOCAL) (id=0x139c4a0e fr=0x8c to=0xff, WantAck=0, HopLim=3 Ch=0x0 Portnum=4 WANTRESP priority=10) DEBUG | ??:??:?? 30 [NodeInfoModule] No modules interested in portnum=4, src=LOCAL DEBUG | ??:??:?? 30 [NodeInfoModule] localSend to channel 0 DEBUG | ??:??:?? 30 [NodeInfoModule] Add packet record (id=0x139c4a0e fr=0x8c to=0xff, WantAck=0, HopLim=3 Ch=0x0 Portnum=4 WANTRESP priority=10) DEBUG | ??:??:?? 30 [NodeInfoModule] Expanding short PSK #1 DEBUG | ??:??:?? 30 [NodeInfoModule] Using AES128 key! DEBUG | ??:??:?? 30 [NodeInfoModule] ESP32 crypt fr=38db3f8c, num=139c4a0e, numBytes=50! DEBUG | ??:??:?? 30 [NodeInfoModule] enqueuing for send (id=0x139c4a0e fr=0x8c to=0xff, WantAck=0, HopLim=3 Ch=0x8 encrypted hopStart=3 priority=10) DEBUG | ??:??:?? 30 [NodeInfoModule] txGood=0,rxGood=0,rxBad=0

Szetya commented 2 months ago

(As a parenthesis, instead of setDioAction() there is a better solution: setPacketReceivedAction() )

todd-herbert commented 2 months ago

The board uses the DIO1 and DIO4 pins of the LoRa radio. You will probably need DIOmapping as well.

This is really my first time playing around with the LoRa code, but if I'm reading the datasheet right, I don't think either DIO1 or DIO4 can be mapped to the interrupts that Meshtastic is using.

image

(As a parenthesis, instead of setDioAction() there is a better solution: setPacketReceivedAction() )

This one seemed promising, but unfortunately, I think it's just a wrapper for setDio0Action.

I'm not sure there's any realistic way around this with software(?) I added a jumper wire from DIO0 to GPIO36 (the only pin available).

jumper wire diagram

https://github.com/meshtastic/firmware/assets/24772776/28c26e71-1231-4345-9971-ae0f600d7848

I'm not sure how much point there is going a whole lot further with this device, especially if it does require a hardware modification to work with Meshtastic. I wouldn't encourage anyone to go out and buy one, but maybe someone already has one they want to repurpose?

I've pushed what I've got so far to https://github.com/todd-herbert/meshtastic-firmware/tree/elecrow-crt01262m, just in case it's helpful.

Szetya commented 2 months ago

So far, this is much more than I have achieved. 😉 Yesterday I had time to do a little work on it. SX1276 and radiolib = packet transmission was successful. Although it doesn't use the interrupt when sending so I haven't tested that yet. What is certain is that it will not work with the RF95 library. And since BUSY PIN is not needed so - 1 is fine. Of course I am not encouraging anyone to buy one immediately. 😉

todd-herbert commented 2 months ago

Hey it might be possible to figure out some software-only solution, if you're dedicated enough! Continuous "blocking" receive attempts in a separate "OS thread"? Using the "Channel Activity Detected" interrupt on DIO4? I have no real idea how any of this really works, so none of this might be applicable, or there might be some key reason that it's not possible. It's interesting to play around with though, if nothing else.

Szetya commented 2 months ago

I'm sure it will work in hardware without modifying the board. I need a simple 868MHz board to try the radiolib ping-pong example. I tried to interpret the original code, it "plays" a lot with the DIO mapping. If that works this should work too. 😉 //Topic OFF: There are some crazy Hungarians. 😉 Screenshot_20240515_045130_com android chrome Screenshot_20240515_144443_com android chrome //Topic ON

Szetya commented 2 months ago

If there is a possibility I think we should move this issue to the discussion. I have made the hardware modification and it does work. I don't think there is any point in experimenting with it any further. This is the best and simplest solution. Maybe the touch part should be added to the main branch. I don't see much point in the lan option without PoE and there is no other option in the device (maybe someday someone will add lan) Since all pins are in use there is no possibility to connect I2C devices. There is nothing to expand on the device. If someone has such a device in the bottom of the drawer they can use it with minimal HW modification. I have used it. 😉 @todd-herbert Thank you for taking the time and turning it into a usable tool so quickly! 🍻

todd-herbert commented 2 months ago

(maybe someday someone will add lan)

I did have a quick look at this too actually. It seems like it's working at the hardware level (gets IP from DHCP, responds to ping), but the Meshtastic ethernet code would have to be rewritten to work with the ESP32 library I think.. still, maybe one day out of boredom.

Since all pins are in use there is no possibility to connect I2C devices. There is nothing to expand on the device.

They really did use every last pin hey? Nothing going to waste I guess.

Thank you for taking the time and turning it into a usable tool so quickly! 🍻

Thank you for your work too!

If there is a possibility I think we should move this issue to the discussion.

@thebentern 🙏

Szetya commented 2 months ago

This is very good news! I have a feeling you'll make the most of it! 😉 In its current state, I can imagine the device as a gateway for a trip or emergency where there is no coverage. It was on all night. In the morning it was on (maybe more of us are not around. 1-2 of these stations are in very good positions) Screenshot_20240516_042335_com geeksville mesh

todd-herbert commented 1 month ago

Just a heads up: the branch has been updated and now toggles the display backlight when the screen turns on / off.