SiliconLabs / wfx-fullMAC-driver

Silicon Laboratories WFx Wi-Fi Full-MAC driver
23 stars 9 forks source link

Little endian driver issue with STM32L4 #7

Closed FabianNiehaus89 closed 3 years ago

FabianNiehaus89 commented 3 years ago

For the controller STM32L4, configured as little endian system, I have to comment the follwoing line to reache propper functionality:

File: sl_wfx.c line 1721:
//network_rx_buffer->header.length = sl_wfx_htole16(network_rx_buffer->header.length);

After removing this line, driver works as espected.

silabs-JulienT commented 3 years ago

Hi Fabian,

Thanks for your report. It is strange. Is BIG_ENDIAN defined in your project? https://github.com/SiliconLabs/wfx-fullMAC-driver/blob/master/wfx_fmac_driver/sl_wfx_constants.h#L146 In this definition above, in little endian, sl_wfx_htole16 is "identity" and commenting the line shouldn't be necessary.

Regards, Julien

FabianNiehaus89 commented 3 years ago

Hi Julien,

i found out that in endian.h both define exists:

#if __BSD_VISIBLE

#define LITTLE_ENDIAN   _LITTLE_ENDIAN

#define BIG_ENDIAN  _BIG_ENDIAN

#define PDP_ENDIAN  _PDP_ENDIAN

#define BYTE_ORDER  _BYTE_ORDER

#endif

so problem is solved but maybe there should be used a other define?

silabs-JulienT commented 3 years ago

Agreed, we will make the define name explicit/specific in the next driver version.

FabianNiehaus89 commented 3 years ago

Perfekt! Thank you.

silabs-JulienT commented 3 years ago

Hi Fabian,

The issue has been addressed in the FMAC driver 3.3.0. https://github.com/SiliconLabs/wfx-fullMAC-driver/blob/05bbac231e0a27f16d5953abb3fc4038b61a08c4/wfx_fmac_driver/sl_wfx_constants.h#L147

Regards, Julien