Skip to main content
Graduate
November 5, 2024
Solved

SNK1M1 board project with azure threadX not working

  • November 5, 2024
  • 5 replies
  • 6871 views

hello!

i'm trying to make a project with the board SNK1M1 coupled with the NUCLEO-G071RB using azure ThreadX instead of FreeRTOS.

i'm able to replicate the example provided here:

https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Getting_started_with_USB-Power_Delivery_Sink#Configure_UCPD_monitor_firmware_responder_for_debug

or the video on youtube:

https://www.youtube.com/watch?v=cbdFHmMOMwk

and all work fine like in the video

BUT

if i change the Rtos with azure ThreadX nothing work anymore!

the code is compiled without problem, it seems to run (no hardfault error) but i can't find the board in the cube monitor UCPD

 

there is some additional step to use azure threadX instead FreeRTOS?

there is a tutorial of how to use with threadX?

 

thank you in advance!

 

 

 

    This topic has been closed for replies.
    Best answer by HFISTM

    Ok, I understand your question now. In fact, 12V is out of spec. See this extract from PD 3.1 spec:

    HFISTM_0-1733474543474.png

    That is why you cant select 12V from CubeMX. But anyway you can still put 12V in the usbpd_pdo_defs.h file "by hand" if you want, it will not be in line with the spec, but I will most likely work.

    Regards

    5 replies

    Technical Moderator
    November 5, 2024

    Hi @ABasi.2 

    I suggest you refer to this example to create a thread and tonsure that all necessary ThreadX components are included. Check memory management generation for UCPD in app_azure_rtos.c. If still having issues, don't hesitate to share your project via Github link.

     

    ABasi.2Author
    Graduate
    November 6, 2024

    hello FBL

     

    i see your example, but i think is a gerneric example about threadX, not a specific example about UCPD with threadX

    i cheked the memory menagement generationin app_azure_rtos.c and i think its ok

     

    from app_azure_rtos.c and app_azure_rtos_config.h we have

    #define USBPD_APP_MEM_POOL_SIZE 6144
    
    static UCHAR usbpd_byte_pool_buffer[USBPD_APP_MEM_POOL_SIZE];
    static TX_BYTE_POOL usbpd_app_byte_pool;
    
    tx_byte_pool_create(&usbpd_app_byte_pool, "USBPD App memory pool", usbpd_byte_pool_buffer, USBPD_APP_MEM_POOL_SIZE)

     

    the fact is that i have a perfectly functioning project with FreeRtos, i swap Rtos via Cube MX and noting work anymore

     

    i have also tried of course to make a new fresh project with threadX but same result.. nothing work

     

    ST have a functioning example of  SNK1M1 board  using threadX? like the example provided with freeRtos

     

    thank you

     

    ST Employee
    November 6, 2024

    Hello @ABasi.2 

    Have a look at all published examples on the USBPD wiki here.

    You will see that STM32H5 and STM32U5 have ThreadX USB and power delivery examples.

    Regards,

    Nicolas.

     

    (Edit : link corrected)

    ABasi.2Author
    Graduate
    November 6, 2024

    Hello Nicolas

     

    thank you for your answer

    but the link point to this page, if i click on the link a duplicate of this page is opened

     

    thank you

    ST Employee
    November 6, 2024

    Hello @ABasi.2 

    You are right, link was wrong. I corrected: Wiki.

    Direct link to sink application with Threadx here.

    Regards,

    Nicolas

    Technical Moderator
    November 6, 2024

    Hi @ABasi.2 

    Unfortunately, we don't provide direct example for your case!

    Did you check USBPD_THREADX symbol to enable in ThreadX support for CubeMonitor API?

    FBL_0-1730886959161.png

     

    ABasi.2Author
    Graduate
    November 6, 2024

    hello FBL

     

    actually no!

     

    but i'mconfused, where is the page you are showing to me?

     

    is in cube ide or cube monitor ucpd?

     

    thank you

     

     

     

    Technical Moderator
    November 6, 2024

    Hi @ABasi.2 

    USBPD_THREADX can be added as predefined symbol to be used by Cube Monitor UCPD to integrate code that is specific to the ThreadX. Then, using _TRACE and _GUI_INTERFACE, traces in UCPD monitor can be accessed.

    ST Employee
    November 6, 2024

    Hello @ABasi.2 

    Can you check quickly how much you have for TX_TIMER_TICKS_PER_SECOND in your tx_user.h ?

    You should have :  #define TX_TIMER_TICKS_PER_SECOND                1000

    (Similar example on H5 here)

    Do you see the systick counter updates ?

    Check this wiki : is USBPD_DPM_TimerCounter(); called ?

    Regards,

    Nicolas

    ABasi.2Author
    Graduate
    November 6, 2024

    hello @Nicolas P. 

    i have 100 !

     

    is this the problem?

    i have searched the 

    USBPD_DPM_TimerCounter()

     

    is defined in usbpd_dpm_core.h but is never called in the code!

     

    where have to be called?

     it is supposed to be called frome "cubemx code" or by the user?

     

    also can you clarify to me where is the  USBPD_THREADX symbol enabled? i didn't recognize the page posted by FBL

     

    thank you!

     

     

    ST Employee
    November 11, 2024

    @ABasi.2 

    Are you able to see the tick counter increase ?

    Where do you stand when you break ?

    Are you able to see some trace when you follow this wiki, just by selecting COM port?

    Regards,

    Nicolas

    ABasi.2Author
    Graduate
    November 11, 2024

    hello @Nicolas P. 

    if i put a break point on the HAL_IncTick();  or USBPD_DPM_TimerCounter(); its breaking continously so i assume the tick is going.

     

    i i break the code is always breaking in the _tx_thread_system_return(); in the file tx_thread_system_suspend

    there is no trace on the cube monitor ucpd.

    i don't have another thread created by me,

     

    i have slavishly  followed the ST tutorial on youtube:

    https://www.youtube.com/watch?v=cbdFHmMOMwk&t

     

    but i have selected azure threadX for operating system

    and also:

    1) make the tick  per second 1000

    2) make the timebase source TIM6

    3) added  

    if (htim->Instance == TIM6) {
    	 USBPD_DPM_TimerCounter();
    	 #if defined(_GUI_INTERFACE)
    	 GUI_TimerCounter();
    	 #endif
     }

    to the HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)

    maybe there is some modification to enable the UCPD thread? is not automatic started?

     

    thank you