-
Notifications
You must be signed in to change notification settings - Fork 27
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
Flash Micropython using Openocd ? #8
Comments
Yes, indeed, they are not suitable for flashing via openocd directly. While it may work in specific cases if you know what you are doing it may not work in other cases even if you got right files and flashed it to correct address. And BTW you did not post your openocd commands, only output so it is hard to guess what exactly you did. Anyway in this case there is no chance as sd_bl is combined softdevice and bootloader that needs to be splitted and each part belongs to different location. If you knew what to do you could flash S132 6.1 softdevice alone (hex file from nordic), then bootloader from this zip https://github.com/fanoush/ds-d6/blob/master/micropython/DS-D6-adafruit-bootloader-long-packets.zip (belongs to 0x78000 address) and then you could hopefuly boot it and it may stay in bootloader so you can flash application zip over bluetooth. nrf52 boot flow is like
there is lot of ways to break this flow if you flash bin files randomly |
Oh, now I see you used all the commands on single openocd command line, interesting. Anyway, program command with bin file without specific address has zero chance of success too. hex file has correct location stored inside, bin files have no such info, it is just raw data. |
@fanoush Thank you for your extensive and clear response. I have been using a single openocd command, that makes it a lot easier to try the (MANY) falshes I tried ;-) The openocd command I used was in the output above, but it is looong. It reads: OK, the .bin files can not be used in the way I hoped:
Just for fun I will try your suggestion to:
Your description of "nrf boot flow" is very informing and will help me in my quest. Appreciate your help! |
Following your suggestion I tried: Flash runs without errors, but after reboot no BLE device is found with Nordic NRFconnect App. I will forget about Micropython for now, and focus om Espruino. That flashes and runs fine. My ultimate goal is to flash my new F18 smartwatch with Espruino or Micropython, but NOT before I have some experience with the NRF52832 module. Thanks for your time. Output from the Openocd command was:
|
Since you were doing mass erase the UICR space gets cleared too so there is no pointer to bootloader and softdevice jumps directly to (missing) application. So if running mass erase (which is not needed, unless you really want to clear uicr) you need additional hex or bin file to flash to bank 1 (flash write_bank 1 file as per openocd help), e.g. this one https://github.com/fanoush/ds-d6/blob/master/fwdump/dsd6-uicr.bin |
Making progress with your remark on UICR ;-) I had previously seen the nrf52.uicr bank, I already wondered where the UICS bank went ;-) I used mass-erase because my E73 module was locked, and thought this as an extra measure to get rid of the original firmware in te module. Got rid of nrf52.uicr too. Excellent, getting some progress now. I extended my previous Openocd command with flashing dsd6-uicr.bin to bank 1: pi@raspberrypi3:~ $ sudo openocd -f interface/raspberrypi2-native.cfg -c "transport select swd" -f target/nrf52.cfg -d2 -c init -c "reset init" -c halt -c "nrf5 mass_erase" -c "program s132_nrf52_6.1.1_softdevice.hex verify" -c "program dsd6_nrf52832_bootloader-0.2.11-3-gfb847b9-dirty-nosd.bin verify 0x78000" -c "flash write_bank 1 dsd6-uicr.bin" -c "flash banks" -c reset -c exit Result:
Next step is trying to flash an application using DFU. Many thanks for your help so far. Will keep you posted. |
Success!! Using the NRFConnect App I uploaded the file https://github.com/fanoush/ds-d6/blob/master/micropython/DS-D6-micropython1.10-blerepl.zip to my E73 module: NOTE : The upload was stuck at 0% at first, but after reducing the NrfConnect number of packets from 10 to 5 as you described here it worked OK. When the upload was finished I was able to connect to the WEBREPL, using the CHROME browser and URL https://aykevl.nl/apps/nus/ Connect to the Nrf device called "mpus": My first Micropython statement executed :-) This is my Development Platform from https://www.aliexpress.com/item/4000242009052.html?spm=a2g0s.9042311.0.0.585f4c4dtAjTQm Many thanks for your help @fanoush, would have been impossible without it! |
Re your Development Platform: Ebyte sells a "devboard" with pins broken out & USB-UART: https://www.aliexpress.com/item/32968640384.html?spm=2114.12010615.8148356.6.5e2d37defrP6lh |
@AkosLukacs I have an F18 Smartwatch that I want to use for some experiments. But before I replace the stock firmware on the F18 I wanted to experiment with the cheapest NRF52832 solution, so I bought this: They have an NRF52832 board with pins and USB-UART, but I was too cheap to buy this one. BTW : the board in your link has an NRF5210 chip on it, but they have an NRF52832 too: I have also bought this NRF52840 module. This chip has built-in USB hardware, should require only 2 resistors to connect to a USB port. And this chip is supported by the Adafruit Circuitpython firmware. Now that I have Micropython running I realize that there is no real WebBluetooth IDE solution for Micropython. Running Espruino on NRF52 is very well supported by the "Espruino web IDE", that very usable. I enjoy reading the communication on Gitter between you and @fanoush about NRF52832 smartwatches. It inspired me to start my experiments. Have been using ESP8266 for 5 years now, but that's not suitable for a "wearable". Cheers. |
My bad with the link, just clicked on the image without reading. But looks like you already knew it :) Espruino sort of works on nRF52840 - you can connect via BLE, and basics work, but for example bluetooth scan fails. Hopefully it will be better because Gordon will work on RAK5010 that has nRF52840. I have that module too. Sitting in a box for now... |
@AkosLukacs Based on my current experience with the bare modules, I think that buying an official Nordic USB dongle would have been an easier choice. Like the "Ebyte devboard" you bought, or something like this: I read the link on the use of Espruino on NRF52840, good to know that it "sort of works" ;-) Experimenting now with the Ds-D6-Micropyton install. Use it with the WebBluetooth IDE of https://aykevl.nl/apps/nus/ Tried using the Espruino Web IDE for connecting to the Ds-D6-Micropyton install. WebRepl "sort of works", but also times out within 1 minute. Any tips for a better working Micropython WebBluetooth IDE? |
Hi,
Have been following this github and gitter about alternative firmware for NRF52832, excellent info @fanoush !
Now I would like to flash my Nrf52832 (actually a E73.....) with Micropython using Openocd, but after much reading and many attempts I did not succeed.
Flashing Espruino .hex firmware for NRF52832 using Openocd works fine. No Openocd errors, and I can use the Espruino Web IDE on Google Chrome. The command I use on RPi is:
For Micropython I tried to flash 2 files from this github:
But after flashing and verifying OK, the NRF does not start and Openocd reports:
Below the openocd command and it's output.
I assume my error is in flashing the 2 .bin files in the wrong memory position. Or these bins may not be suitable for flashing directly? Googles a LOT bit did nof find a solution.
Could anybody point me in the right direction, would be appreciated!
Thx.
The text was updated successfully, but these errors were encountered: