lancaster-university / microbit-v2-samples

CODAL build tools and sample programs for the micro:bit v2.x
MIT License
64 stars 83 forks source link

NRF52833 #29

Open tcpipchip opened 3 years ago

tcpipchip commented 3 years ago

I finally compiled using Msys32 image

tcpipchip commented 3 years ago

the HEX created is a hello world, right ? How can i compile the other examples ?

finneyj commented 3 years ago

Oh, that's cool. Perhaps you could share the process so that other can more easily do the same? We have a docs site coming soon, and I'd welcome a PR to the README?

You'll find quite a few examples in the "samples" folder of this repo. I'm afraid I haven't had chance to organize the samples here as well as I did for micro:bit v1 (Universities have been really busy due to all the covid mitigation work we've had to do this last 12 months... so there hasn't been much time for voluntary projects!). please consider these a work-in-progress. Most samples are fine, but I expect a few may be a little out of date. Please raise an issue here if you have problems.

The process to run a samples is simple though. They are all compiled by default, you just have to call the relevant function from main.cpp (in the source folder):

I hope this helps

tcpipchip commented 3 years ago

image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image If got error, in CmakeCache.txt, then replace CMAKE_EXE_LINKER_FLAGS:STRING=-Wl,--enable-auto-import by CMAKE_EXE_LINKER_FLAGS:STRING=-W image image

Dont forget nano ~/.bashrc export PATH=$PATH:$HOME/gcc-arm/bin

Success!

Enjoy Miguel Wisintainer

tcpipchip commented 3 years ago

when you are back, let me know i have questions!

finneyj commented 3 years ago

Thanks very much for this @tcpipchip!

It will be very useful to be able to point others at your resource here, so that they can benefit from what you've learned.

If you have questions, feel free to raise them in an issue. We'll try to answer them as soon as we can. :)

tcpipchip commented 3 years ago

Thanks @finneyj

Here some one of questions that i remember now :)

About the .HEX/BIN created by the MicroBit V2 compiler, does it includes de BOOTLOADER of NORDIC NRF52833 ?

For example, if the user not use the MASS STORAGE DEVICE (DAP-LINK) to transfer, but just a SWD (SEGGER, ST-LINKV V2) to transfer, will work ?

basicchip commented 3 years ago

I'm following in tcpipchip's footsteps running on MSys. I can compile and build files in microbit-v2-samples, but when I copy the resulting .hex file to MAINTENANCE it shows a FAIL text document

error: The starting address for the interface update is wrong. type: user

This is with the default hello world example -- Any clues?

Has anyone a known good .hex file for a microbit v2

PS I also have it running on a Debian Linux PC, same issue.

jamesadevine commented 3 years ago

You should not be copying the resulting hex file to maintenance. Copy the file to the standard MICROBIT mass storage device.

finneyj commented 3 years ago

@tcpipchip The MICROBIT.HEX file produced is a full image for the NRF52833 MCU.

Using the DAPLink interface is the simplest way to get that image onto the NRF52833, but if you prefer to use a different SWD programmer that should work fine too.

finneyj commented 3 years ago

@basicchip Does your micro:bit always boot into MAINTENANCE mode? It really shouldn't...

If it does, this implies that the KL27 interface MCU has somehow lost its DAPLINK firmware. You can recover by reflashing the DAPLINK firmware by drag/drop of the latest DAPLInk firmware in whilst the device is in MAINTENENCE mode. it should then reboot into normal MICROBIT mode after that.

You can get the DAPLink firmware from the micro:bit foundation website. Make sure you use the V2 version :)

https://tech.microbit.org/software/daplink-interface/

basicchip commented 3 years ago

Thank you finneyj and james, sorry I misread the download procedure. Hello World now comes up on my microbit V2

Can you use the DAPLINK to do any GDB debugging, with pyocd for instance?

jamesadevine commented 3 years ago

@basicchip Yes absolutely.

Here is the pyocd command I use:

pyocd-gdbserver --persist -t nrf52840 -bh -r

You must use the nrf52840 target for pyocd to get a functional memory map (nrf52833 is not yet added).

In the micro:bit samples v2 directory:

arm-none-eabi-gdb --eval "target remote :3333" build/MICROBIT 
basicchip commented 3 years ago

Looking for a UART example (there is one in the codal v2 samples), not sure I can mix and match. I have not got docker running on Msys, but I believe I got it running on debian, but need to switch PCs

tcpipchip commented 1 year ago

@jamesadevine @finneyj I have stock some NRF52833 mcu Is there some bootloader that allows to transter the hex created by microcode (Microsoft) and execute on it ?

jamesadevine commented 1 year ago

@tcpipchip this bootloader exists from adafruit: https://github.com/adafruit/Adafruit_nRF52_Bootloader I believe I added support for the 833 some time ago.

jamesadevine commented 1 year ago

Ah -- misremembered, I added a driver for AP102s -- the 833 support was already there and worked great.

tcpipchip commented 1 year ago

hi @jamesadevine

Can you test this attached MAKECODE to see if run on NRF52833 using your bootloader ?

The makecode example writes 1 and 0 in many GPIOS :)

microbit-ublox-b4.zip

jamesadevine commented 1 year ago

I'm afraid not -- I no longer have a board with the bootloader installed. You'll have to try it yourself!

tcpipchip commented 1 year ago

Ok, i will test soon! Bootloader ok! Mass storage device showing on pc

tcpipchip commented 1 year ago

Wow, the python converter fail to convert the hex (makecode) to dfu, to me transfer to the nrf52833 :( image

tcpipchip commented 1 year ago

Success! Running Microbit no U-BLOX NINA B4 :) I had to edit the HEX, because is to in one!

tcpipchip commented 1 year ago

https://nina-b302-arduino-adafruit.blogspot.com/2022/07/u-blox-nina-b40-opencpu-programado-com.html