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

the uart examle doesn't work for all pins, for most pins i tried actually.

Hi.

I have nrf52840-dk board.
i tried the UART example from the peripherals directory. it works with the default, if i open a console on /dev/ttyACM0 and on /dev/ttyUSB0 i can see the "start" message and pressing a key echos it back. 
/dev/ttyUSB0 is a usb TTL i have that is connected to my laptop and to (at first) p0.06, p08.

problem started when i tried to change the pins to p0.9 and p0.10. i didn't change anything else, just the pins numbers.

BTW i tried the armgcc (make) and ses.

i see nothing not on ACM0 nor on USB0.

without debugging only running JLinkExe and halt i can see IPSR is 012, which is debug reserved flag, i guess it means the processor reached the error handler.

trying to debug indeed i reach the error handler from within the event handler of the uart, removing the calls to `APP_ERROR_HANDLER` allows the program to run but still not output on the USB0 port.

i tried ports i saw in other example i think it was p0.27' it wokred, but port 17,19,20,21 did not.

I don't get it, either you CAN use all ports that are not used to something else (i tried 00 and 01 but i understand they connect to the crystal...) or you can't how can it be that ii'm currently able to use only 4 pins ????
is there  a list of pins i can use ? and is that list relevant only for ntf52840-dk or to any device using nrf52840 chips ?
Do these pins also work for uarte ?


  • Did anyone tried to reproduce ? it's really easy, take the periphals\uart example and change the pin numbers to the ones i wrote and see it doesn'twork, unfortunately i don't have a logic analyzer to be sure nothing passes on the wire but i can see the TTL works and doesn't see any output or input. 

  • pin 9 and 10 are connected to NFC on the DK. If you need to use those pins as generic GPIO then you need to set CONFIG_NFCT_PINS_AS_GPIOS in your preprocessor defines.

    Please check the link here to understand more.

  • thanks you!
    that goes for 9 and 10, what about 21,20 ? 17, 19 ? which pins ARE free to use with the uart ?? it's hard to get a strait answer for that here in the forum.... in the PDK it doesn't state anything regarding 9,10. that's why i assumed they are free.
    where can i get a normal list of free pins ??

  • Please turn your DK around and there are markings for preallocated pins for few things. For UART you can see pins 05, 06, 07, 08  should be used.

  • you either misunderstand my question or contradicting other posts in the forum i'm affraid.
    Yes the official pins for rx\tx for uart0\uarte0 are 6 and 8, but it was stated that any other pin that does not have anothe usage (like xtel, nfc and the like) can be used. also the demo that uses both uart0 and uarte1 uses pins named ARDUINO_SCL and another ARDUINO_XXX pin meaning it is possibe.
    I was sure 9,10 were free, you explained that they were not, ok, even though it's NOT printed on the back of the DK board.
    So i'm asking which pins can be used for uarte0\1 without changing any configuration on the DK board, again there is an example that uses other pins, only those pins are free ? if so why is it stated that any other pin can be used ? several pins are marked on the back of the board as DIOs so if it uses as DIO can't i use it for the uart or do i need to setup something in the sdk_config to disable it as DIO as well ?

Related