firmware icon indicating copy to clipboard operation
firmware copied to clipboard

[Board]: M5stack Cardputer ADV

Open Szetya opened this issue 1 year ago • 23 comments

SOC

ESP32

Lora IC

SX1262

Product Link

https://docs.m5stack.com/en/core/Cardputer-Adv

Description

@mverch67 Maybe a Cardputer ADV PR? ;) You're the master. :) At the moment, I don't know whether lovyan or meshtastic/st7789 driver would be the better choice. I've tried the second one for now. GPS ✅️ LoRa ✅️ Keyboard ✅️

I couldn't get the sound to work. I'm happy to share a few files. m5stack_cardputer_adv.zip

Image

Szetya avatar Sep 14 '25 16:09 Szetya

Neopixel will probably not be usable. The LED PWR Enable and TFT backlight PIN are shared.

Szetya avatar Sep 14 '25 17:09 Szetya

@Szetya can you try compiling the code without #define SX126X_DIO3_TCXO_VOLTAGE 1.8 in variant.h and see it it works with the Cardputer Adv and Cap Lora module? Afaik it doesn't have a TCXO.

I have the Cardputer Adv but no Lora module so I built my own using a Ra-01SH, and I had to remove that for it to work, but I'm not sure if that goes with the Cap

p0ns avatar Sep 17 '25 01:09 p0ns

@Szetya can you try compiling the code without #define SX126X_DIO3_TCXO_VOLTAGE 1.8 in variant.h and see it it works with the Cap? Afaik it doesn't have a TCXO.

I have the Cardputer Adv but no Lora module so I built my own using a Ra-01SH, and I had to remove that for it to work, but I'm not sure if that goes with the Cap

I'll be home after (Z)13:30. I'll check the code with the radio you mentioned to see if it works. Maybe there will be an sx1278 at the bottom of the drawer. 😉

Szetya avatar Sep 17 '25 02:09 Szetya

Yes. It seems to work with SX1278, which means it should also work with RA01SH. Sending and receiving are fine, it responds to traceroute. I made some changes to the variant.h file. The USE_RF95 macro definition was added for testing purposes. A few relevant lines from the log:

DEBUG | ??:??:?? 2 RF95Interface(cs=5, irq=4, rst=3, busy=6)
INFO  | ??:??:?? 2 Start meshradio init
INFO  | ??:??:?? 2 Radio freq=433.125, config.lora.frequency_offset=0.000
INFO  | ??:??:?? 2 Set radio: region=EU_433, name=LongFast, config=0, ch=0, power=10
INFO  | ??:??:?? 2 myRegion->freqStart -> myRegion->freqEnd: 433.000000 -> 434.000000 (1.000000 MHz)
INFO  | ??:??:?? 2 numChannels: 4 x 250.000kHz
INFO  | ??:??:?? 2 channel_num: 1
INFO  | ??:??:?? 2 frequency: 433.125000
INFO  | ??:??:?? 2 Slot time: 28 msec
INFO  | ??:??:?? 2 Final Tx power: 10 dBm
DEBUG | ??:??:?? 2 Current limit set to 100.000000
DEBUG | ??:??:?? 2 Current limit set result 0
INFO  | ??:??:?? 2 RF95 init result 0
INFO  | ??:??:?? 2 Frequency set to 433.125000
INFO  | ??:??:?? 2 Bandwidth set to 250.000000
INFO  | ??:??:?? 2 Power output set to 10
INFO  | ??:??:?? 2 RF95 init success
INFO  | ??:??:?? 2 Not using WIFI

INFO  | ??:??:?? 386 [Router] Asked module 'traceroute' to send a response
DEBUG | ??:??:?? 386 [Router] Module 'routing' wantsPacket=1
INFO  | ??:??:?? 386 [Router] Received routing from=0xab9ffe49, id=0x3a891da2, portnum=70, payloadlen=3
DEBUG | ??:??:?? 386 [Router] Routing sniffing (id=0x3a891da2 fr=0xab9ffe49 to=0xa0ca6b70, transport = 1, WantAck=0, HopLim=6 Ch=0x0 Portnum=70 WANTRESP rxSNR=10.75 rxRSSI=-29 hopStart=6 n
DEBUG | ??:??:?? 386 [Router] Delivering rx packet (id=0x3a891da2 fr=0xab9ffe49 to=0xa0ca6b70, transport = 1, WantAck=0, HopLim=6 Ch=0x0 Portnum=70 WANTRESP rxSNR=10.75 rxRSSI=-29 hopStart
DEBUG | ??:??:?? 386 [Router] Update DB node 0xab9ffe49, rx_time=0
INFO  | ??:??:?? 386 [Router] Sort took 0 milliseconds
DEBUG | ??:??:?? 386 [Router] Forwarding to phone (id=0x3a891da2 fr=0xab9ffe49 to=0xa0ca6b70, transport = 1, WantAck=0, HopLim=6 Ch=0x0 Portnum=70 WANTRESP rxSNR=10.75 rxRSSI=-29 hopStart=
DEBUG | ??:??:?? 386 [Router] Module 'routing' considered
DEBUG | ??:??:?? 386 [Router] Send response (id=0xb81c17c3 fr=0xa0ca6b70 to=0xab9ffe49, transport = 0, WantAck=0, HopLim=2 Ch=0x0 Portnum=70 requestId=3a891da2 priority=70)
DEBUG | ??:??:?? 386 [Router] Ignore update from self
DEBUG | ??:??:?? 386 [Router] localSend to channel 0
INFO  | ??:??:?? 386 [Router] Packet History - insert: Using new slot @uptime 386.086s TRACE NEW
DEBUG | ??:??:?? 386 [Router] Setting next hop for packet with dest ab9ffe49 to 0
DEBUG | ??:??:?? 386 [Router] Expand short PSK #1
DEBUG | ??:??:?? 386 [Router] Use AES128 key!
DEBUG | ??:??:?? 386 [Router] enqueue for send (id=0xb81c17c3 fr=0xa0ca6b70 to=0xab9ffe49, transport = 0, WantAck=0, HopLim=2 Ch=0x8 encrypted len=30 hopStart=2 relay=0x70 priority=70)
DEBUG | ??:??:?? 386 [Router] txGood=16,txRelay=3,rxGood=5,rxBad=0
INFO  | ??:??:?? 386 [Router] tophone queue status queue is full, discard oldest
DEBUG | ??:??:?? 386 [RadioIf] Started Tx (id=0xb81c17c3 fr=0xa0ca6b70 to=0xab9ffe49, transport = 0, WantAck=0, HopLim=2 Ch=0x8 encrypted len=30 hopStart=2 relay=0x70 priority=70)
DEBUG | ??:??:?? 386 [RadioIf] Packet TX: 460ms
DEBUG | ??:??:?? 386 [RadioIf] 0 packets remain in the TX queue
DEBUG | ??:??:?? 386 [RadioIf] Completed sending (id=0xb81c17c3 fr=0xa0ca6b70 to=0xab9ffe49, transport = 0, WantAck=0, HopLim=2 Ch=0x8 encrypted len=30 hopStart=2 relay=0x70 priority=70)
DEBUG | ??:??:?? 402 [Power] Battery: usbPower=0, isCharging=0, batMv=4110, batPct=94
Image

The magic yellow wire is 3.3V from G1. :D

@WillyJL The variant.h file has changed as follows:

// I2C
#define I2C_SDA SDA
#define I2C_SCL SCL

// Custom port I2C1 or UART
#define G1 1
#define G2 2

// Neopixel LED, PWR_EN Pin same as TFT Backlight GPIO38
#define HAS_NEOPIXEL                         // Enable the use of neopixels
#define NEOPIXEL_COUNT 1                     // How many neopixels are connected
#define NEOPIXEL_DATA 21                     // gpio pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use

// Button
#define BUTTON_PIN 0

// Battery
#define BATTERY_PIN 10
#define ADC_CHANNEL ADC1_GPIO10_CHANNEL

// IR LED
#define IR_LED 44 // Not used, information only

// TCA8418 keyboard
#define TCA8418_INT 11
//#define KB_BL_PIN -1 // No keyboard backlight
#define I2C_NO_RESCAN
#define KB_INT TCA8418_INT
#define CANNED_MESSAGE_MODULE_ENABLE 1

// GPS
#define HAS_GPS 1
#define GPS_RX_PIN RXD2
#define GPS_TX_PIN TXD2
#define GPS_BAUDRATE 115200

// BMI270
#define USE_BMI270 // INFO  | ??:??:?? 0 BMX160 found at address 0x69

// SD CARD
#define SPI_MOSI MOSI
#define SPI_SCK SCK
#define SPI_MISO MISO
#define SPI_CS 12
#define SDCARD_CS SPI_CS
#define SD_SPI_FREQUENCY 75000000U

// audio codec ES8311
#define HAS_I2S
#define DAC_I2S_BCK 41
#define DAC_I2S_WS 43
#define DAC_I2S_DOUT 46
#define DAC_I2S_DIN 42
#define DAC_I2S_MCLK -1 //???

// lovyan
#if 0
// ST7789 TFT LCD
#define ST7789_CS 37
#define ST7789_RS 34  // DC
#define ST7789_SDA 35 // MOSI
#define ST7789_SCK 36
#define ST7789_RESET 33
#define ST7789_MISO -1
#define ST7789_BUSY -1
#define ST7789_BL 38
#define ST7789_SPI_HOST SPI2_HOST
#define TFT_BL 38
#define SPI_FREQUENCY 40000000
#define SPI_READ_FREQUENCY 16000000
#define TFT_HEIGHT 135
#define TFT_WIDTH 240
#define TFT_OFFSET_X 0
#define TFT_OFFSET_Y 0
#define TFT_OFFSET_ROTATION 2
#define SCREEN_ROTATE
#define SCREEN_TRANSITION_FRAMERATE 5 // fps
#endif

// github.com/meshtastic/st7789
#if 1
// Display (TFT)
#define USE_ST7789
#define ST7789_NSS 37
#define ST7789_RS 34  // DC
#define ST7789_SDA 35 // MOSI
#define ST7789_SCK 36
#define ST7789_RESET 33
#define ST7789_MISO -1
#define ST7789_BUSY -1
#define VTFT_CTRL 38
#define VTFT_LEDA 38
#define TFT_BACKLIGHT_ON HIGH
#define ST7789_SPI_HOST SPI2_HOST
#define SPI_FREQUENCY 40000000
#define SPI_READ_FREQUENCY 16000000
#define TFT_HEIGHT 135
#define TFT_WIDTH 240
#define TFT_OFFSET_X 0
#define TFT_OFFSET_Y 0
#define BRIGHTNESS_DEFAULT 100 // Medium Low Brightnes
#endif

// LoRa
#define USE_SX1262 // Currently only SX1262 CAP is available
#define USE_RF95 // Test

#define LORA_SCK SCK
#define LORA_MISO MISO
#define LORA_MOSI MOSI
#define LORA_CS SS // NSS

// SX127X/RFM95
#define LORA_DIO0 4 // RF95 IRQ, SX1262 not connected
#define LORA_DIO1 6 // RF95 BUSY
#define LORA_RESET 3

// SX126X
#define SX126X_CS LORA_CS
#define SX126X_DIO1 4   // IRQ
#define SX126X_BUSY 6   // BUSY, LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define TCXO_OPTIONAL
#define SX126X_DIO3_TCXO_VOLTAGE 1.8 // Check the correct value!

Szetya avatar Sep 17 '25 16:09 Szetya

Log with "LoRa CAP":

DEBUG | ??:??:?? 1 RF95Interface(cs=5, irq=4, rst=3, busy=6)
INFO  | ??:??:?? 1 Start meshradio init
INFO  | ??:??:?? 1 Radio freq=906.875, config.lora.frequency_offset=0.000
INFO  | ??:??:?? 1 Set radio: region=UNSET, name=LongFast, config=0, ch=19, power=30
INFO  | ??:??:?? 1 myRegion->freqStart -> myRegion->freqEnd: 902.000000 -> 928.000000 (26.000000 MHz)
INFO  | ??:??:?? 1 numChannels: 104 x 250.000kHz
INFO  | ??:??:?? 1 channel_num: 20
INFO  | ??:??:?? 1 frequency: 906.875000
INFO  | ??:??:?? 1 Slot time: 28 msec
INFO  | ??:??:?? 1 Final Tx power: 20 dBm
INFO  | ??:??:?? 1 RF95 init result -2
INFO  | ??:??:?? 1 Frequency set to 906.875000
INFO  | ??:??:?? 1 Bandwidth set to 250.000000
INFO  | ??:??:?? 1 Power output set to 20
WARN  | ??:??:?? 1 No RF95 radio
DEBUG | ??:??:?? 1 SX126xInterface(cs=5, irq=4, rst=3, busy=6)
DEBUG | ??:??:?? 1 SX126X_DIO3_TCXO_VOLTAGE defined, using DIO3 as TCXO reference voltage at 1.800000 V
INFO  | ??:??:?? 1 Start meshradio init
INFO  | ??:??:?? 1 Radio freq=906.875, config.lora.frequency_offset=0.000
INFO  | ??:??:?? 1 Set radio: region=UNSET, name=LongFast, config=0, ch=19, power=30
INFO  | ??:??:?? 1 myRegion->freqStart -> myRegion->freqEnd: 902.000000 -> 928.000000 (26.000000 MHz)
INFO  | ??:??:?? 1 numChannels: 104 x 250.000kHz
INFO  | ??:??:?? 1 channel_num: 20
INFO  | ??:??:?? 1 frequency: 906.875000
INFO  | ??:??:?? 1 Slot time: 28 msec
INFO  | ??:??:?? 1 Final Tx power: 22 dBm
INFO  | ??:??:?? 1 SX126x init result 0
INFO  | ??:??:?? 1 Frequency set to 906.875000
INFO  | ??:??:?? 1 Bandwidth set to 250.000000
INFO  | ??:??:?? 1 Power output set to 22
DEBUG | ??:??:?? 1 Current limit set to 140.000000
DEBUG | ??:??:?? 1 Current limit set result 0
DEBUG | ??:??:?? 1 Set DIO2 as RF switch, result: 0
DEBUG | ??:??:?? 1 SX126X_RXEN not defined, defaulting to RADIOLIB_NC
DEBUG | ??:??:?? 1 SX126X_TXEN not defined, defaulting to RADIOLIB_NC
DEBUG | ??:??:?? 1 Use MCU pin -1 as RXEN and pin -1 as TXEN to control RF switching
INFO  | ??:??:?? 1 Set RX gain to boosted mode; result: 0
INFO  | ??:??:?? 1 SX1262 init success, TCXO, Vref 1.800000V

Szetya avatar Sep 17 '25 16:09 Szetya

Yes. It seems to work with SX1278, which means it should also work with RA01SH.

the RA01SH is sx1262. I was wondering if it would work without the TCXO line in the Cardputer ADV with the Cap Lora module from M5stack

p0ns avatar Sep 17 '25 16:09 p0ns

I built one with RA-01SH (sx1262 on 915mhz) and a gps module

Image

p0ns avatar Sep 17 '25 16:09 p0ns

Yes. It seems to work with SX1278, which means it should also work with RA01SH.

the RA01SH is sx1262. I was wondering if it would work without the TCXO line in the Cardputer ADV with the Cap Lora module from M5stack

Oh, silly me. Yes, 1262. :) (Without the TCXO-line, it will not start with CAP.) Well, the other change is that the TCXO_OPTIONAL macro has been added. This means that (in theory) if the radio returns an initialization error, it will try to initialize without TCXO. I'm not sure about the order.

Szetya avatar Sep 17 '25 16:09 Szetya

Well, the other change is that the TCXO_OPTIONAL macro has been added. This means that (in theory) if the radio returns an initialization error, it will try to initialize without TCXO.

I tested this and it works, thanks!

p0ns avatar Sep 17 '25 18:09 p0ns

Well, the other change is that the TCXO_OPTIONAL macro has been added. This means that (in theory) if the radio returns an initialization error, it will try to initialize without TCXO.

I tested this and it works, thanks!

Thank you for your feedback! I'm very happy that it works! And special congratulations on the DIY CAP! :) Although I was wrong, now it is compatible with two additional radios. :)

Szetya avatar Sep 17 '25 18:09 Szetya

Would it be possible to make a version to old cardputer and connect some Lora Module from RAK maybe?

I have also asked for BLE connection, but it looks to be not possible

andres-a-git avatar Oct 14 '25 17:10 andres-a-git

Would it be possible to make a version to old cardputer and connect some Lora Module from RAK maybe?

I have also asked for BLE connection, but it looks to be not possible

Perhaps it would be worth asking here: https://github.com/meshtastic/standalone-ui

Szetya avatar Oct 14 '25 17:10 Szetya

This issue has not had any comment or update in the last month. If it is still relevant, please post update comments. If no comments are made, this issue will be closed automagically in 7 days.

github-actions[bot] avatar Nov 29 '25 06:11 github-actions[bot]

this issue should stay open to track support for the official m5 stack cardputer adv lora cap. i have two.

mischief avatar Nov 29 '25 07:11 mischief

This issue has not had any comment or update in the last month. If it is still relevant, please post update comments. If no comments are made, this issue will be closed automagically in 7 days.

Ngl I hate this kind of bot

WillyJL avatar Nov 29 '25 14:11 WillyJL

This issue has not had any comment or update in the last month. If it is still relevant, please post update comments. If no comments are made, this issue will be closed automagically in 7 days.

github-actions[bot] avatar Jan 17 '26 06:01 github-actions[bot]

(Bump so the stupid bot doesn't close this)

WillyJL avatar Jan 17 '26 14:01 WillyJL

What are the options to get the older Cardputers work as Meshtastic WiFi nodes only using the UDP?

andres-a-git avatar Jan 18 '26 11:01 andres-a-git

There have been 2 variants of the LoRa Cap released since this issue was first opened. Wouldn't it be better to get this implemented now and await optimizations from upstream, if/when they happen? There are 2 closed source variants of the firmware already and both are available through M5Stack's official application flasher in some form (one through M5Burner and one through the Launcher app).

mikepparks avatar Jan 30 '26 05:01 mikepparks

Here is the open source code synced from a reddit thread from gt4kill3r: https://github.com/RaymiiOrg/meshtastic-firmware/tree/feat/m5stack-cardputer-adv

https://www.reddit.com/r/CardPuter/comments/1pxjryj/working_meshtastic_firmware_for_the_cardputer_adv/

I've disabled a few things to lower the ram usage and have less unwanted reboots.

RaymiiOrg avatar Jan 31 '26 19:01 RaymiiOrg