firmware icon indicating copy to clipboard operation
firmware copied to clipboard

M5Stack C6L Environmental sensor issue

Open Onzeisnottwice opened this issue 8 months ago • 6 comments

Hello, I just started with the M5Stack C6L with Mestastic. Out of the box works great. I am about to setup a station. Now I tried connecting an INA260 sensor. Tested it on other devices, works okay. Now connected it to M5Stack C6L using the external port that should be able to start I2C communication. The problem now is that I dont see in the Meshtastic App on OX the environmental sensor. Despite I switch it on in the app under setting. Also tried to switch SDA and SCL, still no luck. Any suggestions for me (or could it be that this setting is not suported in the firmware?). Thanks for the response.

Onzeisnottwice avatar Mar 15 '26 15:03 Onzeisnottwice

Missing device model/variant, firmware version, steps to reproduce, and expected vs actual behavior. Please provide this information for further assistance.

github-actions[bot] avatar Apr 29 '26 06:04 github-actions[bot]

Hi, not my own trial while i also have Unit C6L, but as FYI...

some days ago, one of community member on JP Meshtastic Discord faced similar issue with using I2C-based sensor via C6L's external port, which is defaulted to be used with UART-based devices like GNSS unit.

However, if we open the enclosure and remove the sticker on back side of PCB, we'll find some test points which thankfully includes pads for I2C bus. So, they bodged some wires to existing port to match with sensor's I2C pinout and voila, it wokred. note that this mod may cause signal conflict with UART without further mod to remove original signal path, be aware of that.

Yes, this requires hardware modification including soldering two wires, but still make that port work for I2C devices, instead of UART devices.

Maybe this kind of information will be nice to be published on official documentation? while it's potentially not safe, so surely "AT YOUR OWN RISK" thing though.

t-miura avatar May 18 '26 02:05 t-miura

Hi all,

I'm using Meshtastic on an M5Stack Unit C6L (ESP32-C6) too. LoRa works great, but my M5 ENV sensor isn't being detected despite enabling Environment Telemetry.

It looks like the firmware isn't scanning the correct I2C bus/pins assigned to the external Grove port on this board. Since I cannot reassign the I2C pins in the app settings, I can't get the sensor to register.

It could be interesting to add an option to choose the port, or maybe harcode it for the fimware version of the board. As said above, soldering wires the board it not a reliable solution, more a DIY workaround !

Besides, the grove port is the only port available on the device, so the problem may occur with all I2C devices.

Even if it prevents GNSS units from working, it might be possible to chose UART or I2C for the port maybe ?

Thanks!

Julien

jbonal-del avatar Jul 28 '26 08:07 jbonal-del

C6L breaks out the serial bus on the grove port. I2c is availabe via internal test points only.

caveman99 avatar Aug 10 '26 12:08 caveman99

https://github.com/meshtastic/firmware/issues/11501#issuecomment-5319581609

shlorpian avatar Aug 17 '26 19:08 shlorpian

C6L breaks out the serial bus on the grove port. I2c is availabe via internal test points only.

Sorta. :-)

From Meshtastic's perspective on the M5Stack Unit-C6L, the "primary" I2C bus (I2C Bus 0) is indeed the internal, 3v3 one. From my own notes:

Internal _3v3_ I2C Bus, also available via Test Points  (TP) on rear of PCB:
• 3v3 -- Test Point 8 (TP8)
• SCL -- Test Point 5 (TP5) / ESP32-C6 GPIO 8
• SDA -- Test Point 6 (TP6) / ESP32-C6 GPIO 10
• GND -- Test Point 3 (TP3)

Assigned in Meshtastic firmware via variant.h

#define I2C_SCL 8
#define I2C_SDA 10

While the external (white Port.X) Grove port on the M5Stack Unit-C6L is capable of all three M5Stack personalities (Port.A, Port.B, Port.C) … the Meshtastic firmware implementation elected a logical choice of "configure as Port.C / UART" so that GPS receivers would be plug-and-play. From my own notes:

NOTE: Depending on sticker orientation, may read left-to-right { White, Yellow, Red, Black } or { Black, Red, Yellow, White }.

Grove Port
HY2.0-4P                Black   Red   Yellow   White

White Connector -- I2C, GPIO, UART, I2S, CANbus, etc…
PORT.X (Host Configurable / Custom)
                        GND     5v0   S2       S1

Red Connector -- I2C
PORT.A (I2C)
                        GND     5v0   SDA      SCL

Black Connector -- GPIO
PORT.B (GPIO, PWM, Servo, 10-12 bit ADC Sample, RGB Light, …)
                        GND     5v0   .        .

Blue Connector -- UART
PORT.C (UART)
                        GND     5v0   RxD      TxD

'.' == software-implementation configurable.

Configuring the external Grove port for Port.A I2C mode in looking at Meshtastic 2.8.0 code is a substantial amount of work. It would require adding a second I2C bus pin-pair definition (I2C Bus 1), backing code (not currently a generic Meshtastic feature, only some variants/… implement I2C Bus 1+ via special-casing), figuring out how to add a UART vs. I2C mode awareness in multiple UIs, among other changes, not to mention requisite QA load.

Splitting to a "UART vs. I2C Bus 1" firmware pair for the M5Stack Unit-C6L only addresses a small effort part of the above work involved.

The sample code generated by Claude mentioned in https://github.com/meshtastic/firmware/issues/11501#issuecomment-5319581609 is interesting, swapping I2C Bus 0 out to the Grove port, and altering PI4IO init routines … however it would mean the code is far less portable, as there is more than one finished product using the M5Stack Stamp C6LoRa module (core internals of the Unit C6L), and at least one of them (Arduino Nesso N1) have other I2C devices on I2C Bus 0 beyond what the Unit C6L does.

virtualjmills avatar Aug 26 '26 00:08 virtualjmills