cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX: Possible bugs in ethernet configuration

crt
Associate II
Posted on July 30, 2014 at 10:30

Hi,

In the last few days I have spend few hours trying to setup FreeRTOS + LwIP TCP/IP stack. Now it is finally working (UDP echo, ICMP ping), but I believe there might be some bugs in STM32CubeMX.

- Interrupt priority for ETH_IRQn is left at default priority which is too low. This causes FreeRTOS hanging at assert. (see

http://www.freertos.org/RTOS-Cortex-M3-M4.html

).

- Some (important) settings for STM32CubeMX for LwIP don't get transferred into lwiopts.h. This means that default values (which are often 0) are used.

I did manually set:

&sharpdefine TCPIP_THREAD_STACKSIZE          1000

&sharpdefine TCPIP_MBOX_SIZE                 5

&sharpdefine DEFAULT_UDP_RECVMBOX_SIZE       2000

&sharpdefine DEFAULT_TCP_RECVMBOX_SIZE       2000

&sharpdefine DEFAULT_ACCEPTMBOX_SIZE         2000

&sharpdefine DEFAULT_THREAD_STACKSIZE        500

&sharpdefine TCPIP_THREAD_PRIO               (configMAX_PRIORITIES - 2)

in addition CHECKSUM_BY_HARDWARE didn't get transferred into lwiopts.h so checksums were invalid. The solution was to add the following defines to lwiops.h.

&sharpdefine CHECKSUM_GEN_IP                 0

&sharpdefine CHECKSUM_GEN_UDP                0

&sharpdefine CHECKSUM_GEN_TCP                0

&sharpdefine CHECKSUM_CHECK_IP               0

&sharpdefine CHECKSUM_CHECK_UDP              0

&sharpdefine CHECKSUM_CHECK_TCP              0

&sharpdefine CHECKSUM_GEN_ICMP               0

With this configuration I have tested UDP echo, pinging and ARP protocol and for now they work. However, I would be nice if authors of STM32CubeMX could check this issue and make sure all set parameters get converted into source code.

Thanks, Crt

#stm32cubemx-ethernet
3 REPLIES 3
Bino
Senior
Posted on August 18, 2014 at 11:12

Hello,

Thanks for this contructive feedback.

Regarding the ETH_IRQn default priority setting, we are investigating to change this asap.

Regarding the manual settings you mentionned for LwIP:

- TCPIP_THREAD_STACKSIZE, TCPIP_MBOX_SIZE, DEFAULT_UDP_RECVMBOX_SIZE, DEFAULT_TCP_RECVMBOX_SIZE and DEFAULT_ACCEPTMBOX_SIZE can be set through the LwIP Configuration GUI in ''All LwIP Options / Thread Options'' with the values you manually set so that they will appear correctly set in lwipopts.h

- TCPIP_THREAD_PRIO can be set also through the LwIP Configuration GUI in ''All LwIP Options / Thread Options'' but not using a variable like configMAX_PRIORITIES. The right way to do it using a variable like configMAX_PRIORITIES is to set it manually in lwipopts.h in a USER CODE section so that this will be kept at each code generation

- CHECKSUM_GEN_IP, CHECKSUM_GEN_UDP, CHECKSUM_GEN_TCP, CHECKSUM_CHECK_IP, CHECKSUM_CHECK_UDP, CHECKSUM_CHECK_TCP, CHECKSUM_GEN_ICMP are also configurable through the LwIP Configuration GUI in ''All LwIP Options / ChecksumOptions'', so that you can set it to Disabled and this will be set automatically in the lwipopts.h after a code generation.

You're right, for the moment, automatic setting of all CHECKSUM parameters could be a bit improved, this improvement will be considered.

I hope this answer to your feedback.

Best Regards,

/Eric

stm32cube-t
Senior III
Posted on November 03, 2014 at 11:18

Dear user,

The default value issue you raised has now been solved in the latest STM32CubeMX 4.4 release.

Best Regards

antonius
Senior
Posted on July 25, 2015 at 14:48

May I know how to set it ? I'm using STM32F107 and DP83848