2020-02-15 01:43 AM
Hi all,
I have used the Ethernet in my custom design board based on STM32H750VB and using STM32CubeIDE with the latest updates. It has an RMII connection to a PHY and I could successfully send UDP packets to the PC both with both polling and interrupt based methods. Unfortunately, I can't receive any packet from PC. Below are my observations:
Regarding above descriptions I don't know why no packet is received or why HAL_ETH_IsRxDataAvailable() function can't find any received message.
I have also some questions I don't know why the automatic generated code doesn't use or initialize Rx_Buff array? Isn't it needed for the polling or interrupt mode?
I would really appreciate any help on this issue.
Thanks in advance,
Hossein
2020-02-16 03:06 PM
Perhaps HAL_ETH_Start_IT hasn't been called.
Check out https://community.st.com/s/question/0D50X0000C6eNNSSQ2/bug-fixes-stm32h7-ethernet too.
2020-02-16 11:49 PM
Hi alister,
Thanks for your reply. At least someone is here to answer what ST have not done in their drivers!. That's a shame!. However, I have called HAL_ETH_Start_IT as well. I have also tried your mentioned changes in that post. Below are my main modifications:
/* Prevent "..\..\Core\Inc\stm32h7xx_hal_conf.h" from including stm32h7xx_hal_eth.h */
#define STM32H7xx_HAL_ETH_H
#include "..\..\Core\Inc\stm32h7xx_hal_conf.h"
/* Fix incorrectly-configured ETH macros */
#undef ETH_TX_DESC_CNT
#undef ETH_RX_DESC_CNT
#define ETH_TX_DESC_CNT 16
#define ETH_RX_DESC_CNT 16
/* Add not-yet-configured ETH macros */
#define ETH_PMT_IT_ENABLED 0
#define ETH_EEE_IT_ENABLED 0
#define ETH_EXTI_IT_ENABLED 0
/* Include stm32h7xx_hal_eth.h properly */
#undef STM32H7xx_HAL_ETH_H
#include "stm32h7xx_hal_eth.h"
Once again thanks for your help,
Hossein
2020-02-17 04:17 AM
Regarding the mentioned crash that happens in HAL_ETH_BuildRxDescriptors() inside _ETH_Start() function I noticed that this happens when running below line:
buff = heth->Init.RxBuffAlloc();
This is one of struct elements you added to ETH_InitTypeDef ! I could not find any definitions for this Callback function!. The same also for the other Callback functions like:
I took a look at the ethernetif.c and noticed they are working on RXPool or other similar variable you have defined. I am not going to use LWIP!. How can I use it?
Thanks,
Hossein
2020-02-17 04:17 PM
> I have called HAL_ETH_Start_IT as well
The original problem, "I can't receive any packet from PC", won't be fixed by any changes I've attached at https://community.st.com/s/question/0D50X0000C6eNNSSQ2/bug-fixes-stm32h7-ethernet. So this is still to be solved.
> I am not using D-Cache
It probably won't make enough difference to matter. But you can and you should.
> I am not using a middleware like FreeRTOS.
No matter how small you think your app will be, there are advantages to FreeRTOS: (1) more developers do than don't, so you'll find resources and help more easily, (2) it'll improve the way you organise your code, e.g. create one or more tasks per functional block, design/code them like they execute largely in isolation to do specific work, define inter-task APIs (often called IPC for inter-process-comms) early, e.g. queues between higher-layer app tasks, make your first task responsible for your app's modes and configuration etc, have it do your high-layer initialisation and create your other tasks, for comms, create one for init and receive and create one for transmit, have your interrupts notify their task when work is done or needs to be done, etc, etc, and finally (3) the STMH7 has ample performance/memory to support an OS, a well written OS app will perform almost as fast as bare-bones, but you should be able to write a richer app faster using an OS.
> I am not going to use LWIP!.
Reconsider that. And FreeRTOS and caching.
I've answered others of your items in https://community.st.com/s/question/0D50X0000C6eNNSSQ2/bug-fixes-stm32h7-ethernet.