9 years, 5 months ago.

Export to Keil for nRF51822

My problem is probably is probably due to my lack of knowledge about the less obvious aspects (system-level stuff) of ARM programming and so any help offered would be grateful received:

  • My objective is to get an ADXL345 accelerometer to work on a nRF51822 using SPI.
  • I started by building the ADXL345 onto my LPC1768 MBED board. I downloaded a program ADXL345_Hello_World and everything worked beautifully. I added code for self calibration and offset correction and that Worked fine. I exported it to Keil (I have V4 and V5), changed the target device to nRF51822 and re-compiled. MUCH LATER I finally gave up trying to get it to compile and link. I also tried changing the target device in the on-line compiler and re-compiling before I exported it - just as bad.
  • Plan B: I downloaded and exported a SPI demo program for the RedBear Lab nRF51822 board. It compiled, linked and loaded into my nRF51822 Nordic Eval board (not their Mbed board). When I run it it never gets to main(), although it is executing code in low memory.
  • Why am I using this hardware? Because my project will ultimately have a S120 soft device (Bluetooth Central) which is already developed and is working; to which will be added the SPI code in order to access two other devices.

Maybe unrelated, but my Adafruit_SSD1306_Spi instance is enough to prevent my project reaching main() on a nRF51822 nano board (and it is running, but equally I failed to build anything in Keil and upload, do debug is looking unlikely)

posted by Sean Houlihane 22 Feb 2015

I now have a working system (ADXL345 on a nRF 51822 eval board). I exported the LPC51822 example into Keil and used it as a skeletal program. I then wrote my own device handler and ISR, changed the pin definitions and used the Nordic libraries instead of the MBED ones.

posted by Julian Cox 24 Feb 2015

1 Answer

9 years, 5 months ago.

Hello,

the export is valid for selected target. Means that if you export program for LPC1768 with mbed prebuild library, it won't compile with NORDIC target. It can be possible if you use mbed-src, but then settings in the project file (in your case uvision files) have preset values for the target, like macros, memory areas, use scatter files and so on.. Not trivial to change all that.

Export your program from the online IDE iwth the proper selected target.

Regards,
0xc0170

Thanks for the advice. I tried changing the target in MBED and then exporting - no good (see my original question).

posted by Julian Cox 17 Nov 2014