Comments (4)
Hi @willtoth,
Thank you for this report. You request has been forwarded to our development teams. We will get back to you as soon as they provide us with their feedback.
With regards,
from stm32cubeg4.
Hi @willtoth,
According to our development team, referring to the reference manual RM0440. The DLC is always in the position 16 to 19 in the TX fifo/buffer or the RX fifo/buffer, that’s why we have defined the possible values of the field DLC shifted by 16. Thus, there is no need to modify the API internally when intending to write a DLC field.
In fact, the number of data bytes can be obtained by shifting the DLC value by 16 to the right, which is already done internally in the function FDCAN_CopyMessageToRAM
called by the HAL_FDCAN_AddMessageToTxFifoQ
API.
Indeed, the FDCAN_CopyMessageToRAM
function is used to copy data in the RAM, for that we should retrieve the right number of data bytes by shifting the DLC value by 16 to right.
That’s why we shift DLC value by 16 to right.
With regards,
from stm32cubeg4.
Hi,
Thanks for the response, and sorry I was unclear in my original issue. I understand that the DLC in the RAM register is shifted by 16 internal to the device. My point here is to simplifiy the API to the end user and make it more clear, by allowing the user to enter the actual CAN DLC as an integer (i.e. native to the CAN protocol) instead of the shifted value (i.e. native to the STM32G4). The driver implementation is not even an optimization since a shift is already being done.
Since the DLC is a data size, it is already not very intuitive to expect a data size parameter to be defined the way it is in this driver. For example the CAN driver on STM32F3 this call is:
HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pHeader, uint8_t aData[], uint32_t *pTxMailbox)
Where the DLC of CAN_TxHeaderTypeDef
is defined as
uint32_t DLC;
Another example is the UART HAL:
HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
In the UART API, the user doesn't care how the size parameter is being used, just that it is the size of the data.
from stm32cubeg4.
Hi @willtoth,
We understand that this will make the API easier for the end user and ensure a better understanding of the code. However, according to our development team, the impact of this change is very important. Therefore, our development team regrets to decline your request. Thank you for your understanding.
Please allow me then to close this thread. Thank you for your comprehension and thank you again for your contribution.
With regards,
from stm32cubeg4.
Related Issues (20)
- Readme on NUCLEO-G474RE/Examples/OPAMP/OPAMP_PGA/readme.txt HOT 3
- IS_OPAMP_POWERMODE() use legacy OPAMP_POWERMODE_NORMAL HOT 4
- STM32G4 DMA DAC not working because of CubeMx code generation HOT 2
- OPAMP HOT 5
- The GNU Link Script in STM32CubeG4/Projects/NUCLEO-G491RE/Templates/STM32CubeIDE/STM32G491RETX_FLASH.ld defines wrong RAM size HOT 3
- missing static const in static CRYP_AESGCM_Process_IT() HOT 3
- Why PDM2PCM is not added in G4? HOT 2
- PLLVCO_INPUT_MAX does not match with datasheet HOT 2
- Flash latency inconsistency between STM32CubeG4 and RM0440 HOT 1
- Doubled activation of TRGO in ADC example HOT 1
- LED not blinking on WUT RTC_ProgrammingTheWakeUpTimer HOT 1
- Missing package definitions HOT 2
- HAL_RTC_Init() loses time HOT 4
- template file system_stm32g4xx.c should support userdefined location of vectortable HOT 2
- SPI parameter HOT 3
- Obsolete type caddr_t HOT 2
- EXTI_ToggleLedOnIT and EXTI_ToggleLedOnIT_Init are totally the same HOT 3
- HAL_FMAC_FilterStop does not terminate DMA transfer HOT 1
- __PKHBT and __PKHTB are STILL wrong HOT 2
- conversion warnings for __NVIC_SetVector and __NVIC_GetVector HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stm32cubeg4.