SPI with DMA on SAME70

2022-02-08 Thread Simon Filgis
Dear all,

I'm using ST7789.c in combination with lvgl-lib.

The bottleneck to the display is the SPI communication. But even if I
increase the SPI frequency to 24MHz, it does not get faster. This is
because of constant delay between the bytes.

I guessed that this can be improved using DMA. But that does not seem to
work out of the box. In the SPI TX callback the result of the DMA transfer
is -4. The transfer is not executed.

Can anybody give me a hint on what to do?

Best regards,

Simon

--
Hard- and Softwaredevelopment Consultant
Ingenieurbüro-Filgis
USt-IdNr.: DE305343278


Re: SPI with DMA on SAME70

2022-02-08 Thread Michal Lenc
Hello Simon,



I did take a look into SPI driver for SAME70 a few months ago. The one thing
that was a little bit weird to me was the lack of DMA flags passed to sam_
dmachannel() function (somewhere here https://github.com/apache/incubator-
nuttx/blob/master/arch/arm/src/samv7/sam_spi.c#L2043) compared to the flags
I needed to select for ADC DMA support to function correctly (https://
github.com/apache/incubator-nuttx/blob/master/arch/arm/src/samv7/sam_afec.c#
L1125). I didn't invest more time into it as we had other priorities back 
then and I think we sticked with SPI without DMA. But it could be one of the
problems.




You can also take a look into sam_afec.c file, the DMA is working fine
there. Hope this helps.

Best regards,
Michal Lenc

-- Původní e-mail --
Od: Simon Filgis 
Komu: dev@nuttx.apache.org
Datum: 8. 2. 2022 11:52:38
Předmět: SPI with DMA on SAME70
"Dear all,

I'm using ST7789.c in combination with lvgl-lib.

The bottleneck to the display is the SPI communication. But even if I
increase the SPI frequency to 24MHz, it does not get faster. This is
because of constant delay between the bytes.

I guessed that this can be improved using DMA. But that does not seem to 
work out of the box. In the SPI TX callback the result of the DMA transfer
is -4. The transfer is not executed.

Can anybody give me a hint on what to do?

Best regards,

Simon

--
Hard- and Softwaredevelopment Consultant
Ingenieurbüro-Filgis
USt-IdNr.: DE305343278
"

Re: SPI with DMA on SAME70

2022-02-08 Thread Simon Filgis
Hello Michael,

Thank you for your answer. That is true, SPI driver's initial flag setup is
0.

The flags are evaluated dynamically and very meaningful
within spi_exchange() and set via

  sam_dmaconfig(spics->rxdma, rxflags);
  sam_dmaconfig(spics->txdma, txflags);

I will try with setup initial flags to try.

Any hint to debug is appreciated :)


Simon


--
Hard- and Softwaredevelopment Consultant
Ingenieurbüro-Filgis
USt-IdNr.: DE305343278


On Tue, Feb 8, 2022 at 12:17 PM Michal Lenc  wrote:

> Hello Simon,
>
>
>
> I did take a look into SPI driver for SAME70 a few months ago. The one
> thing
> that was a little bit weird to me was the lack of DMA flags passed to sam_
> dmachannel() function (somewhere here https://github.com/apache/incubator-
> nuttx/blob/master/arch/arm/src/samv7/sam_spi.c#L2043
> )
> compared to the flags
> I needed to select for ADC DMA support to function correctly (https://
>
> github.com/apache/incubator-nuttx/blob/master/arch/arm/src/samv7/sam_afec.c#
> L1125
> ).
> I didn't invest more time into it as we had other priorities back
> then and I think we sticked with SPI without DMA. But it could be one of
> the
> problems.
>
>
>
>
> You can also take a look into sam_afec.c file, the DMA is working fine
> there. Hope this helps.
>
> Best regards,
> Michal Lenc
>
> -- Původní e-mail --
> Od: Simon Filgis 
> Komu: dev@nuttx.apache.org
> Datum: 8. 2. 2022 11:52:38
> Předmět: SPI with DMA on SAME70
> "Dear all,
>
> I'm using ST7789.c in combination with lvgl-lib.
>
> The bottleneck to the display is the SPI communication. But even if I
> increase the SPI frequency to 24MHz, it does not get faster. This is
> because of constant delay between the bytes.
>
> I guessed that this can be improved using DMA. But that does not seem to
> work out of the box. In the SPI TX callback the result of the DMA transfer
> is -4. The transfer is not executed.
>
> Can anybody give me a hint on what to do?
>
> Best regards,
>
> Simon
>
> --
> Hard- and Softwaredevelopment Consultant
> Ingenieurbüro-Filgis
> USt-IdNr.: DE305343278
> "