I'm new to the NRF series, and for that matter Keil. I have a BT832A which is apparently an NRF52810.
I am able to flash my own code using Keil and and control GPIOs to Charlieplex LEDs using an ST-Link and the following settings:
Debug or Utilities:
Use ST-Link Debugger -> Settings
- Flash Download:
- Erase Full Chip
- RAM for Algorithm: Start: 0x20000000 Size: 0x2000
- Programming Algorithm: NRF52xxx SoftDevice Erase
- Size 2M 00000000H - 001FFFFFH
Device:
Nordic Semiconductor
- NRF52 Series:
- nRF52832_xxAA
Target:
- R/O Memory Areas:
- IROM1: Start:0x0 Size:0x9A4
- R/W Memory Areas:
- IRAM1: Start: 0x20000000 Size: 0x2008
On build: Program Size: Code=1336 RO-data=1128 RW-data=4 ZI-data=8196
I use RW+ZI for Ram Size in the target and I use Code+RO+RW for Rom Size in the target. This appears to be right because if I reduce either my Ram or Rom size by 1 I get an error that it wont fit and if I use the calculation as is the program loads and my lights flash.
Ok so basics work, I know my stlink works, I know keil works, and I know my basic understanding of the R/O and R/W target settings is good.
-----
My problem is when it comes to actually using a soft device I cant get anything to load from the examples that will let me see a BLE device.
Using either SoftDevice S112 or SoftDevice S132 I have tried to load the soft device first with Keil uVision by creating a blank project, locating the hex file on the output tab, setting up my stlink with the NRF52xxx SoftDevice Erase as above, and target sizes based on the same algorithm.
s112_nrf52810_5.1.0 s112_nrf52810_5.1.0_softdevice.hex
- Flash 96k (0x18000 bytes)
- RAM 3.68k (0xeb8 bytes)
s132_nrf52_6.1.0 s132_nrf52_6.1.0_softdevice.hex
- Flash 152k (0x26000 bytes)
- Ram 5.54k (0x1628 bytes)
Load "..\\Downloads\\s112_nrf52810_5.1.0\\s112_nrf52810_5.1.0_softdevice.hex"
Full Chip Erase Done.
Programming Done.
Verify OK.
Flash Load finished at 17:24:34
Next I open one of the example projects, such as UART over BLE:
ble_app_uart_s132_pca10040.uvprojx
Builds to: Program Size: Code=16456 RO-data=708 RW-data=216 ZI-data=10112
Program Size: 17,380 (0x43E4)
Ram Size: 10,328 (0x2858)
So I also setup my programming algorithm the same to NRF52xxx SoftDevice Erase but I tell it not to erase anything because I did that in the previous load. I set my target as follows:
- IROM1: Start: 0x18000 Size: 0x43E4
- IRAM1: Start: 0x20000eb8 Size: 0x2858
Builds with no errors.
Loads with no errors:
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'nrf52832_xxaa_s132'
linking...
Program Size: Code=16456 RO-data=708 RW-data=216 ZI-data=10112
FromELF: creating hex file...
".\_build\nrf52832_xxaa_s132.axf" - 0 Error(s), 0 Warning(s).
Build Time Elapsed: 00:00:00
Load "C:\\Users\\packe\\Documents\\ble_peripheral\\ble_app_uart\\pca10040\\s132\\arm5\\_build\\nrf52832_xxaa_s132.axf"
Programming Done.
Verify OK.
Application running ...
Flash Load finished at 17:38:24
----
But no BLE devices!?
----
If I take the same soft device and I use my generic gpio flashing code set using the same calculation it builds and loads into 0x18000 and 0x20000EB8 with only "erase sectors" selected and it runs!
So the BLE Soft device must be loading and running to 0x18000 or it wouldnt be flashing my lights afterwards.
Why no BLE device?