Well, it is one of my explorations in NRF51822. I am working on a bare-metal UART demo, so far there are no output from TXD.
Configuration
- MDK5 + STLINK/V2, with optional OpenOCD in Windows/Linux
- nRF51822 breakout with pitch converter.
- c:\nRF5_SDK_12.3.0\examples\peripheral\blinky\pca10028\blank\arm5_no_packs\blinky_pca10028.uprojx
- c:\nRF5_SDK_12.3.0\examples\peripheral\uart\pca10028\blank\arm5_no_packs\uart_pca10028.uprojx
Since I found the silkscreen of converter is wrong, I used blinky demo to make sure the positions of P08/P09/P10/P11, which are used for RTS/TXD/CTS/RXD.
#define RX_PIN_NUMBER 11
#define TX_PIN_NUMBER 9
#define CTS_PIN_NUMBER 10
#define RTS_PIN_NUMBER 8
#define HWFC false
Actually HWFC is disabled, since I don't wanna blocked by accident or hardware issue.
And I load the uart demo code, slightly changed the main loop, since its localtest are depending on RXD for TXD. I just want to make sure the TXD work first.
while (true)
{
uint8_t res;
const char demo[] = "UUUUUUUUUU";
for(int i=0; i<10; i++){
res = app_uart_put(demo[i]);
}
}
The reason why I want to print out U, because U stands for 0x55, which is easy to identify on OSC to read out the baudrate.
However, there is nothing available from TXD, anyway.
I enabled Peripherals|UART in MDK debugger window. Then I noticed CONFIG = 0x00000001, which means HWFC is enabled.
Then I add a derivates as following:
#define RX_PIN_NUMBER 11
#define TX_PIN_NUMBER 9
#define CTS_PIN_NUMBER 10
#define RTS_PIN_NUMBER 8
#define HWFC false
#warning "HWFC is false"
Rebuild the source code, and HWFC is confirmed is false. But abviously, HWFC is enabled anyway.
Then I disable HWFC in CONFIG, OOPS, everything comes out from TXD !
OK, I can wire CTS/RTS to nRF, but it seems HWFC is enabled regardless the macro definitions anyway.