cancel
Showing results for 
Search instead for 
Did you mean: 

Wi-Fi Combo

LuisLop
New Contributor II

Hello, guys!

I am developing a project based on wifi connection for use mqtt and the use of UARTs Fast and low (stdio) for control and communication with other devices.

It's all running properly, but to make an enhacement on the control of FASTUART, I decided to use a timer (based on rtos) to managed timeouts when a reception starts and flush the ring buffer when a timeout is trigger before a full frame has been received on the fastuart.

With this addition, when I use the make target "kits.CYW954907AEVAL1F.MyProject-CYW954907AEVAL1F-FreeRTOS-LwIP-debug download" next information is  printed on console with the ERRORS:

Building Bootloader waf.bootloader-NoOS-NoNS-CYW954907AEVAL1F-P101-SoC.43909
Building Serial Flash Loader App
build/waf.sflash_write-NoOS-CYW954907AEVAL1F-P101-SoC.43909/libraries/Uart_43909_Library_CYW954907AEVAL1F.a(platform_uart.o): In function `Timer_Control_FASTUART_CallBack':
C:\WICED-Studio-6.6\43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/uart/platform_uart.c:2672: undefined reference to `wiced_rtos_stop_timer'
C:\WICED-Studio-6.6\43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/uart/platform_uart.c:2681: undefined reference to `wiced_rtos_deinit_timer'
build/waf.sflash_write-NoOS-CYW954907AEVAL1F-P101-SoC.43909/libraries/Uart_43909_Library_CYW954907AEVAL1F.a(platform_uart.o): In function `uart_seci_process_irq':
C:\WICED-Studio-6.6\43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/uart/platform_uart.c:2261: undefined reference to `wiced_rtos_stop_timer'
C:\WICED-Studio-6.6\43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/uart/platform_uart.c:2264: undefined reference to `wiced_rtos_deinit_timer'
C:\WICED-Studio-6.6\43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/uart/platform_uart.c:2288: undefined reference to `wiced_rtos_init_timer'
C:\WICED-Studio-6.6\43xxx_Wi-Fi/WICED/platform/MCU/BCM4390x/peripherals/uart/platform_uart.c:2290: undefined reference to `wiced_rtos_start_timer'
collect2.exe: error: ld returned 1 exit status
make.exe[3]: *** [build/waf.sflash_write-NoOS-CYW954907AEVAL1F-P101-SoC.43909/binary/waf.sflash_write-NoOS-CYW954907AEVAL1F-P101-SoC.43909.elf] Error 1
make.exe[2]: *** [main_app] Error 2
tools/makefiles/wiced_apps.mk:416: recipe for target 'sflash_write_app' failed
make.exe[1]: *** [sflash_write_app] Error 2
make.exe[1]: *** Waiting for unfinished jobs....

I use the timer on the file "platform_uart.c" and its functions are declared via #include "wiced_rtos.h".

The added code is:

//Variables:

#ifdef USE_TIMER_TO_CONTROL_FASTUART
wiced_timer_t Timer_Control_FASTUART;
const uint32_t Timeout_Control_FASTUART = 250;
static void Timer_Control_FASTUART_CallBack(void *arg);
#endif

//IRQ UART function to process the FAST UART

static wiced_bool_t uart_seci_process_irq( platform_uart_driver_t* driver, uart_seci_t* uart_seci_base )
{

if(driver->interface->port == UART_FAST)
{

....

#ifdef USE_TIMER_TO_CONTROL_FASTUART
if(driver->rx_buffer->tail == 0)
{


if(wiced_rtos_init_timer( &Timer_Control_FASTUART, Timeout_Control_FASTUART, (timer_handler_t)Timer_Control_FASTUART_CallBack, (void *)driver) == WICED_SUCCESS)
{


if(wiced_rtos_start_timer(&Timer_Control_FASTUART) == WICED_SUCCESS)
{

}


}


}
#endif

...

}

}

//Timer CALLBACK in case of timeout

#ifdef USE_TIMER_TO_CONTROL_FASTUART

static void Timer_Control_FASTUART_CallBack(void *arg){

platform_uart_driver_t* driver = arg;

//stop timer:
if(wiced_rtos_stop_timer(&Timer_Control_FASTUART) == WICED_SUCCESS)
{

//restart variables:
driver->rx_buffer->tail = 0;
driver->rx_buffer->head = 0;

length_frame_fastuart = 0;

//deinit timer
if(wiced_rtos_deinit_timer( &Timer_Control_FASTUART ) == WICED_SUCCESS)
{

}

}

}

#endif

Could it be a problem of use timers inside an IRQ function?

NOTE: When I use a Make Targe without downloading, the code compiles without any problem. "kits.CYW954907AEVAL1F.MyProject-CYW954907AEVAL1F-FreeRTOS-LwIP".

Many thanks in advance!

Luis

0 Likes
3 Replies
AditiB_81
Moderator
Moderator

Hi,

Is it possible to provide the code example that you're using in your setup?

Thanks

Aditi

0 Likes
LuisLop
New Contributor II

Hello, Aditib

Sorry for the delay, I was out of the office until today.

Please, see the attached file "platform_uart.c". It is the unique file where I have made the changes for the use of the timer. This file corresponds to hardware BCM4390x.

The #define USE_TIMER_TO_CONTROL_FASTUART is defined on "My_Defines.h", but for your testing, you can define where you want.

Many thanks, AditiB_81.

BR, 

Luis

 

0 Likes
AxLi_1746341
Honored Contributor

What's your finding in the example code?

0 Likes