Driving an ILI9163c based display with the NUCLEO-F446RE (+library questions)
As per the question I'm trying to run a ILI9163c based display on the NUCLEO-F446RE. I'm using this library: (https://github.com/Spirit532/ILI9163C_STM32_HAL_DMA). My questions are:
- The library tells you to put DMA into circular mode. However, after every SPI transmit complete event it calls HAL_SPI_DMAStop. Isn't the entire point of putting it in circular mode to leave it running constantly. I thought it might be to avoid having to manually reload the DMA_SXNDTR register but won't calling HAL_SPI_Transmit_DMA to start DMA back up again reload it anyway. The interrupt handler is as follows:
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) {
SPI_DMA_CNT--;
if(SPI_DMA_CNT == 0) {
HAL_SPI_DMAStop(&hspi1);
SPI_DMA_CNT = 1;
SPI_DMA_FL = 1;
}
}- Related to the previous question what is the point of the SPI_DMA_CNT variable. It isn't incremented or decremented anywhere else in the program. I'm not sure what it's suppose to do.
- I would like to use the F446RE at or close to it's maximum clock frequency i.e. 180MHz. However, when I try to change the clock frequency the display no longer seems to receive any data. The only time the display works is when I put the SPI baud rate at 2MBit/s and set all the configurable clocks to 32MHz. Funnily enough setting the baud rate to less than 2MBit/s also seems to stop the display working. What am I missing here? Is the baud rate not what controls the rate of the transaction. Is it because I'm using DMA? Does the DMA clock i.e. AHB/APB2 influence the rate of the transaction?
- How do I figure out what the maximum SPI frequency the ILI9163c can operate at is. The ILI9163C datasheet (in table 17.3.2.2) has a serial clock cycle (read) value with a minimum of 150ns. Does this mean that (assuming you want to read and write at the same frequency) the maximum frequency is ~6.67MHz?
This question is a bit of a mess. I'm sorry. I don't know how to present the questions in a clearer way; largely because I don't know what information is relevant and what is not.
Thanks.
