Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defines HAL_ETH_STATE_BUSY and HAL_ETH_STATE_STARTED have the same value (0x23) breaking gState checks #69

Open
KarstenHohmeier opened this issue Sep 8, 2024 · 1 comment
Assignees
Labels
bug Something isn't working eth Ethernet-related issue or pull-request hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system

Comments

@KarstenHohmeier
Copy link

Looking at HAL_ETH I noticed that these defines for the HAL_ETH global state (gState) have the same value (0x23):

#define HAL_ETH_STATE_RESET 0x00000000U /*!< Peripheral not yet Initialized or disabled */
#define HAL_ETH_STATE_READY 0x00000010U /*!< Peripheral Communication started */
#define HAL_ETH_STATE_BUSY 0x00000023U /*!< an internal process is ongoing */
#define HAL_ETH_STATE_STARTED 0x00000023U /*!< an internal process is started */
#define HAL_ETH_STATE_ERROR 0x000000E0U /*!< Error State */

This breaks these checks:

HAL_StatusTypeDef HAL_ETH_Start(ETH_HandleTypeDef *heth)
{
if (heth->gState == HAL_ETH_STATE_READY)
{
heth->gState = HAL_ETH_STATE_BUSY;

Also the comments associated with these values are wrong/misleading. Maybe you can improve on these a little.
Here is how I understand the values after looking at how they are used in the code:

  • HAL_ETH_STATE_RESET means: heth private data is not initialized at all, please call HAL_ETH_Init()
  • HAL_ETH_STATE_READY means: you can register callbacks now, but to start the actual hardware and the interrupts please call HAL_ETH_Start() or HAL_ETH_Start_IT()
  • HAL_ETH_STATE_STARTED means: heth is running and ready for RX and TX operations
  • HAL_ETH_STATE_BUSY means: heth is currently doing something 'critical' that should not be done concurrently, because it would mess up the internal state of heth or the hardware
  • HAL_ETH_STATE_ERROR means: heth encountered an error that needs external handling; see HAL_ETH_ErrorCallback() and HAL_ETH_DeInit()
@ASEHSTM
Copy link
Contributor

ASEHSTM commented Sep 13, 2024

Hello @KarstenHohmeier,

Thank you for your detailed report. I have reported this issue internally.
ST Internal Reference: 191045

With Regards,

@ASEHSTM ASEHSTM added the internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working eth Ethernet-related issue or pull-request hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system
Projects
Development

No branches or pull requests

3 participants