This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

S110 ADC Example

Hi. I've never asked a question here, and I'm a complete beginner to embedded programming, so I apologize if I break protocol in anything I do on here.

My setup: nrfgo Motherboard (nRF6310) and nrf51822 module Environment: nrfStudio in conjunction with Keil Lite v5.10 in Windows 32-bit. Flashing with J-Link Lite.

I had been following the nrf51822 devlopment kit User Guide v1.4 to try out my nrf6310 and nrf51822 module. I followed the instructions in the guide and got the ble_app_hrs example working. Then, I searched for something to try that would involve the ADC and s110. I found an example project (called "ble_app_hrs_with_adc_sample_ain") from Stefan at this page: devzone.nordicsemi.com/.../s110-soft-device-and-analog-inputs

I put this project in C:\Keilv5\ARM\Device\Nordic\nrf51822\Board\nrf6310\s110

After trying to build the project, I was getting these error:

Build target 'nrf51822_xxaa_s110 (256K)' compiling main.c... compiling ble_error_log.c... compiling ble_bondmngr.c... compiling pstorage.c... ..........\Source\app_common\pstorage.c(571): error: #20: identifier "PSTORAGE_SWAP_ADDR" is undefined retval = sd_flash_write((uint32_t *)(PSTORAGE_SWAP_ADDR), ..........\Source\app_common\pstorage.c(845): error: #20: identifier "PSTORAGE_SWAP_ADDR" is undefined retval = sd_flash_page_erase(PSTORAGE_SWAP_ADDR / PSTORAGE_FLASH_PAGE_SIZE); ..........\Source\app_common\pstorage.c(868): error: #20: identifier "PSTORAGE_SWAP_ADDR" is undefined BLOCK_COUNT_CHECK(p_module_param->block_count, p_module_param->block_size); ..........\Source\app_common\pstorage.c: 0 warnings, 3 errors "._build\ble_app_hrs.axf" - 3 Error(s), 0 Warning(s). Target not created


So I compared the two pstorage_platform.h files from ble_app_hrs and ble_app_hrs_with_adc_sample_ain. The only difference as far as I can tell, is that the h file for ble_app_hrs does define PSTORAGE_SWAP_ADDR and it doesn't for the adc example. So, I tried adding the line in question into the adc example h file. The project compiled successfully and the program now runs. However, no LEDs are lighting up, so the board is not advertising. I've stepped through the program to find that the problem is occuring in a call to pstorage_init() from bond_manager_init().

It seems to me that PSTORAGE_RAW_MODE_ENABLE is not defined, because I come to this line each time.

retval = sd_flash_page_erase(PSTORAGE_SWAP_ADDR / PSTORAGE_FLASH_PAGE_SIZE);

This isn't returning NRF_SUCCESS, so was I wrong to add in the definition of PSTORAGE_SWAP_ADDR in pstorage_platform.h?

I'm an absolute beginner, so ground-level answers would be appreciated.

Thanks very much for any help!

Parents Reply Children
No Data
Related