AnsweredAssumed Answered

Bug Report STM32CubeF4 v 1.21.0 - HAL_DSI_Read() can't read more than two parameters

Question asked by Johan Olsson on Jun 13, 2018
Latest reply on Jun 13, 2018 by Imen D



I found two bugs when trying to read more than two bytes using HAL_DSI_Read(). 


Bug 1: HAL_DSI_Read() will always return HAL_ERROR when reading more than two bytes.

The root cause is simple:

HAL_DSI_Read will first take the HAL lock. Then it will check if datasize > 2 and then try to write the DSI_MAX_RETURN_PKT_SIZE using HAL_DSI_ShortWrite(). This function will try to take the same lock, but it will obviously fail and always return HAL_BUSY and HAL_DSI_Read() will then return HAL_ERROR.


Bug 2: assert_param in HAL_DSI_ShortWrite will fail when writing DSI_MAX_RETURN_PKT_SIZE.

If bug 1 is fixed, HAL_DSI_ShortWrite() is called with third parameter (Mode) DSI_MAX_RETURN_PKT_SIZE. The assert_param() check in HAL_DSI_ShortWrite() (assert_param(IS_DSI_SHORT_WRITE_PACKET_TYPE(Mode));) will fail because IS_DSI_SHORT_WRITE_PACKET_TYPE() does not contain DSI_MAX_RETURN_PKT_SIZE:


                                                     ((MODE) == DSI_DCS_SHORT_PKT_WRITE_P1) || \
                                                     ((MODE) == DSI_GEN_SHORT_PKT_WRITE_P0) || \
                                                     ((MODE) == DSI_GEN_SHORT_PKT_WRITE_P1) || \
                                                     ((MODE) == DSI_GEN_SHORT_PKT_WRITE_P2))


These two bugs must be fixed in order to be able to read more than two bytes (which I want to do to read out the display ID).