STM32Cube F4 dev: Networking w/ CMSIS-RTOS v2/LwIP or Azure ThreadX/NetX? - Page 1
Forum section: electronics / general

author: globoy
author_rank: Frequent Contributor
timestamp: February 01, 2024, 08:04:21 pm
content: I am embarking upon my first STM32 embedded system design. The software choices are, well, a lot... I have been playing with both uVision and STM32CubeIDE based projects as a learning exercise using a Nucleo-F439ZI because the product will have an ethernet interface. It will use a RTOS because there is a lot going on and it has to support multiple network protocols (e.g. Modbus TCP, telnet, etc) so there will be a lot of threads (tasks).I started with a uVision project using STM32CubeMX to only configure the GPIO ports and provide some init code. I have been unable to get LwIP up and running. There's some disconnect between the library and the hardware drivers (I think some task that is supposed to be automatically started isn't running although the tcpip_thread is running - something hidden in the magic of the run-time tool configured library components that I can't find).So I switched to a pure STM32CubeIDE based project and had success. I have the LwIP stack up. I'm running the CMSIS-RTOS v2 API on top of FreeRTOS. Mostly because I have a lot of experience with FreeRTOS. I have no experience with LwIP.I also see that ST Microelectronics has partnered with Microsoft and offers an integration of their ThreadX/NetX package within the STMCube32 environment.Of course I did a lot of internet searches as I got all this code running and I read a lot of horror stories about LwIP. Especially when trying to use it for more complicated systems that might have more than one networking protocol running in different threads. Including a topic on the ST community forum talking about how horribly broken networking was in their various libraries.It makes me wonder if I should bite the bullet now (before I've written too much code) and move over to ThreadX/NetX. I don't know about NetX but I know ThreadX is a mature product that's been used for a lot of embedded systems.It's always hard to know how much of what one reads online to believe. So I'm just seeing if anyone here has any experience with these software stacks and their reliability. This is an actual development effort, not just a hobby project.Thanks in advance.

author: globoy
author_rank: Frequent Contributor
timestamp: February 13, 2024, 07:21:31 pm
content: This is just FYI for some future searcher.I read through all peter-h's posts here about his experience with STM32/LWIP. They made me nervous to take that approach since LWIP is so complex and not well suported. I decided to try ThreadX with NetXduo since it has been licensed by ST for their devices, has active support and a long history. It took a second to grok ThreadX's approach to memory management and NetXDuo's API but I have successfully ported my project over. At the moment it comprises a bunch of peripherals accessed via I2C, SPI and UART controlled by 8 threads with two TCP ports for telnet and Modbus TCP.Porting the original STM32 code, adding telnet and Modbus, and getting it up and running was really straight forward and about a week and half for the whole application as it stands now. I ended up using the BSD sockets add-on for Modbus TCP which seems to play nicely with direct use of NetXDuo too. The one time I had to go searching for why something wouldn't compile I found a thread on Microsoft's support forum where an employee had already answered the question so that was nice. ThreadX seems like a good RTOS with reasonable features. I'd recommend it.

author: tellurium
author_rank: Frequent Contributor
timestamp: February 14, 2024, 11:24:11 pm
content: I have quite an experience with lwIP, and very limited with NetX.However I work for a company that develops an alternative solution, so if you're up for an alternative, take a look here:https://mongoose.ws/demo/?clear=1By my most biased opinion, it beats both lwIP and NetX big time.