I am trying to generate PWM for IR transmission. In order to get this functionality, I am required to switch on the PWM for some x time and then switch off the pwm for again some y time. This sequence continues till all the IR codes are transmitted. I am facing a unique problem here. I am using :
- WICED_SDK version 3.1.2, Broadcom module (part no: BCM943362WCD4) used on Broadcom EVM (part no: BCM9WCD1EVAL1_P400),
- Using FreeRTOS+LWIP stack for generation of PWM using platform_PWM functions implemented in wiced sdk.
- Issue faced:
Test Code snippet where problem is observed.
onTime_inuS = AC_TMP_UP[loopCnt]*10; //AC_TMP_UP is an array with pronto codes
offTime_inuS = AC_TMP_UP[loopCnt+1]*10;
wiced_rtos_delay_microseconds(onTime_inuS); // there is no problem in //delaycalculation. it gets stuck here //upon reset.
wiced_rtos_delay_microseconds(offTime_inuS); // there is no problem in delay //calculation.
1. In the above code snippet, after the first time programming, the PWM start and stop works via wrappers : irTX_Start() & irTX_Stop() and does not get stuck in delay routine wiced_rtos_delay_microseconds for either start or stop cases.
2. However upon restarting the EVM board (power down and power up again) , the program gets stuck up in wiced_rtos_delay_microseconds(onTime_inuS) line.
3. Upon debugging Inside wiced_rtos_delay_microseconds(onTime_inuS), we find the code gets stuck inside a while(current_time < end_time) loop implemented in this wiced_rtos function. Since this while loop condition never becomes false upon a reset, the program is stuck on this delay function and is unable to proceed ahead. The only way to recover the system to normal is to reprogram/reflash and again it works fine till we again reset the EVM.
(while loop snippet):
while ( current_time < end_time )
current_time = host_platform_get_cycle_count( );
Any help here or if anyone has encountered such a situation and has found a fix or workaround please share.