2022-03-21 10:28 AM
I use this:
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef * htim)
{
if (htim->Instance==TIM2) // Tarda 2.17 us en llegar aqui, AQUI DIBUJO EL BUFFER, EN HSYNC
{
if((m<56))
{
for (h=0;h<16;h++){} //10 ORIG, AQUI DAMOS ESPACIO PARA FONT PORCH
HAL_SPI_Transmit_DMA_MIA(&hspi1,pointer_Data,Data_size);
pointer_Data[0]=fb[m][0];
pointer_Data[1]=fb[m][1];
pointer_Data[2]=fb[m][2];
.......
m++;
Where my function is:
void HAL_SPI_Transmit_DMA_MIA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
{ /*
HAL_StatusTypeDef errorcode = HAL_OK;
assert_param(IS_SPI_DIRECTION_2LINES_OR_1LINE(hspi->Init.Direction));
*/
hspi->pTxBuffPtr = pData;
hspi->TxXferSize = Size;
hspi->TxXferCount = Size;/*
hspi->pRxBuffPtr = (uint8_t*)NULL;
hspi->RxXferSize = 0;
hspi->RxXferCount = 0;*/
/* Enable the Tx DMA channel */
HAL_DMA_Start_IT(hspi->hdmatx, (uint32_t)hspi->pTxBuffPtr, (uint32_t)&hspi->Instance->DR, hspi->TxXferCount);
/* Check if the SPI is already enabled */
// if((hspi->Instance->CR1 &SPI_CR1_SPE) != SPI_CR1_SPE)
//{
/* Enable SPI peripheral */
__HAL_SPI_ENABLE(hspi);
// }
/* Enable Tx DMA Request */
SET_BIT(hspi->Instance->CR2, SPI_CR2_TXDMAEN);
}
2022-03-21 11:57 AM
Copying the pixels from fb row m to pointer_Data seems time consuming and should be avoided.
> can you suggest a faster op
Where else do you see room for improvements?
hth
KnarfB
2022-03-21 01:52 PM
Thx for answer me @KnarfB ! =(. In some examples I've seen, they use something like:
SET_BIT(hspi->Instance->CR2, SPI_CR2_TXDMAEN);
And with only one instruction they begin to draw, but they uses standard libraries, i'm using hal libraries...
2022-03-22 08:49 AM
The MCU and the underlying registers and bits, are the same between HAL and SPL implementations.
SPI2->CR2 will work on all CMSIS based implementations.
2022-03-22 11:31 AM
It´s just an example, =(...
This is what artekit uses: