Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 6 Forum Discussions

travisjayday
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

FreeRTOS and TCPWM blocks are not working together.

Steps to reproduce:

- Create the AnyCloud_TCP_Client example using the Modus Application creator dialog.

- Create a PWM block using the Device Configurator and call it PWM1 (I used Block 23, Pin10[2] but have tried others too).

- Before the xTaskCreate and vTaskStartScheduler in main(), start the PWM1 block with

 

 

 


    printf("============================================================\n");
    printf("CE229112 - AnyCloud Example: TCP Client\n");
    printf("============================================================\n\n")
    //////////////////////////////////////
    Cy_TCPWM_PWM_Init(PWM1_HW, PWM1_NUM, &PWM1_config);
    Cy_TCPWM_PWM_Enable(PWM1_HW, PWM1_NUM);
    Cy_TCPWM_TriggerReloadOrIndex(PWM1_HW, PWM1_MASK);
    Cy_TCPWM_TriggerStart(PWM1_HW, PWM1_MASK);
    CyDelay(1000);
    ///////////////////////////////////
    /* Create the tasks. */
    xTaskCreate(tcp_client_task, "Network task", TCP_CLIENT_TASK_STACK_SIZE, NULL, 
                TCP_CLIENT_TASK_PRIORITY, NULL);

    /* Start the FreeRTOS scheduler. */
    vTaskStartScheduler();

 

 

 

 

- Upload Code to PSoC6 PROTO 2MB

Result: Square wave appears for 1 second, then disappears.

Expected behavior: Square wave appears and stays forever.

 

I've also tried moving the PWM Init/Enable/Start code into the RTOS task (tcp_client_task) but doing that results in no square wave at all.

 

Why is FreeRTOS preventing TCPWM from working properly and how can I fix it? Thank you for you help.

0 Likes
1 Solution
Rakshith
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hi @travisjayday

I followed the steps that you have provided and I was not able to observe the fault. Can you please share the call stack when your application hits a fault? 
Also, please share the main.c and design.modus file of your application.

 You can also use this code example as a reference - PSoC 6 MCU: PWM Square Wave. The code example uses HAL APIs which removes the dependency on Device Configurator for PWM.

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
2 Replies
travisjayday
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Okay, when debugging, I see that it hits __WEAK void Cy_SysLib_ProcessingFault(void) at some point

0 Likes
Rakshith
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hi @travisjayday

I followed the steps that you have provided and I was not able to observe the fault. Can you please share the call stack when your application hits a fault? 
Also, please share the main.c and design.modus file of your application.

 You can also use this code example as a reference - PSoC 6 MCU: PWM Square Wave. The code example uses HAL APIs which removes the dependency on Device Configurator for PWM.

Thanks and Regards,
Rakshith M B
0 Likes