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 support for new spi memory chip #12

Merged
merged 5 commits into from
Sep 4, 2024

Conversation

JF002
Copy link
Collaborator

@JF002 JF002 commented Jul 23, 2024

PineStore notified the community that the SPI flash memory chip (XTX XT25F32B) used in the PineTime was EoL (End-Of-Life) and will be replaced by another chip (BY25Q32).

Since we want to provide a new version of the firmware (bootloader + application) in a short time frame to avoid the production of the next batch of PineTime being delayed, we did our best to add support for the new chip by doing the smallest and less risky changes possible.

The version of MyNewt this project is based on (1.8.0) do not support any of the memory chips out of the box. The current version defines the JEDEC IDs in the NRF52 "BSP". The downside of this way of specifying the IDs of the chip is that you can only define a single chip. Newer versions of MyNewt allow to ignore the ID, but this is not available in our version.

These changes patches the spiflash driver of MyNewt to add support for both memory chip, and enable them so that the system checks for both IDs at startup.

I also took the opportunity to set the display brightness to the lowest level to prevent devices with low battery from bootlooping.

Update version to 1.0.1

Fixes #11

JF002 added 4 commits July 23, 2024 19:10
PineStore notified the community that the SPI flash memory chip (XTX XT25F32B) used in the PineTime was EoL (End-Of-Life) and will be replaced by another chip (BY25Q32).

Since we want to provide a new version of the firmware (bootloader + application) in a short time frame to avoid the production of the next batch of PineTime being delayed, we did our best to add support for the new chip by doing the smallest and less risky changes possible.

The version of MyNewt this project is based on (1.8.0) do not support any of the memory chips out of the box. The current version defines the JEDEC IDs in the [NRF52 "BSP"](hw/bsp/nrf52/syscfg.yml). The downside of this way of specifying the IDs of the chip is that you can only define a single chip. Newer versions of MyNewt allow to ignore the ID, but this is not available in our version.

These changes patches the spiflash driver of MyNewt to add support for both memory chip, and enable them so that the system checks for both IDs at startup.
This should help prevent devices with fully depleted battery from bootlooping.
Add description of the patch in README.md
Add doc about the generation of the version bitmap
@@ -215,7 +216,7 @@ static int init_display(void) {
rc = hal_gpio_init_out(DISPLAY_CS, 1); assert(rc == 0);
rc = hal_gpio_init_out(DISPLAY_DC, 0); assert(rc == 0);
// Switch on backlight
rc = hal_gpio_init_out(DISPLAY_HIGH, 0); assert(rc == 0);
rc = hal_gpio_init_out(DISPLAY_LOW, 0); assert(rc == 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set the other pins high explicitly? Or is this enough to guarantee low backlight only

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess they are high by default since the MEDIUM and LOW were not previously set.
But I can set them to high to remove any doubt.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I haven't looked around the bootloader code before, so if the pins are explicitly high by default that's fine (I have no clue what the default values are / where they come from)
Since it's free though, I think we may as well make it completely clear they're high

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I'm not the original author of the firmware, and I barely know MyNewt so... that's another reason why I try to change as little code as possible 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. If we're not really sure, I would definitely set them high explicitly then just to be certain that the panel will be in low brightnesss mode only

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

…values : LOW is set to 0 (enable) and MEDIUM/HIGH are set to 1 (disable).
Copy link

@NeroBurner NeroBurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good and minimal. Dou you think the support for the two chips could be added to mynewt as PR?

Didn't test, just looked through the code

#if MYNEWT_VAL(SPIFLASH_EON2580B)
EON_CHIP(EN80B, 0x30, FLASH_CAPACITY_8MBIT),
#endif
-

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add that newline at the end of the defines to have one less line changed in the patch

@JF002 JF002 merged commit 3dce219 into develop Sep 4, 2024
@JF002 JF002 deleted the add-support-for-new-spi-memory-chip branch September 4, 2024 19:16
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

Successfully merging this pull request may close these issues.

PineStore announcement : the current flash chip is EoL, a new one will be used for future PineTime batches
3 participants