[Distributed temperature and humidity acquisition system] + STM32H745I-LWIP program
[Copy link]
This post was last edited by lansebuluo on 2022-7-13 12:29
I searched online for the LWIP routines of STM32H745I-DISCO, but I couldn't find any. I heard that LWIP can be generated using CubeMx. Although I have some resistance to this kind of automatic code generation tool, there is no better way to find network routines, so I might as well give it a try. After installing CubeMx, I created a new project with great expectations. I didn't expect that I could directly select STM32H745I-DISCO to generate the driver, which saved a lot of time configuring pins, peripherals and other functions.
After searching the tutorial on how to generate LWIP from CubeMx on the Internet, configuring ETH, LWIP, MPU, LAN8742, etc., following the steps to generate the code, and finally downloading it to the development board, the program can run, but for some reason it cannot be pinged. By capturing the messages on the network, it was found that after the program was initialized, only one ARP request frame was sent. The messages on the network could not be received.
I tried to read the driver register of LAN8742, and found no problem in identification and setting. The development board uses LAN8740, and the registers and configurations are basically the same, so the problem should not be here. By using the LOOPBACK mode inside the LAN8740 chip, I found that I still could not receive data.
At this point, I began to suspect that the generated code driver configuration might not be correct. I couldn't doubt CubeMx. No matter how smart the software is, it still needs the correct configuration items. This has already consumed several nights. I can't continue to adjust it like this. I have to speed up the process.
Change your thinking and find the LWIP routine closest to the development board STM32H745I-DISCO in STM32Cube_FW_H7_V1.10.0 for porting. There are LWIP examples in STM32H743I-EVAL.
Copy the LWIP routine folder under the STM32H743I-EVAL development board to a similar location in the STM32H745I-DISCO directory, select a project, and what you need here may be LwIP_TCP_Echo_Server. Open the project with IAR, and then change the device, the stm32h745xx.h file included in the project, the power supply mode PWR_DIRECT_SMPS_SUPPLY, etc., change the RMII interface to MII, and replace the ETH pin configuration in the CubeMx generated project with the routine.
After preparation, the project was compiled and downloaded, pinged, the PC established a TCP client, the connection was successful, data was sent, and the same data was received, and LWIP ran successfully.
This is basically a debugging process for LWIP, record it, and more importantly upload the code.
LwIP.rar
(5.26 MB, downloads: 7)
|