Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add M5Paper support #3667

Closed
wants to merge 7 commits into from
Closed

Add M5Paper support #3667

wants to merge 7 commits into from

Conversation

fonix232
Copy link

New device: M5Paper

I've had a few of these lying around for a long time, and given the form factor, I thought they'd be perfect for Meshtastic.

Sadly, the official M5Stack LoRaWAN Unit, which uses the ASR6501 radio over UART, can't be supported, so I'm a bit stuck on what kind of LoRa radio to attach to this.

Nonetheless I thought it would be nice to get some initial reviews on the parts I did finish.

Notes

  1. This will obviously not boot as-is due to the hard requirement for a LoRa radio. To work this around, any reviewer will need to change this line and replace it with a non-critical log (e.g. LOG_DEBUG("LoRa Radio not found!\n");). I've started a thread on the forum to hunt for a module that could be used.
  2. I still haven't gotten the touch screen to work, as the appropriate bits of code are in the TFTDisplay class. I'd like to propose moving all commonly shared display bits to a separate BaseDisplay class that both TFTDisplay and EInkDisplay can inherit from, thereby working around this limitation - but that is way out of scope for this PR and needs proper planning.
  3. For now, both LORA and GPS definitions are commented out - I will be enabling these once I have a solid approach to them.
  4. The display is barely readable, as there's no scaling for physical size in the current GUI framework. This, as well as handling of a partial window (the M5Paper's display runs to the edges, and since Meshtastic draws to the very edge of the screen, this makes some parts hard to read, even at appropriate scaling), would be needed for proper support of the M5Paper.
  5. Currently, this is using my fork of GxEPD2 as ZinggMJ refuses to merge any PRs or include any display they don't own. As such, I will be keeping that tag up to date (though I doubt any further changes will be needed as the display works just fine).
  6. There's a weird invalid pin error during initial boot:
INFO  | 17:38:13 1 External Notification Module Disabled
INFO  | 17:38:13 1 Doing EInk init
[  1737][E][esp32-hal-gpio.c:102] __pinMode(): Invalid pin selected
E (1732) gpio: gpio_set_level(226): GPIO output gpio_n_IT8951SetVCOM : 430955
set VCOM = -2.30
GetIT8951SystemInfo : 6001
Panel(W,H) = (960, 540)

which I can't place. It interrupts, and gets interrupted, by the EINK init sequence, so the logs are a bit garbled, making it hard to debug. Any advice regarding this would be appreciated!

@CLAassistant
Copy link

CLAassistant commented Apr 19, 2024

CLA assistant check
All committers have signed the CLA.

@caveman99
Copy link
Sponsor Member

maybe talk to @markbirss he has don work with m5paper before. His idea was to interface a generic lora radio through the sd card slot.

@thebentern thebentern added the hardware-support Add hardware support for new devices or modules label Apr 23, 2024
@fonix232
Copy link
Author

@caveman99 I was thinking of using two of the three Grove ports to provide a second SPI interface (see the forum thread) - an SX126/7/8X radio could work over 4 pins, and that leaves one of the Grove ports free for a GPS module.

@markbirss
Copy link
Contributor

markbirss commented Apr 23, 2024

@caveman99 I was thinking of using two of the three Grove ports to provide a second SPI interface (see the forum thread) - an SX126/7/8X radio could work over 4 pins, and that leaves one of the Grove ports free for a GPS module.

Hi, I tried hard before but just could not get both display and lora working

I tried the tf breakout but those pins must have resistors inline or something

image

Sadly the new yet tobe released esp32-s3 m5paper version lacks gpio breakout from the initial pictures I have seen

I have been much more successful with the m5stack coreink

Let me have a look at the changes you made if it was similar what I did before as it was tricky to get gxepd2 to use the m5paper e-eink at the time

@markbirss
Copy link
Contributor

markbirss commented Apr 23, 2024

Oh i also had the same garbled uart issue with m5stack coreink but it went better after esp32 bsp update

@markbirss
Copy link
Contributor

markbirss commented Apr 23, 2024

maybe talk to @markbirss he has don work with m5paper before. His idea was to interface a generic lora radio through the sd card slot.

Ok I see you added your own m5paper support to GxEPD2 .

At the time I found a pin combination and modified existing other display just modifying resolution

@fonix232
Copy link
Author

@markbirss thanks for the info! Could you by any chance link to the new gen M5Paper pictures you've seen?

I doubt M5 will add a proper GPIO header, the M5Paper is meant to be a handheld. But if they got rid of the IT8951, that alone will free up resources that could make it more viable (not to mention the improved power profile).

Oh i also had the same garbled uart issue with m5stack coreink but it went better after esp32 bsp update

What BSP update?

Ok I see you added your own added m5paper support to GxEPD2 .

Yep, I did many trials and the default IT8951E IT60 approach worked quite well, although needed some tinkering with the timings and the order of commands (the M5Paper's approach is to bring the MCU online, set VCOM and other settings and only then request the IC info - any other order and the chip simply stops responding). But my fork of GxEPD2 works just fine, tested it in depth myself.

@markbirss
Copy link
Contributor

markbirss commented Apr 23, 2024

@fonix232

https://twitter.com/M5Stack/status/1620371661433475075?t=G4QzN5tZQgbEOs6O7wBq6g&s=19

This is a new picture that maybe show some pins on the side, previous pictures did not show

It the espressif board support version upgrade at the time when I added n5stack coreink

At first it not allowed me to use the python cli over serial

If you are a discord member we can chat more there

@markbirss
Copy link
Contributor

@markbirss thanks for the info! Could you by any chance link to the new gen M5Paper pictures you've seen?

I doubt M5 will add a proper GPIO header, the M5Paper is meant to be a handheld. But if they got rid of the IT8951, that alone will free up resources that could make it more viable (not to mention the improved power profile).

Oh i also had the same garbled uart issue with m5stack coreink but it went better after esp32 bsp update

What BSP update?

Ok I see you added your own added m5paper support to GxEPD2 .

Yep, I did many trials and the default IT8951E IT60 approach worked quite well, although needed some tinkering with the timings and the order of commands (the M5Paper's approach is to bring the MCU online, set VCOM and other settings and only then request the IC info - any other order and the chip simply stops responding). But my fork of GxEPD2 works just fine, tested it in depth myself.

Well I'm not saying it could not work at all, it possible you approach is different so you could try like I tried the broken out tf/sdcard pins again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hardware-support Add hardware support for new devices or modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants