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:
#define IS_DSI_SHORT_WRITE_PACKET_TYPE(MODE) (((MODE) == DSI_DCS_SHORT_PKT_WRITE_P0) || \
((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).