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

Flashed a CH582M badge with 11x55 instead of 11x44 LED's and now its bricked - no OEM-backup available #59

Open
froscon2024 opened this issue Oct 11, 2024 · 3 comments

Comments

@froscon2024
Copy link
Contributor

I got asked to flash a WCH CH582M badge a person had. Person have it some longer time ago probably from a opensource-conference. So we expected to be a fossasia-badge. It look similar, have CH582M, so the firmware got flashed.
Now the badge is bricked. Because the closed source firmware are read-only a OEM-firmware-backup does not exist.
Fossasia Version 0.1 .bin was flashed. Reflashed 3 times but no working state.

How does the current state with the 0.1 look like and how does it differ from the fossasia badges i have:
Bootloader worked like known. I disconnected battery, pressed and held the button next to the micro-USB connector and could write to the badge with wchisp.
The situation when i get some life out of it is after flash with disconnected battery. It then show some completely broken looking animation that should probably be the fossasia bootlogo.
After showing the unreadable animation its dead. Buttons does not work. They seem to be mapped different on that board or something else is wrong. It does not matter what or how often i press the buttons.
When i disconnect and reconnect the battery, the badge do not get back to life like it does on the other ones.
Just powering over usb can bring the badge to life with the wrong output.

I left the badge with battery disconnected because of its now fully unknown state. It should not kill its battery because of the state it is in now.

I expect i have to try debugging over UART, right? Is there a prebuild firmware file with UART (DEUBG=1) enabled?

@kienvo
Copy link
Member

kienvo commented Oct 12, 2024

Can you please post a picture of the back of this board and while it loads the boot logo? I think this badge has different assigned pins.

Also, is this board 11x44 LEDs? The current state of the firmware does not support any board different than 11x44.

There is no prebuild firmware with DEBUG enabled. You can manually build one, but it will not log anything other than USB's debug log.

@froscon2024
Copy link
Contributor Author

led1
pcb1

Now i realize that it is a 11x55 badge. I did not know such existed. I knew about the ones with 11x44 and the ones with 12x48. So i have count 11 rows, checked about the chipset and flashed the firmware.

There is a 240fps video running the 0.1 firmware with its boot animation. The video file is too big to upload to github. So i had to upload it somewhere else:
page 1: https://filetransfer.io/data-package/CYbwTDw8#link
page 2: https://file.io/j7s2lxKQHc24

I probably have now to develop the things for the different resolution. I would be happy if i could just use up 11x44 of the 11x55 rows but i do not know if this would somehow work and be more easy for the development part. Probably i would have to also modify the badge configuration software to make it working with 11x55 if its not possible to just ignore the more LED's and use just 11x44 of the badge.
Do you know at what code part i should start with this task?

@froscon2024 froscon2024 changed the title Flashed a CH582M badge and now its bricked - no OEM-backup available Flashed a CH582M badge with 11x55 instead of 11x44 LED's and now its bricked - no OEM-backup available Oct 13, 2024
@kienvo
Copy link
Member

kienvo commented Oct 18, 2024

I bought an 11x55 badge when preparing for GSoC and realized it's the wrong version. Here is my 11x55 badge:

front
back

It looks like some last few columns were hacked up to use Charlieplexing with fewer pins than usual. But not sure if my badge is the same as yours.

I probably have now to develop the things for the different resolution. I would be happy if i could
just use up 11x44 of the 11x55 rows but i do not know if this would somehow work and be more easy for the development part. Probably i would have to also modify the badge configuration software to make it working with 11x55 if its not possible to just ignore the more LED's and use just 11x44 of the badge.
Do you know at what code part i should start with this task?

To modify the firmware for your badge, first trace the LEDs according to Charlieplexing then change the assigned pin here:

static const pinctrl_t led_pins[LED_PINCOUNT] = {
PINCTRL(A, 15), // A
PINCTRL(B, 18), // B
PINCTRL(B, 0), // C
PINCTRL(B, 7), // D
PINCTRL(A, 12), // E
PINCTRL(A, 10), // F
PINCTRL(A, 11), // G
PINCTRL(B, 9), // H
PINCTRL(B, 8), // I
PINCTRL(B, 15), // J
PINCTRL(B, 14), // K
PINCTRL(B, 13), // L
PINCTRL(B, 12), // M
PINCTRL(B, 5), // N
PINCTRL(A, 4), // O
PINCTRL(B, 3), // P
PINCTRL(B, 4), // Q
PINCTRL(B, 2), // R
PINCTRL(B, 1), // S
#ifdef USBC_VERSION
PINCTRL(B, 6), // T
#else
PINCTRL(B, 23), // T
#endif
PINCTRL(B, 21), // U
PINCTRL(B, 20), // V
PINCTRL(B, 19), // W
};

You might want to change the button pin as well:

GPIOA_ModeCfg(KEY1_PIN, GPIO_ModeIN_PD);
GPIOB_ModeCfg(KEY2_PIN, GPIO_ModeIN_PU);

#define KEY2_PIN (GPIO_Pin_22) // PB
#define KEY1_PIN (GPIO_Pin_1) // PA
#define isPressed(key) ((key) ? \
!GPIOB_ReadPortPin(KEY2_PIN) : \
GPIOA_ReadPortPin(KEY1_PIN))

The battery measurement pin:

GPIOA_ModeCfg(GPIO_Pin_5, GPIO_ModeIN_Floating);

The charging pin:

GPIOA_ModeCfg(CHARGE_STT_PIN, GPIO_ModeIN_PU);
GPIOA_ITModeCfg(CHARGE_STT_PIN, GPIO_ITMode_FallEdge);

GPIOA_ModeCfg(CHARGE_STT_PIN, GPIO_ModeIN_PU);

And yes, it is un-unified. I was thinking of converting these pin configs to an HAL module where we can config the pins for each version of the badge easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants