Hi,
I have a PAN1740 board. I would like to have a serial communication. I have read some answers from previous posts and I have followed all the steps to enable the UART .
However no success. I only see some gibberish on teraterm.
Here I am using ble_security project.
The steps I followed are:
1.#define CFG_PRINTF
2.在GPIO eservations功能:
#ifdef CFG_PRINTF_UART2
RESERVE_GPIO( UART2_TX, GPIO_PORT_0, GPIO_PIN_4, PID_UART2_TX);
RESERVE_GPIO( UART2_RX, GPIO_PORT_0, GPIO_PIN_5, PID_UART2_RX);
#endif
3. in set_pad_functions
#ifdef CFG_PRINTF_UART2
GPIO_ConfigurePin(GPIO_PORT_0, GPIO_PIN_4, OUTPUT, PID_UART2_TX, false);
GPIO_ConfigurePin(GPIO_PORT_0, GPIO_PIN_5, INPUT, PID_UART2_RX, false);
#endif
4. I have invokes the the arch_printf(). in user_security.c file
void user_app_connection(uint8_t connection_idx, struct gapc_connection_req_ind const *param)
{
if (app_env[connection_idx].conidx != GAP_INVALID_CONIDX)
{
arch_printf(" \r\n connected");
5. I have added app_console folder to the project and also added the path in the Options for target -> C/C++ tab .
Then I build the project and the on and off the debugger. I see some gibberisch data no serial data.
I have selected the 115200 baud rate also 8 bit data, no parity, no flow control and stop bits 1. I am not able to understand the problem.
Additionally I have also added:
6. in the periph_init function
SetBits16(CLK_PER_REG, UART2_ENABLE, 1); // enable clock for UART 1
SetWord16(UART_LCR_REG, 0x80); // set bit to access DLH and DLL register
// divisor = 1000000 / 115200 = 9
SetWord16(UART_IER_DLH_REG,(9&0xFF>>8));//set high byte
SetWord16(UART_RBR_THR_DLL_REG,9&0xFF);//set low byte
SetWord16(UART_LCR_REG,3); // no parity, 1 stop bit 8 data length and clear bit 8
SetBits16(UART_MCR_REG, UART_SIRE, 0); // mode 0 for normal , 1 for IRDA
SetWord16(UART_IIR_FCR_REG,1); // enable fifo
SetBits16(UART_IER_DLH_REG,ERBFI_dlh0,0); // IER access, disable interrupt for available data
still no change in the serial data.
Kindly suggest me the issue. Thank you.
Hi Gandhi,
In the ble_app_security project, the P05 is used for the SPI flash, so you need to change it. I worked on the Pro-DK and I changed the jumper configurations as follow:
Jumper on UTX on P04 - JL_RxD,and jumping wiring for JL_TxD on P02.
Which GPIOs of the DA14580 are mapped to FTDI? You need to change the definitions according to your custom board. In the Pro-DK and the modification I did, the P04 and P02 are mapped directly to FTDI in order to pinto into the serial monitor. The only modifications I did in the ble_app_peripheral example of the SDK are the following:
GPIO_ConfigurePin(UART2_TX_GPIO_PORT, UART2_TX_GPIO_PIN, OUTPUT, PID_UART2_TX, false );
GPIO_ConfigurePin(UART2_RX_GPIO_PORT, UART2_RX_GPIO_PIN, INPUT, PID_UART2_RX, false );
RESERVE_GPIO(UART2_TX, UART2_TX_GPIO_PORT, UART2_TX_GPIO_PIN, PID_UART2_TX);
RESERVE_GPIO(UART2_RX, UART2_RX_GPIO_PORT, UART2_RX_GPIO_PIN, PID_UART2_RX);
#define UART2_TX_GPIO_PORT GPIO_PORT_0
#define UART2_TX_GPIO_PIN GPIO_PIN_4
#define UART2_RX_GPIO_PORT GPIO_PORT_0
#define UART2_RX_GPIO_PIN GPIO_PIN_2
Thanks, PM_Dialog
Hi PM_Dialog,
It was working fine till yesterday. I was able to see the serial data as connected in the terminal.
Suddenly today It stopped working. I dont see any serial data on the terminal. I did not change any software or hardware. I am unable to figure out.
Hi Gandhi,
Could you please run your code in debug mode?
Thanks, PM_Dialog