BigCorvus / SMA-Q2-Firmware-3

3rd take on the ultimate open source smartwatch project
13 stars 3 forks source link

DFU upload #1

Open MagicNoSpam opened 4 years ago

MagicNoSpam commented 4 years ago

Great job on the Firmware for the smartwatch! More of a question than an issue: Which program on the smartphone did you use to upload firmware? I tried Nordic's "nRF Toolbox" as well as "nRF Connect" on an iPhone but both don't seem to work. Thanks!

MagicNoSpam commented 4 years ago

Adding to the above, here is where I'm stuck: After activating the DFU mode with NRF_POWER->GPREGRET = 0x01; sd_nvic_SystemReset(); the device resets but stops advertising via BLE so I can't connect to it anymore.

I burned the bootloader as well as the softdevice successfully. The main file SMAQ2_FW3.INO compiled and uploaded successfully as well. As I understand, NRF_POWER->GPREGRET saves the status (0x1) but I don't see where it gets read?

BigCorvus commented 4 years ago

I'm not able to go into deeper debugging, but does your watch display the ota-screen? Annoying fact: I'm using nrf toolbox on a galaxy s5. On the S8 Plus I get an error too and I'm not able to Flash it! -- Diese Nachricht wurde von meinem Android Mobiltelefon mit WEB.DE Mail gesendet.Am 02.01.20, 15:16 schrieb MagicNoSpam notifications@github.com:

Adding to the above, here is where I'm stuck: After activating the DFU mode with NRF_POWER->GPREGRET = 0x01; sd_nvic_SystemReset(); the device resets but stops advertising via BLE so I can't connect to it anymore. I burned the bootloader as well as the softdevice successfully. The main file SMAQ2_FW3.INO compiled and uploaded successfully as well. As I understand, NRF_POWER->GPREGRET saves the status (0x1) but I don't see where it gets read? —You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.

MagicNoSpam commented 4 years ago

Thanks for the feedback. I'm actually using a "simulated Q2" - using an NRF52832 with buttons connected to the same pins. When pressing the buttons BTN_UP, BTN_DWN and BTN_BCK the function readDFUcombo() correctly reads the button states and executes the sd_nvic_SystemReset(). The reason I simulated the Q2 is that I'm planning to use the OTA DFU function with Sandeepmistry's implementation and the Low Power version from Forward Computing for another project. Your implementation is the only one I could find combining these elements. I actually plan to make the DFU mode buttonless. Here is what I believe I have to do to make this work: 1.) modify and compile the DFU bootloader example from the SDKv11 2.) use mergehex from Nordic to merge the hex bootloader with the softdevice (s132_nrf52_2.0.0_softdevice.hex) 3.) flash the softdevice/bootloader to the NRF52832 board 4.) initiate the DFU mode as you did with NRF_POWER->GPREGRET = 0x01; sd_nvic_SystemReset();
5.) the Bootloader will read the GPREGRET == 0x01 and initiate DFU mode 6.) use the nRF Toolbox to upload new code OTA

As you probably went through these or similar steps I wonder if you think I'm on the right track?

Thanks again!

BigCorvus commented 4 years ago

Which bootloader do you have installed at the moment?Keep in mind that neither the sandeepmistry nor the pfod core provide you with a bootloader. I'm using the pre-installed one in the SMA-Q2... -- Diese Nachricht wurde von meinem Android Mobiltelefon mit WEB.DE Mail gesendet.Am 03.01.20, 00:51 schrieb MagicNoSpam notifications@github.com:

Thanks for the feedback. I'm actually using a "simulated Q2" - using an NRF52832 with buttons connected to the same pins. When pressing the buttons BTN_UP, BTN_DWN and BTN_BCK the function readDFUcombo() correctly reads the button states and executes the sd_nvic_SystemReset(). The reason I simulated the Q2 is that I'm planning to use the OTA DFU function with Sandeepmistry's implementation and the Low Power version from Forward Computing for another project. Your implementation is the only one I could find combining these elements. I actually plan to make the DFU mode buttonless. Here is what I believe I have to do to make this work: 1.) modify and compile the DFU bootloader example from the SDKv11 2.) use mergehex from Nordic to merge the hex bootloader with the softdevice (s132_nrf52_2.0.0_softdevice.hex) 3.) flash the softdevice/bootloader to the NRF52832 board 4.) initiate the DFU mode as you did with NRF_POWER->GPREGRET = 0x01; sd_nvic_SystemReset(); 5.) the Bootloader will read the GPREGRET == 0x01 and initiate DFU mode 6.) use the nRF Toolbox to upload new code OTA As you probably went through these or similar steps I wonder if you think I'm on the right track? Thanks again! —You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.

MagicNoSpam commented 4 years ago

Ok - that makes sense with the SMA-Q2 already coming with it's own boot loader. I clicked on the "Burn Bootloader" menu item in the Arduino IDE but it's not clear to me which bootloader file - if any - gets uploaded... I will look into writing my own bootloader that switches to DFU mode if GPREGRET is set to 0x01

BigCorvus commented 4 years ago

The Arduino function only uploads the softdevice I think, which is installed on the watch anyway. Good luck with your Project! -- Diese Nachricht wurde von meinem Android Mobiltelefon mit WEB.DE Mail gesendet.Am 03.01.20, 19:40 schrieb MagicNoSpam notifications@github.com:

Ok - that makes sense with the SMA-Q2 already coming with it's own boot loader. I clicked on the "Burn Bootloader" menu item in the Arduino IDE but it's not clear to me which bootloader file - if any - gets uploaded... I will look into writing my own bootloader that switches to DFU mode if GPREGRET is set to 0x01 —You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.

MagicNoSpam commented 4 years ago

Thanks BigCorvus :)

MagicNoSpam commented 4 years ago

Just as an update - I was able to write my own bootloader and all works very well now. I can use is for any NRF52 chip to upload firmware. Your code helped me to get started with the App piece that can trigger the DFU mode so thank you for your inspiration!