Part Number: CC2340R5
Hello,
I'm using CC2340R5 simplelink_lowpower_f3_sdk_7_40_00_64 example code basic_ble.
I'm making connection with Apk using peripheral mode. Whenever Apk sends any request to BLE, on that request I need to respond by writing the same request to my controller which is connected to BLE's UART.
Controller then sends a response to the same request.
Currently, I'm able to send the request to controller through UART_2, but I'm not able to read the response sent on the UART_2.
Below is my code of UART configurations:
1)This is the thread I've created where UART initializes. (I took the reference from example code uart2callback given in resource explorer.)
void mainThread()
{
char input;
const char echoPrompt[] = "Echoing characters:\r\n";
UART2_Params uartParams;
int32_t semStatus;
uint32_t status = UART2_STATUS_SUCCESS;
uint8_t tempbuf[64] = {0};
/* Create semaphore */
// semStatus = sem_init(&sem, 0, 0);
// if (semStatus != 0)
// {
// /* Error creating semaphore */
// // while (1) {}
// }
/* Create a UART in CALLBACK read mode */
UART2_Params_init(&uartParams);
uartParams.readMode = UART2_Mode_CALLBACK;
uartParams.readCallback = callbackFxn;
uartParams.baudRate = 115200;
uart_handle = UART2_open(CONFIG_DISPLAY_UART, &uartParams);
}
2)This is the callback function. Doing nothing here.
void callbackFxn(UART2_Handle handle, void *buffer, size_t count, void *userArg, int_fast16_t status)
{
if (status != UART2_STATUS_SUCCESS)
{
/* RX error occured in UART2_read() */
// while (1) {}
}
numBytesRead = count;
// sem_post(&sem);
}
3)uart_handle is taken global. Calling these two functions where I get the request from apk.
UART2_write(uart_handle, newValue, len, NULL);
UART2_read(uart_handle, newValue, sizeof(newValue), NULL);
Here, uart write works properly. I get the exact data on UART but when reading I'm not getting any data.
I've disabled the function Menu_start();
Am I missing something here?
Regards,
Rushikesh.