-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 😅
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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).
There was a problem hiding this 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 | ||
- |
There was a problem hiding this comment.
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
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