Hello,
I am working on a program using LwIP generated by the configuration tools in FreeRTOS mode.
Here is what I have done so far:
However, after that, I decided to add a network interface in LwIP using the MCU Config Tools. I included all the missing SDK components. After doing this, I encountered a FreeRTOS assert (Mutex Problem between tcip_thread and lwip_rx Tasks) without making any changes to my code.
Can anyone help me understand why this is happening and how to resolve it?
Hi @fabien251
I tried with your attched projects to reproduce and understand what the question is, but I was confused now. Let me clarify more about them.
1. I download and opened them with MCUXpresso, then remove the lwip/doc folder, the project can be compiled sucessfuly.
2. I flash the bianry into EVK1050 board, it seems workable, no any issues.
3. I trie to find what the meanings and where are the key codes, "However, after that, I decided to add a network interface in LwIP using the MCU Config Tools. I included all the missing SDK components. After doing this, I encountered a FreeRTOS assert (Mutex Problem between tcip_thread and lwip_rx Tasks) without making any changes to my code." But Only I can see was as below, would you please double check where is the user custom code as you descripted above.
int main(void)
{
/* Init board hardware. */
BOARD_ConfigMPU();
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();
BOARD_ENET_PHY_RESET;
/* Update the core clock */
SystemCoreClockUpdate();
vTaskStartScheduler();
/* Add user custom codes below */
while (1)
{
}
}
And would you please give me more details about the backgroud of your project, mostly there are some useful examples about lwip/tcpip in our SDK, I will give appropriate advice to you.
B.R, Sam
Hi @Sam_Gao,
Thank you for taking the time to look into my projects. Let me provide some additional details to help clarify the issue:
Initial Project Setup:
Adding LwIP:
Adding Network Interface:
Issue Encountered:
Steps Taken:
Current Main Code:
The main code in the LwIP blank project looks like this:
int main(void) { /* Init board hardware. */ BOARD_ConfigMPU(); BOARD_InitBootPins(); BOARD_InitBootClocks(); BOARD_InitBootPeripherals(); BOARD_ENET_PHY_RESET; /* Update the core clock */ SystemCoreClockUpdate(); vTaskStartScheduler(); /* Add user custom codes below */ while (1) { } }
This main function is essentially the default initialization code with FreeRTOS starting, and I have not added any custom user code yet.
Thank you for your assistance.
Fabien GALICIER
Hi @fabien251
Currently there are some issues about MCU Config Tools, I would like to recommend you to use workable SDK instead. And the issue of MCU config tools will be fixed in the following new version, but it may take long time.
Then for other feature, please continue using the MCU Config Tool if need, but please consider SDK if you still meet similar issues from MCU Config Tool.
B.R,
Sam
Hi @Sam_Gao ,
To fix this issue you need to exclude /lwip/doc folder of the project (another bug in MCUExpresso)
Best regards,
Fabien
Hi @fabien251
It seems something wrong with Mutex problem, the project build failed as below.
Would you please give me workable one so that I can support to reproduce it?
Thanks in advance.
./lwip/doc/NO_SYS_SampleCode.c:96:37: error: 'queue' undeclared (first use in this function)
96 | struct pbuf* p = queue_try_get(&queue);
| ^~~~~
../lwip/doc/NO_SYS_SampleCode.c:100:22: error: 'link' undeclared (first use in this function)
100 | LINK_STATS_INC(link.recv);
| ^~~~
../lwip/doc/NO_SYS_SampleCode.c:103:35: error: 'ifinoctets' undeclared (first use in this function)
103 | MIB2_STATS_NETIF_ADD(netif, ifinoctets, p->tot_len);
| ^~~~~~~~~~
../lwip/doc/NO_SYS_SampleCode.c:103:48: error: invalid use of undefined type 'struct pbuf'
103 | MIB2_STATS_NETIF_ADD(netif, ifinoctets, p->tot_len);
| ^~
../lwip/doc/NO_SYS_SampleCode.c:104:24: error: invalid use of undefined type 'struct pbuf'
104 | int unicast = ((p->payload[0] & 0x01) == 0);
| ^~
../lwip/doc/NO_SYS_SampleCode.c:106:37: error: 'ifinucastpkts' undeclared (first use in this function)
106 | MIB2_STATS_NETIF_INC(netif, ifinucastpkts);
| ^~~~~~~~~~~~~
../lwip/doc/NO_SYS_SampleCode.c:108:37: error: 'ifinnucastpkts' undeclared (first use in this function)
108 | MIB2_STATS_NETIF_INC(netif, ifinnucastpkts);
| ^~~~~~~~~~~~~~
../lwip/doc/NO_SYS_SampleCode.c:111:36: error: 'ERR_OK' undeclared (first use in this function)
111 | if(netif.input(p, &netif) != ERR_OK) {
| ^~~~~~
../lwip/doc/NO_SYS_SampleCode.c:117:5: warning: implicit declaration of function 'sys_check_timeouts' [-Wimplicit-function-declaration]
117 | sys_check_timeouts();
| ^~~~~~~~~~~~~~~~~~
make[1]: *** [lwip/doc/subdir.mk:23: lwip/doc/ZeroCopyRx.o] Error 1
Building file: ../freertos/freertos-kernel/queue.c
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [lwip/doc/subdir.mk:23: lwip/doc/NO_SYS_SampleCode.o] Error 1
B.R,
Sam