I have installed CMSIS_RTX on my Infineon XMC4800 microcontroller (ARM Cortex M4). I have also installed CycloneTCP Tcp/Ip stack on top of it and everything compiles fine. CycloneTCP is a free, opensource library which implements a lot of protocols.
However, when I try one of the examples comming with CycloneTCP for XMC4800, the system hangs when the tcp/ip stack is initialized at the very beginning of the code.
At some place, an OsEventCreate call is made which creates a semaphore. The semaphore is created successfully, but the call to osSemaphoreWait hangs.
bool_t osCreateEvent(OsEvent *event) { //Create a binary semaphore object event->id = osSemaphoreCreate(&semaphoreDef, 1); //Check whether the returned semaphore ID is valid if(event->id != NULL) { //Force the specified event to the nonsignaled state osSemaphoreWait(event->id, 0); ...
I am using the correct drivers for my PHY and for my Ethernet Interface.
Does someone know/have the same experience why the system hangs. It seems unlogical because the call to osSemaphoreWait should return immediately when the resource is locked.
I blocks on the instruction BLX R4 in SVC_User() function in HAL_CM4.S
I have little experience in RTOS, so any help is very welcome. I'm glad to hear it if more info is needed.
Hello Dimitri,
By upgrading Oryx-Embedded::Middleware software pack to version 1.7.6, you will find some ready-to-compile examples that demonstrate CycloneTCP + CMSIS-RTOS directly on the XMC4800 Relax Kit (HTTP server, MQTT client and SNMP agent).
If you consider CMSIS-RTOS2 (RTX v5) instead of CMSIS-RTOS, you can modify the project as follows:
- Open "Manage Run-Time Environment" - Unselect CycloneCommon::RTOS Port::CMSIS-RTOS component - Select CycloneCommon::RTOS Port::CMSIS-RTOS2 component - Unselect RTOS::Keil RTX component - Select RTOS2::Keil RTX5 component - Edit RTX configuration file (CMSIS -> RTX_Config.c) and change the default of OS_DYNAMIC_MEM_SIZE. A value of 30000 is OK to start with
Regards,
Thanks for the reply.
I managed already to get the CycloneTCP working with Keil. Indeed, it seemed that my stack and heap sizes were too small. I am still a newby on embedded software etc. So it took me a while to figure it out.
I works like a charm now :-)