Skip to main content
Associate II
January 8, 2024
Solved

CubeMX SPI data size bug?

  • January 8, 2024
  • 2 replies
  • 1833 views

In CubeMX when configuring a SPI peripheral I can only choose either 8 or 16 bit, but the STM32G491 reference manual says data size can be from 4 to 16 bit. Is this a bug in CubeMX?
(using the newest CubeMX version)

This topic has been closed for replies.
Best answer by AScha.3

STM32G491xC   ds :

AScha3_0-1704793551785.png

But in Cube can only select 8 or 16 bits, i can confirm.

Obviously a bug.

@Ghofrane GSOURI , would you report this ?

2 replies

Ghofrane GSOURI
Technical Moderator
January 9, 2024

Hello @decalvus 

First let me thank you for posting.

The data size selection in SPI is important because it determines the resolution and range of values that can be transmitted in a single communication transaction. Here's an explanation of the different data size options:

1- 4-bit data size: With a 4-bit data size, each data element transferred during an SPI transaction is represented using 4 bits. This allows for a range of values from 0 to 15 (2^4 - 1). A 4-bit data size is less common but can be useful in certain applications where limited precision is required, or when the transmitted data is compact and can be represented within a small range.

2- 8-bit data size: An 8-bit data size is the most common option in SPI. Each data element is represented using 8 bits, allowing for a range of values from 0 to 255 (2^8 - 1). This is typically sufficient for most applications and provides a good balance between precision and data size.

3- 16-bit data size: A 16-bit data size allows for even larger values to be transmitted. Each data element is represented using 16 bits, providing a range of values from 0 to 65,535 (2^16 - 1). This data size option is useful when dealing with larger data values or when higher precision is required.

Indeed, for most applications, the 8-bit and 16-bit data sizes in SPI are sufficient and cover the majority of use cases. The 8-bit data size provides a good balance of precision and data size, while the 16-bit data size offers a wider range of values and higher precision and that's why CubeMX offer those two options .

Thx

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Ghofrane GSOURI
Technical Moderator
January 9, 2024

Hello @decalvus and @AScha.3 

Thank you for your contributions and for your detailed explanations,

I confirm the issue on my side, it has been reported to STM32CubeMX development team .

 

Internal ticket number: 170304(This is an internal tracking number and is not accessible or usable by customers).

 

I will keep you posted with update

 

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
AScha.3
AScha.3Best answer
Super User
January 9, 2024

STM32G491xC   ds :

AScha3_0-1704793551785.png

But in Cube can only select 8 or 16 bits, i can confirm.

Obviously a bug.

@Ghofrane GSOURI , would you report this ?

"If you feel a post has answered your question, please click ""Accept as Solution""."