Hi i am running an application with 5-6 thread and the device is working fine, in some case if the power failure happens and after some time if the power is supplied to device the expected execution is not happening.
My main function:
int main(void)
{
pthread_t thread = (pthread_t)NULL;
pthread_t gSpawn_thread = (pthread_t)NULL;
pthread_attr_t pAttrs, pAttrs_spawn;
struct sched_param priParam;
int retc;
int detachState;
/* Call board init functions */
Board_initGeneral();
/* Initializes the SPI interface to the Network Processor and peripheral SPI (if defined in the board file) */
InitTerm();
LOG_OUT("Uart Initialized\n");
SPI_init();
GPIO_init();
I2C_init();
ADC_init();
_WL_WATCHDOG_TIMER_INIT();
_WL_TIMER_INIT();
I2C_Initialization();
......
......
}
InitTerm is a function to set up usb log:
UART_Handle InitTerm(void)
{
UART_Params uartParams;
UART_init();
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_TEXT;
uartParams.readDataMode = UART_DATA_TEXT;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200;
uartHandle = UART_open(Board_UART0, &uartParams);
/* remove uart receive from LPDS dependency */
UART_control(uartHandle, UART_CMD_RXDISABLE, NULL);
return(uartHandle);
}
As soon as the Board_initGeneral() and InitTerm() is called i am printing the log and it is working fine and the application is also working fine, but at random instance when the power is reinserted the device won't print the log, it should be failing is one of the functions mentioned above. this issue i am not able to generate it happens randomly on power failure.
1. What may be the issue for this reason.
2. Does something is blocking from the main function to be called or any of the above function is blocking.
Regards,
Chiranth H D.