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.
7 years ago.
How to properly do serial IO over pins P0.09 and P0.10 on the nRF52840-DK?
I tried this simple program:
#include "mbed.h" Serial pc(P0_9, P0_10); // tx, rx uint32_t counter=0; int main() { pc.baud (9600); while (true) { pc.printf("%d, Hello World!\n",counter++); } }
but it doesn't appear to send anything to pin P0.9.
Please advise.
1 Answer
7 years ago.
Hi David,
On the nRF52840_DK you will have to use P0_6 for transmit and P0_8 for receive as these were selected for the board layout. We just answered your previous question on using Port 1 pins and included this reference:
Here you'll see that RX_PIN_NUMBER and TX_PIN_NUMBER are defined. Pins 5 and 7 are used for serial flow control.
-Ralph, Team Mbed
Hi Ralph,
It looks as though if I made the change: TX_PIN_NUMBER = p32, it would have the desired effect of making pin P1_0 be the Tx pin for serial.
Is there a way for me to create such an alternate PinNames.h file and have the cloud-based mbed use it during the compilation (substituting for the default PinNames.h file), our would I need to use a different, non-cloud compiler with isolated files to do that?
posted by 18 Sep 2018
ok, pin's 9 and 10 are problematic because of NFC. So, consider the same question with pins 7 and 8. In that case, it doesn't appear to send anything to pin P0_7 either.
posted by David WhiteHare 17 Sep 2018