UART pin assignment -what determines the default?

themzlab
Posts: 4
Joined: Mon Mar 14, 2016 12:39 am

UART pin assignment -what determines the default?

Postby themzlab » Sat Apr 23, 2016 3:46 pm

in the oshchip pin assignments page:

http://oshchip.org/docs/OSHChip_Pin_Assignments.html

it is stated:

By default, the UART is assigned to OSHChip pins 1 and 2, but you can re-assign
the UART to other pins, or disable it and it will then not use any pins


What causes this default? Is it intrinsic to the Nordic hardware? or the Nordic development kit? or the OSCHip reference documents?

I am nearing the end of a board layout and just realized for my board the 'default' UART pins are in almost the worst possible place and I want to re-assign them. this is one of the great things about the nRF51 chip - but I wonder how much work I'll have to get the uart assignment set up or moved and if there is any significant down-side.

User avatar
Philip
Posts: 12
Joined: Sun Jan 24, 2016 9:02 am

Re: UART pin assignment -what determines the default?

Postby Philip » Mon Apr 25, 2016 5:30 pm

Sorry for the confusing documentation. I will deal with cleaning it up in my next update, hopefully later this week. (it will draw on this posting)

On the page you reference, the defaults being discussed are the pins I plan to use in my examples, and also in the mbed environment.

My current support for OSHChip over in the mbed environment, includes a trivial function to re-assign the UART TX/RX pin assignments that Nordic's nRF51-DK board uses. These are assigned to the UART in the mbed library for this board, as part of the startup code that mbed runs prior to entering main() , and are not compatible with OSHChip.

It is discussed here: https://github.com/OSHChip/OSHChip_Related_Files/tree/master/Getting_Started_Files/Getting_Started_With_mbed

Outside of the mbed (for nRF51-DK board), the UART can use any of the I/O pins, and you can use as few as 1 (i.e. just TX), up to all 4 if you want to use hardware flow control.

In non-mbed environments, the UART setup is your responsibility. Until I write an OSHChip specific version, please refer to Nordic's SDK.

I have updated the github repository. Please look here for some useful (I hope) files.
https://github.com/OSHChip/OSHChip_Related_Files/tree/master/Getting_Started_Files

* OSHChip_Pin_Names.h
* OSHChip_Blinky.cpp
* OSHChip_Init.c

I am nearing the end of a board layout and just realized for my board the 'default' UART pins are in almost the worst possible place and I want to re-assign them. this is one of the great things about the nRF51 chip - but I wonder how much work I'll have to get the uart assignment set up or moved and if there is any significant down-side.


So in summary, use any I/O pins you want for the UART for your board. The only I/O pins with special functions are the pins that serve the analog peripherals, and if you use those peripherals, they must use those pins. If you aren't using the analog peripherals, then you can use those /O pins for the UART if you wish. Moving the assignments is trivial, as shown in my example code.


Return to “UART”

Who is online

Users browsing this forum: No registered users and 1 guest