Closed mondalaci closed 10 months ago
Looks like factory mode is partially broken since following commit:
commit 481698e35f4196620a6884f764cbeaddf61a7e4d
Author: László Monda <laci@monda.hu>
Date: Wed Feb 22 10:45:21 2023 +0100
Put CurrentKeymap into the .data2 section because it wouldn't fit into .data1 with the RGB values included.
Scenario 1:
IsFactoryResetModeEnabled = true;
Scenario 2:
Scenario 3:
IsFactoryResetModeEnabled = true;
make flash
. (UHK restarts without powercycling and goes into factory mode.)@mondalaci does this ring any bells?
Is there anything special about how the data2 segment is initialized?
This doesn't ring a bell to me.
If there's anything special about the data2 segment, the https://community.nxp.com/ forum may be able to help.
Any further questions or findings, please do let me know.
More observations:
Chances are data(2) segment(s) are uninitialized by default for performance reasons and they should be explicitly initialized when required.
No luck with a nxp inquiry... ( https://community.nxp.com/t5/Kinetis-Microcontrollers/m-data-2-not-initialized/m-p/1785711 )
I guess it is time for the suggested workaround of initializing it explicitly ourselves?
Let's ask our NXP contact before using the workaround. I'll provide his contact via email very soon.
It's worth mentioning that the part number of the MCU is MK22FN512VLH12. The K22P121M120SF7 is some sort of identifier in the datasheet that covers multiple MCUs of the same kind.
I think I have a working version, thanks to bobpaddock's today reply. It edits lib/KSDK_2.0_MK22FN512xxx12/devices/MK22F51212/gcc/startup_MK22F51212.S. Should I post a PR into the UHK submodule repository, or should I create a copy of that file directly in firmware repository?
The former should be the correct way if the fix belongs to a file in the KSDK repo.
When powering up the UHK, random key colors can be seen for a moment. This is slightly disturbing and should be avoided.