cancel
Showing results for 
Search instead for 
Did you mean: 

Can't Receive Ethernet packets in STM32H750VB

HMora.1
Associate II

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:

  1. I am sure that PC is sending UDP broadcast packets because I see them on the Wireshark!.
  2. I have also seen that RXD[1:0] and CRS_DV signals are toggling and connected to the Microcontroller. hence there is not any problem with the PHY chip (LAN8742A).
  3. I have also configured the filters to pass all broadcast messages and every other filter settings to make sure that nothing is filtered in any layer.
  4. When I connect cable and immediately after initialization I see that MTLQICSR register changes to a state that shows receive overflow in MTL buffer happened and also MTLRQDR register shows that RX Queue is half or Full!. This happens even if I activate filters of MAC!. This is kind a strange because when all filters are nabled MAC should only pass specific packets to MTL!. while I am not sending any packets.

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

4 REPLIES 4
alister
Lead

Perhaps HAL_ETH_Start_IT hasn't been called.

Check out https://community.st.com/s/question/0D50X0000C6eNNSSQ2/bug-fixes-stm32h7-ethernet too.

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:

  1. I have replaced two files completely from your modified ones(stm32h7xx_hal_eth.c & stm32h7xx_hal_eth.h).
  2. I am not using D-Cache.
  3. I am not using a middleware like FreeRTOS, it is a simple standalone project none of polling or interrupt modes are receiving. but, I do not have problem in TX side.
  4. Once I tried to configure MPU for the start address of Ethernet - 0x30040000 - and tried to protect 32KB which covers all RX/TX buffers. It did not work. Then I replaced your MPU configuration that I don't know why you have used two regions starting from 0x30040000!. - can't realize differences between these two regions. After these modifications now I see that HArdFault_Handler() happens immediately in the _ETH_Start() function that you have added HAL_ETH_BuildRxDescriptors() at the beginning of that.
  5. I have to also add that I don't know where in stm32h7xx_hal_conf.h file I have to add those new defines and include statements:

/* 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

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:

  • RxBuffFree
  • RxPktAssemble
  • RxPktDiscard

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

> 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.