-
• #29
there is no prompt to put into bootloader mode...nothing else happens.
That's a bit strange... The IDE should work.
However maybe you could try using the Nordic App to do the upload (http://www.espruino.com/MDBT42Q#firmware-updates) that's what we usually suggest
-
• #30
I got the latest FW in using the ULR link as I mentioned but the write register commands aren't working for me....
-
• #31
I just tested with device I just have here - nrf52840 dongle and indeed have some issues with this if I connect over bluetooth. However when I connect over USB serial it worked. Can you try over serial console without using bluetooth console at all?
this was over serial>var d=0 =0 > NRF.disconnect();NRF.restart(function(){d=1;}) >d =1
when tried bluetooth
>var d=0 =0 Disconnected from Web Bluetooth, Dongle c56e >NRF.disconnect();NRF.restart(function(){d=1;}) Found NRF52840Dongle, 2v08.156 > Connected to Dongle c56e >d =0
I also tried without NRF.Disconnect - you need to disconenct after calling it, it prints
>NRF.restart(function(){d=1;}) BLE Connected, queueing BLE restart for later =undefined
and should restart later but d is still 0 after reconnecting.
Strange, this worked previously. Not 100%, sometimes I saw this too, but mostly it worked fine. If this happened previously, after E.reboot() it worked. -
• #33
yes, it has only serial console on pins mentioned here
https://github.com/espruino/Espruino/blob/master/boards/MDBT42Q.py#L23 -
• #34
Oh ok. I use TTL Serial devices all the time.. missed that. I'll try it but for the production pcbs this will be a pain to connect serial and override the register.
-
• #35
I'll try it but for the production pcbs this will be a pain to connect serial and override the register.
It shouldn't be required, but hopefully this will help to narrow down if it is the issue.
Actually I just had a thought. Try:
NRF.disconnect();setTimeout(function() { NRF.restart(function(){ LED.set(); poke32(0x4001e504,1);while(!peek32(0x4001e400)); // enable flash writing poke32(0x1000120c,0xfffffffe);while(!peek32(0x4001e400)); // NFC pins as GPIO poke32(0x4001e504, 0);while(!peek32(0x4001e400)); // disable flash writing })}, 1000)
It's possible the disconnect isn't instant and so NRF.restart doesn't get called.
-
• #36
Thankyou @Gordon, that works... I've put in the extra semi-colons...
NRF.disconnect();setTimeout(function() { NRF.restart(function(){ LED.set(); poke32(0x4001e504,1);while(!peek32(0x4001e400)); // enable flash writing poke32(0x1000120c,0xfffffffe);while(!peek32(0x4001e400)); // NFC pins as GPIO poke32(0x4001e504, 0);while(!peek32(0x4001e400)); // disable flash writing });}, 1000);
-
• #37
Great! I'll update the previous post
-
• #38
It's possible the disconnect isn't instant and so NRF.restart doesn't get called.
Strange that when you are still connected it tell you this
BLE Connected, queueing BLE restart for later
and so it is actually not called at all after disconnect? Because this didn't work too. -
• #39
I'm struggling to find the link to the Nordic app to try..Must be missing the obvious
-
• #40
it is actually not called at all after disconnect? Because this didn't work too.
It is called, but it won't execute the JS you gave it :)
I'm struggling to find the link to the Nordic app to try
For firmware updates?
-
• #41
You really did mean an app (not going down that route)... I've just sent someone instructions to use the URL approach but firmware zip file might change so it won't be right. the local file select function just doesn't work which is a shame. Tried it numerous times..
-
• #43
You really did mean an app (not going down that route)
You mean you never install any apps on your phone? Honestly the NRF Connect app is harmless, ad-free, and very useful when developing with Bluetooth LE.
why do we need to restart the "softdevice" to be able to use the poke32
poke32
works totally fine with the softdevice running on most addresses, but there's a certain level of memory protection added while the softdevice (bluetooth stack) is running - it doesn't want you to be able to modify internal registers like UICR.So what we do is disable the Bluetooth stack, write them, and restart it. You also have to fully reset the device after setting the registers in order for the pins to work.
But you only ever have to do this once for each device.
-
• #44
Many thanks for that. Will look at the app then. Its probably more the downloading firmware files from a remote location...
-
• #45
I'm not entirely sure I understand the concern here as I imagine this is something you'd do at the factory (or if you're ordering a bunch of MDBT42 from us we can arrange that they are pre-flashed with newer firmware). The Nordic App works from a file saved locally on your Android device.
However you're welcome to host the firmware files yourself on your own server if that's an issue.
-
• #46
Will try it....
-
• #47
Will look at the app then. Its probably more the downloading files from a remote location...
It is an app for Android or iPhone in builtin Google or Apple app store so no downloading of random files. NRF Connect app is made directly by Nordic Semiconductor for testing BLE and flashing Nordic chips. https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Connect-for-mobile
As for poke32 - those 0x4001exxx addresses used are accessing low level NVMC hardware to directly write/erase flash memory. Doing this is protected because it would interrupt bluetooth timing - when writing to flash the CPU is completely halted until write is done which can take relatively long. So the softdevice manages flash access while it is running and writes to flash are carefully timed to not to break bluetooth traffic.
If you run that code while bluetooth is on it will immediately reboot.
-
• #48
If you haven't sorted this, any chance you could try this code:
NRF.disconnect();setTimeout(function() { NRF.restart(function(){ poke32(0x4001e504,1);while(!peek32(0x4001e400)); // enable flash writing poke32(0x1000120c,0xfffffffe);while(!peek32(0x4001e400)); // NFC pins as GPIO poke32(0x4001e504, 0);while(!peek32(0x4001e400)); // disable flash writing }) }, 2000);
It might be the timeout helps since it's possible the board hadn't disconnected right after
NRF.disconnect
was called.
so are you actually calling the SETNFC() method?you might also try setting some global variable inside the uicr flashing method sent to NRF.restart to verify it is really called.like
var done=0
and addingdone=1
afterpoke32(0x4001e504, 0);while(!peek32(0x4001e400));