Hello,

Thanks for the reference.

First, from the beginning I had to change in sam_dmac.c:
locate_data(".lpram"), aligned(16);
to
locate_data(".lpram") aligned_data(16);

Because the compiler made errors. Is this correct?? If so, should I push it
to the repo??



The DMA is configured very similarly.

I had to change the following to be closer to the reference you gave me:
LPSRAM_BTCTRL_BLOCKACT_INT --> LPSRAM_BTCTRL_BLOCKACT_NOACT
LPSRAM_BTCTRL_STEPSEL 1 --> 0
DMAC_CTRL_LVLEN3 was not set
I set TRIGACT back to DMAC_CHCTRLB_TRIGACT_BEAT

That's all.

I get the beginning of the buffer (2 bytes) for 16 pulses when looking at
the SCK pin.
On the console I get the message:

Failed to allocate descriptor.

then the process goes to sam_dmainterrupt: getreg16(SAM_DMAC_INTPEND) gives
TERR = 1 for channel 0 (RX channel).


I tried to set the CONFIG_SAMD2L2_DMAC_NDESC. The result is the same on the
oscilloscope but I don't get any specific message.

DMA reg for TX Channel:
btcrl = 0000010000000001
chid = 1 (TX channel)
chctrl = 00000000100000000000011000000001
qosctrl = 0
chintenset = 011

SPI reg:
ctrla = 00110000000000100000000000001110

Regards,
Bert.

Le jeu. 9 nov. 2023 à 21:24, Alan C. Assis <acas...@gmail.com> a écrit :

> Hi Bert,
>
> Are you configuring the DMA similar to way he did:
>
>
> https://web.archive.org/web/20221027190645/http://www.lucadavidian.com/2018/03/08/wifi-controlled-neo-pixels-strips/
> ?
>
> Although on NuttX each driver is a separated instance, under the hook
> the basic configuration will be similar.
>
> BR,
>
> Alan
>
> On 11/9/23, Bert Voldenuit <bertvolden...@gmail.com> wrote:
> > Hello,
> >
> > I have figured what causes the transmission problem.
> >
> > I had to setup the Channel Control B Register with:
> > DMAC_CHCTRLB_TRIGACT_BLOCK instead of DMAC_CHCTRLB_TRIGACT_BEAT
> >
> > Because it would only do one pulse. With TRIGACT_BLOCK, it looks better
> but
> > DMAC do not read all the buffer. it seams that DMAC outputs one byte
> > (8bits) and then is jumping 8 bytes. Looking at the buffer below, it
> ouputs
> > only values in brackets.
> >
> > I tried to modify DMACH_FLAG_STEPSIZE_MASK value to
> DMACH_FLAG_STEPSIZE_X1
> > but it has no impact.
> > I did the same with LPSRAM_BTCTRL_STEPSIZE_MASK.
> >
> > I am pretty sure that it has something to do with STEPSIZE. But I don't
> > understand why it has no impact at all.
> >
> > Is it because of DMACH_FLAG_MEM_INCREMENT set to automatic?
> >
> > Where am I supposed to configure the DMAC? in the samd_dmac.h,
> sam_dmac.h,
> > sam_dmac.c or spi.c?? I am a bit confused.
> >
> > The buffer (a short version of it) look like this:
> > 0x60 is ONE
> > 0x78 is ZERO
> > 0x0 is RESET
> >
> >
> > 0x200023c8: 0x[00]000000 0x00000000 0x[00]000000 0x00000000
> > 0x200023d8: 0x[00]000000 0x00000000 0x[00]000000 0x00000000
> > 0x200023e8: 0x[00]000000 0x00000000 0x[00]000000 0x00000000
> > 0x200023f8:  0x[00]000000 0x00000000 0x[00]000000 0x60606060
> > 0x20002408: 0x[60]606060 0x60606060 0x[60]606060 0x60606060
> > 0x20002418: 0x[60]606060 0x60606060 0x[60]606060 0x60606060
> > 0x20002428: 0x[60]606060 0x60606060 0x[60]606060 0x60606060
> > 0x20002438: 0x[60]606060 0x60606060 0x[60]606060 0x60606060
> > 0x20002448: 0x[60]606060 0x60606060 0x[60]606060 0x60606060
> > 0x20002458: 0x[60]606060 0x60606060 0x[60]606060 0x60606060
> > 0x20002468: 0x[60]606060 0x60606060 0x[60]606060 0x60606060
> > 0x20002478: 0x[60]606060
> >
> > Regards,
> > Bert.
> >
>

Reply via email to