Hi all,
After some hours I decided to start a new empty project with default configuration like this
1. New uVision project 2. STM32F107RC as CPU 3. Selected the next components: 3.1 RTX5 (library) then resolve 3.2 CMSIS driver -> Ethernet MAC and Ethenrnet PHY DP83848C then resolve 3.3 Network IPV4 release 3.4 Interface ETH0 set to 1 3.5 UDP sockets 4. Configure ethernet in RTE_Devices.h with RMII 5. Added a user code template CMSIS->KeilRTX5 'main' 6. Add the setStart function to main. Now main looks like this
/*---------------------------------------------------------------------------- * CMSIS-RTOS 'main' function template *---------------------------------------------------------------------------*/ #include "RTE_Components.h" #include CMSIS_device_header #include "cmsis_os2.h" #include <rl_net.h> #ifdef RTE_Compiler_EventRecorder #include "EventRecorder.h" #endif /*---------------------------------------------------------------------------- * Application main thread *---------------------------------------------------------------------------*/ void app_main (void *argument) { // ... for (;;) {} } int main (void) { // System Initialization SystemCoreClockUpdate(); #ifdef RTE_Compiler_EventRecorder // Initialize and start Event Recorder EventRecorderInitialize(EventRecordError, 1U); #endif // ... osKernelInitialize(); // Initialize CMSIS-RTOS netInitialize (); osThreadNew(app_main, NULL, NULL); // Create application main thread osKernelStart(); // Start thread execution for (;;) {} }
All the configurations are at default values. If I start the application in debug a HardFault exception is trowed, the fault log shows "INVSTATE" bit set. No matter where the 'netInitialize' is called, before or after any function or inside the thread, the exception is trowed. Also tried to change all stacks to sizes to the highest possible value and the exception is trowed. Also tried to use the event recorder and the network component to debug and all is ok, no errors found.
Thanks all
Forget about the MPU. I don't think you have to worry about this fct with STM32F1's...
Did you increase stack size in startup file? www.keil.com/.../nw_resource_requirements.html
If issue persists, try following the application note for faults: http://www.keil.com/appnotes/files/apnt209.pdf At the end, it tells you how to find an address that is connected to the fault. Setting a breakpoint there, and looking at the call stack may provide more clues.
The CMSIS driver is where these callback functions could be defined, rather than a middleware library. Otherwise, the user is responsible to define callback functions.
netInitialize() should be called after osKernelStart() (if the user chooses to explicitly call osKernelInitialize() and osKernelStart()), because it will start at least one new thread.
Hi,
I tried to solve the problem in my real application, not the example posted. My application mix CMSIS and initialization of peripherals with CubeMX, for any reason if I use microLIB the program runs ok but when use standard C Library the program crashes. Finally I rewrite the application only with CMSIS library without using code from CubeMXand works ok... I think there is a problem mixing CubeMX and CMSIS but the compiler don't show any warning or problem.
Thanks