Skip to main content
Visitor II
November 16, 2021
Question

How to integrate lwIP stack on stm32L0 series

  • November 16, 2021
  • 2 replies
  • 3480 views

Hi all,

I am working on stm32L0 controller that communicate with LAN9250 ethernet ic over SPI. Now i want to integrate lwIP stack in code to use the protocols. When checked in stmcube ide i did not see lwIP stack option in middleware in ioc configuration file.

Please guide me how can i integrate the stack in my code?any document for reference?

TIA,

Bipin

    This topic has been closed for replies.

    2 replies

    Visitor II
    November 16, 2021

    I don't think there is an LwIP port for STM32L0 because the Middlewares in the IOC generate low level MAC control code for chips with an ETH peripheral. You'll have to read https://www.nongnu.org/lwip/2_1_x/index.html and figure out yourself how to implement the low-level input/output functionality and timers. Good luck!

    BChav.1Author
    Visitor II
    November 17, 2021

    Hi,

    Yes right, there is no support for lwIP in middleware for stm32L0 series. Is there any reference example code for controller that does not have ETH and lwIP support in middleware but lwIP stack is integrated externally?

    That would be more helpful in my case as i am still not able figure out how i can map LwIP stack with my low level driver and use low_level_output() and low_level_input() api's.

    Thanks,

    Bipin .

    Visitor II
    November 17, 2021

    I'm definitely not an expert, but as I understand it, your low-level input and output functions must have a specific API and they have to be able to give new data to the stack or output new data from the stack to your PHY. I don't have examples other than maybe to create a project for a chip which does have an ETH peripheral (STM23F207 is the one I know) and then reading ST's low level IO code and try to understand what's going on there.

    From a certain level upwards the stack takes over, and you shouldn't need to change anything. You only have to provide a driver which can check for new data and read it from the LAN9250 and which can handle sending new data to the LAN9250 if your stack asks you to. You can probably steal ST's implementation of TCP timers as well, since it doesn't depend on the PHY.

    Again, good luck! I'm not saying it will be easy. It will depend on how much time you have. If it's a hobby project, you can play. If something needs to be delivered and you bargained on having LwIP available, maybe you should reconsider your options.

    BChav.1Author
    Visitor II
    November 26, 2021

    Hi,

    I did not attach the LAN9250.c and .h files in the project that's why the functions calls are commented there. Its purely SPI transactions .

    Visitor II
    November 26, 2021

    I do not see anything that jumps out as wrong then. I'd suggest you put a breakpoint in your udpClient_send() function and step into all functions it calls. Check if your netif->output points to your low level transmit function or not. If not, it is not initialized correctly.