firmware icon indicating copy to clipboard operation
firmware copied to clipboard

[Bug]: 1.3 Serial Module Does not work

Open garthvh opened this issue 2 years ago • 2 comments

Category

Serial

Hardware

T-Beam

Firmware Version

1.3.41

Description

When using a tbeam on a Mac, the serial module is not working

Setup:

Tbeam 1.1 with:

Serial Enabled Echo Enabled RXD set to pin 35 TX set to pin 15 Baud default Mode: Text message

5v and gnd connected

Expected behavior Using tio for serial

echo 'test serial messge' | tio /dev/tty.wchusbserial1130 --response-wait would send a message that will be received on the broadcast channel

Relevant log output

No response

garthvh avatar Sep 21 '22 02:09 garthvh

This issue has been mentioned on Meshtastic. There might be relevant details there:

https://meshtastic.discourse.group/t/lilygo-ttgo-1-3-40-915mhz-lora32-hardware-serial-not-usb/6487/6

geeksville avatar Sep 21 '22 02:09 geeksville

IMG_0024

garthvh avatar Sep 21 '22 02:09 garthvh

This issue has been mentioned on Meshtastic. There might be relevant details there:

https://meshtastic.discourse.group/t/help-with-serial-module-transmit-receive-text-message-on-tbeam/6527/4

geeksville avatar Sep 29 '22 03:09 geeksville

This is what I get in the serial log when sending data

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee 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:13132 load:0x40080400,len:3036 entry 0x400805e4 [???mum????2-hal-cpu.c:214] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz

garthvh avatar Oct 04 '22 02:10 garthvh

And ??:??:?? 2 [SerialModule] Initializing serial peripheral interface [ 2646][E][HardwareSerial.cpp:506] setRxBufferSize(): RX Buffer can't be resized when Serial is already running.

garthvh avatar Oct 04 '22 02:10 garthvh

the RX buffer complaint comes from using the new ESP32 toolkit. I'll have a look

caveman99 avatar Oct 05 '22 06:10 caveman99

i checiked in something, can you retest with latest trunk?

caveman99 avatar Oct 05 '22 11:10 caveman99

Test configs

38400 Baud

For a tbeam the module config is serial.enabled true serial.rxd 35 serial.txd 15 serial.timeout 1000 serial.echo true serial.mode TEXTMSG

For rak use

serial.enabled true serial.rxd 15 serial.txd 16 serial.timeout 1000 serial.echo true serial.mode TEXTMSG

garthvh avatar Oct 14 '22 22:10 garthvh

Hmm, is it OK that for RAK pins 15 and 16 are used for GPS?

https://github.com/meshtastic/Meshtastic-device/blob/ade32b1827b7dc554716625e50c3ccfd8b87085b/variants/rak4631/variant.h#L101-L102

https://github.com/meshtastic/Meshtastic-device/blob/ade32b1827b7dc554716625e50c3ccfd8b87085b/variants/rak4631/variant.h#L198-L199

lesykm avatar Oct 15 '22 18:10 lesykm

After I fixed pins according to original variant.h: https://github.com/RAKWireless/RAK-nRF52-Arduino/blob/ca1dd0b2b17a9bd12a6d9a4d0f39b528e2104efc/variants/WisCore_RAK4631_Board/variant.h#L122-L123

Serial module started working (at least I can get output on TX0/RX0 pins).

lesykm avatar Oct 15 '22 19:10 lesykm

Yes, just re-checked, having this only change:

-#define PIN_SERIAL2_RX (8)
-#define PIN_SERIAL2_TX (6)
+#define PIN_SERIAL2_RX (19)
+#define PIN_SERIAL2_TX (20)

Serial module fully works.

lesykm avatar Oct 15 '22 20:10 lesykm

Use the module config, manually updating the firmware is not the desired result

garthvh avatar Oct 15 '22 22:10 garthvh

Yes meshtastic --set serial.rxd 15 --set serial.txd 16 should do it. You can set this to any available GPIO ports that are capable of serial though.

thebentern avatar Oct 15 '22 23:10 thebentern

Right, I just wanted to mention that serial module works with 19/20 pins and does not with 15/16 because they are GPS :)

lesykm avatar Oct 16 '22 03:10 lesykm

@jfirwin we have a bunch of serial module stuff working that we should document. Anyone here with a working config it would be great if we could get a board picture and your config.

garthvh avatar Oct 16 '22 15:10 garthvh

Closing this. Serial module has been confirmed working for text message and should for the other portnums. Hopefully we'll get some of these avenues documented for folks.

thebentern avatar Oct 17 '22 17:10 thebentern

Just small note - text messages sent through serial appeared in main channel and not in "serial" channel. If it is desired, then OK.

lesykm avatar Oct 17 '22 17:10 lesykm

That's a good thing. If they're sent over the serial portnum, they wouldn't show up in the messages for the apps. Which is a use case for some.

thebentern avatar Oct 17 '22 18:10 thebentern