Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 1 month ago.
How do I modify the mbed target-specific library code (to remap some pins)?
Hi all,
I'm trying to remap certain PinNames to different pins on the nRF51822-mkit platform. I've converted the mbed imported library in the online IDE, which gave me a lot of header files for all targets. I found the "PinNames.h" file for the nordic platform, and modified it to remap the pins (specifically, SPI1 is remapped from pins 12-15 (default) to pin 1-4 (on my hardware).
It compiles fine, but doesn't run on the hardware. I get two blinking LEDs indicating a failure.
It seems the header files aren't being included in the compilation. I also cannot find any .c/.cpp implementation files in the mbed library.
Does anyone know how to remap the pins? Any pointers would be much appreciated. Thanks.
2 Answers
10 years, 1 month ago.
If you want to change the source files you should look at the mbed-src library: http://developer.mbed.org/users/mbed_official/code/mbed-src/. Pinout file is in Targets/Hal/Target_Nordic/Target_nrf/[board]
I may be wrong here but I think he has done that Erik, I don't think he can remap peripherals to 'illegal' physical pins. But I don't have the peripheral pin out configuration tables.
posted by 17 Nov 2014Wonderful. Thanks Erik, this is exactly what I was looking for. I imported mbed-src in place of mbed in my project and am able to recompile with my modified sources.
Now to see if just changing PinNames.h solves my problem..!
EDIT: can verify just changing the mapping in PinNames.h file seems to be working. No blinking LEDs anymore and my hardware is up and running.
posted by 17 Nov 201410 years, 1 month ago.
I do not have this platform, however Nordic should have a peripheral pin out alternative chart similar to other platforms on Mbed. Generally not all peripheral functions are accessible on every pin combination. Perhaps there are no alternatives available at all for this platform so you may have to change your hardware connections to suit the default pins specified. Best bet is to contact Nordic for confirmation.
Thanks for the response. I do have the pinout, but the problem is that on my hardware the SPI pins are routed to different pins than what the mbed pinout says. I've contacted the mbed developers and they've told me that the SPI implementation made the assumption that only those pins can be used. In reality Nordic chip can be configured to use any pin combination. Mbed developers confirmed that the spi implementation will need to be rewritten to support that.
In the meantime I'm trying to do this myself as I'm running out of time on this project. Perhaps I will try using the nordic native SDK within mbed.
posted by 17 Nov 2014