EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

MSP430F2619 DMA block transfer

Started by "favero.santos" October 4, 2012
Hey, guys!

Anyone knows if "block transfer" + "decrement source address" is a valid operation in DMA?

I'm trying to send the int 0x1011 as a block, but 0x10 must be sent prior to 0x11.

I thought maybe this would work fine, but up to now, nothing....

Any suggestions?

DMA0CTL |= DMA0TSEL_0;

/* PASSO 2*/
//unsigned int endereco = 0x0000;
DMA0CTL |= DMASRCINCR_2 + DMADSTINCR_3 + DMADT_1 + DMASBDB;
// DMASRCINCR_0 -> Incrementa endere de partida
// DMADSTINCR_0 -> N incrementa endere de chegada
// DMADT_1 -> Modo bloco
// DMASBDB -> Transfercia byte para byte

DMA0SA = (int)&endereco+1;
// Endere de partida o endere da variel endere
DMA0DA = 0x1500; //(unsigned char)&UCB0TXBUF;
// Endere de chegada o buffer de transmiss SPI
DMA0SZ = 2;
// Configura tamanho da transfercia - endere de 2 bytes
DMA0CTL |= DMAEN + DMAREQ;
// Enable para transfercia


Beginning Microcontrollers with the MSP430

Why would you need to do this? Possible solutions I can think of depend
on the rationale. if you actually only need to send 2 bytes then
obviously the DMA adds huge overhead.

Al

On 5/10/2012 12:28 AM, favero.santos wrote:
> Hey, guys!
>
> Anyone knows if "block transfer" + "decrement source address" is a valid operation in DMA?
>
> I'm trying to send the int 0x1011 as a block, but 0x10 must be sent prior to 0x11.
>
> I thought maybe this would work fine, but up to now, nothing....
>
> Any suggestions?
>
> DMA0CTL |= DMA0TSEL_0;
>
> /* PASSO 2*/
> //unsigned int endereco = 0x0000;
> DMA0CTL |= DMASRCINCR_2 + DMADSTINCR_3 + DMADT_1 + DMASBDB;
> // DMASRCINCR_0 -> Incrementa endere de partida
> // DMADSTINCR_0 -> N incrementa endere de chegada
> // DMADT_1 -> Modo bloco
> // DMASBDB -> Transfercia byte para byte
>
> DMA0SA = (int)&endereco+1;
> // Endere de partida o endere da variel endere
> DMA0DA = 0x1500; //(unsigned char)&UCB0TXBUF;
> // Endere de chegada o buffer de transmiss SPI
> DMA0SZ = 2;
> // Configura tamanho da transfercia - endere de 2 bytes
> DMA0CTL |= DMAEN + DMAREQ;
> // Enable para transfercia
>
>
>
But what is the problem? Wrong data at SPI port, or no data at all? Still
you are going to have a problem with your trigger as it wont wait untill
the SPI TX buffer is empty to send the new data.

And what is the meaning of this cast?

DMA0SA = (int)&endereco+1;

Regards,

--
Lu Filipe Rossi
Electrical Engineer
Biomechatronics Lab. / Grupo de Sensores Integreis e Sistemas
Escola Politnica
Universidade de S Paulo
Cel. +55 (11) 7662-9234


Hello!

Actually, it's not only 2 bytes.

I was trying to interface a SPI with DMA...
My operations are: send CMD (1byte), send ADDRESS (2 bytes) and send
1kByte.
I tryed to make a step by step sending, but i think it will be better if i
just concatenated CMD and ADDs bytes before my data and send it all as a
block!

Right?

On Thu, Oct 4, 2012 at 12:19 PM, Onestone wrote:

> **
> Why would you need to do this? Possible solutions I can think of depend
> on the rationale. if you actually only need to send 2 bytes then
> obviously the DMA adds huge overhead.
>
> Al
> On 5/10/2012 12:28 AM, favero.santos wrote:
> > Hey, guys!
> >
> > Anyone knows if "block transfer" + "decrement source address" is a valid
> operation in DMA?
> >
> > I'm trying to send the int 0x1011 as a block, but 0x10 must be sent
> prior to 0x11.
> >
> > I thought maybe this would work fine, but up to now, nothing....
> >
> > Any suggestions?
> >
> > DMA0CTL |= DMA0TSEL_0;
> >
> > /* PASSO 2*/
> > //unsigned int endereco = 0x0000;
> > DMA0CTL |= DMASRCINCR_2 + DMADSTINCR_3 + DMADT_1 + DMASBDB;
> > // DMASRCINCR_0 -> Incrementa endere de partida
> > // DMADSTINCR_0 -> N incrementa endere de chegada
> > // DMADT_1 -> Modo bloco
> > // DMASBDB -> Transfercia byte para byte
> >
> > DMA0SA = (int)&endereco+1;
> > // Endere de partida o endere da variel endere
> > DMA0DA = 0x1500; //(unsigned char)&UCB0TXBUF;
> > // Endere de chegada o buffer de transmiss SPI
> > DMA0SZ = 2;
> > // Configura tamanho da transfercia - endere de 2 bytes
> > DMA0CTL |= DMAEN + DMAREQ;
> > // Enable para transfercia
> >
> >
> >
> >
> >
>
> >
> >
> >
> >
Hello, Felipe.

Nice to find another brazilian in this forum.

DMA0SA = (int)&endereco+1;
this means DMA should use as source address the next byte of the int endereco.

Example:
int endereco 0x2010.
In memory, it will be stored as:
0x10 0x20.
Writing the cmd as i did, 0x20 will be pointed firstly (if DMA0SA = (int)&endereco, 0x10 will be pointed firstly).

Anyway, i found another solution:

I'll make a block of CMD (1byte) + ADDS (2 bytes) + data (1k byte) and send as an unique block (the way first way was sending with DMA separated blocks!)

Cheers!

--- In m..., Luis Rossi wrote:
>
> But what is the problem? Wrong data at SPI port, or no data at all? Still
> you are going to have a problem with your trigger as it wont wait untill
> the SPI TX buffer is empty to send the new data.
>
> And what is the meaning of this cast?
>
> DMA0SA = (int)&endereco+1;
>
> Regards,
>
> --
> Lu Filipe Rossi
> Electrical Engineer
> Biomechatronics Lab. / Grupo de Sensores Integreis e Sistemas
> Escola Politnica
> Universidade de S Paulo
> Cel. +55 (11) 7662-9234
>
>
>
>

I may be wrong, but I thought you needed STATUS in between CMD & ADDRs & data.

At least I use it. Am I wasting time by using status en between each Xfer?



From: m... [mailto:m...] On Behalf Of favero.santos
Sent: Thursday, October 04, 2012 12:27 PM
To: m...
Subject: [msp430] Re: MSP430F2619 DMA block transfer





Hello, Felipe.

Nice to find another brazilian in this forum.

DMA0SA = (int)&endereco+1;
this means DMA should use as source address the next byte of the int endereco.

Example:
int endereco 0x2010.
In memory, it will be stored as:
0x10 0x20.
Writing the cmd as i did, 0x20 will be pointed firstly (if DMA0SA = (int)&endereco, 0x10 will be pointed firstly).

Anyway, i found another solution:

I'll make a block of CMD (1byte) + ADDS (2 bytes) + data (1k byte) and send as an unique block (the way first way was sending with DMA separated blocks!)

Cheers!

--- In m... , Luis Rossi wrote:
>
> But what is the problem? Wrong data at SPI port, or no data at all? Still
> you are going to have a problem with your trigger as it wont wait untill
> the SPI TX buffer is empty to send the new data.
>
> And what is the meaning of this cast?
>
> DMA0SA = (int)&endereco+1;
>
> Regards,
>
> --
> Lu Filipe Rossi
> Electrical Engineer
> Biomechatronics Lab. / Grupo de Sensores Integreis e Sistemas
> Escola Politnica
> Universidade de S Paulo
> Cel. +55 (11) 7662-9234
>
>
>
>



Hello, Hugo

Deppends on timming diagram of your SPI component. I'm interfacing my MSP
with a 23k256 (32k bytes SPI RAM).

This memory only needs CMD + ADDRs + DATA.

For this memory, you can write the status register, in this case you'll use
only CMD+DATA.

Cheers!
On Thu, Oct 4, 2012 at 1:31 PM, Hugo Brunert wrote:

> **
> I may be wrong, but I thought you needed STATUS in between CMD & ADDRs &
> data.
>
> At least I use it. Am I wasting time by using status en between each Xfer?
>
> From: m... [mailto:m...] On Behalf Of
> favero.santos
> Sent: Thursday, October 04, 2012 12:27 PM
> To: m...
> Subject: [msp430] Re: MSP430F2619 DMA block transfer
> Hello, Felipe.
>
> Nice to find another brazilian in this forum.
>
> DMA0SA = (int)&endereco+1;
> this means DMA should use as source address the next byte of the int
> endereco.
>
> Example:
> int endereco 0x2010.
> In memory, it will be stored as:
> 0x10 0x20.
> Writing the cmd as i did, 0x20 will be pointed firstly (if DMA0SA =
> (int)&endereco, 0x10 will be pointed firstly).
>
> Anyway, i found another solution:
>
> I'll make a block of CMD (1byte) + ADDS (2 bytes) + data (1k byte) and
> send as an unique block (the way first way was sending with DMA separated
> blocks!)
>
> Cheers!
>
> --- In m... , Luis
> Rossi wrote:
> >
> > But what is the problem? Wrong data at SPI port, or no data at all? Still
> > you are going to have a problem with your trigger as it wont wait untill
> > the SPI TX buffer is empty to send the new data.
> >
> > And what is the meaning of this cast?
> >
> > DMA0SA = (int)&endereco+1;
> >
> > Regards,
> >
> > --
> > Lu Filipe Rossi
> > Electrical Engineer
> > Biomechatronics Lab. / Grupo de Sensores Integreis e Sistemas
> > Escola Politnica
> > Universidade de S Paulo
> > Cel. +55 (11) 7662-9234
> >
> >
> >
> >
>
>
>


Thank you

-----Original Message-----
From: m... [mailto:m...] On Behalf Of Fero Santos
Sent: Thursday, October 04, 2012 12:36 PM
To: m...
Subject: Re: [msp430] Re: MSP430F2619 DMA block transfer

Hello, Hugo

Deppends on timming diagram of your SPI component. I'm interfacing my MSP with a 23k256 (32k bytes SPI RAM).

This memory only needs CMD + ADDRs + DATA.

For this memory, you can write the status register, in this case you'll use only CMD+DATA.

Cheers!
On Thu, Oct 4, 2012 at 1:31 PM, Hugo Brunert wrote:

> **
> I may be wrong, but I thought you needed STATUS in between CMD & ADDRs
> & data.
>
> At least I use it. Am I wasting time by using status en between each Xfer?
>
> From: m... [mailto:m...] On Behalf
> Of favero.santos
> Sent: Thursday, October 04, 2012 12:27 PM
> To: m...
> Subject: [msp430] Re: MSP430F2619 DMA block transfer
> Hello, Felipe.
>
> Nice to find another brazilian in this forum.
>
> DMA0SA = (int)&endereco+1;
> this means DMA should use as source address the next byte of the int
> endereco.
>
> Example:
> int endereco 0x2010.
> In memory, it will be stored as:
> 0x10 0x20.
> Writing the cmd as i did, 0x20 will be pointed firstly (if DMA0SA =
> (int)&endereco, 0x10 will be pointed firstly).
>
> Anyway, i found another solution:
>
> I'll make a block of CMD (1byte) + ADDS (2 bytes) + data (1k byte) and
> send as an unique block (the way first way was sending with DMA
> separated
> blocks!)
>
> Cheers!
>
> --- In m... , Luis
> Rossi wrote:
> >
> > But what is the problem? Wrong data at SPI port, or no data at all?
> > Still you are going to have a problem with your trigger as it wont
> > wait untill the SPI TX buffer is empty to send the new data.
> >
> > And what is the meaning of this cast?
> >
> > DMA0SA = (int)&endereco+1;
> >
> > Regards,
> >
> > --
> > Lu Filipe Rossi
> > Electrical Engineer
> > Biomechatronics Lab. / Grupo de Sensores Integreis e Sistemas
> > Escola Politnica Universidade de S Paulo Cel. +55 (11) 7662-9234
> >
> >
> >
> >
>
>
>


Right, provided the memory doesn't require any additional handling of
the command packet.

Al
On 5/10/2012 1:48 AM, Fero Santos wrote:
> Hello!
>
> Actually, it's not only 2 bytes.
>
> I was trying to interface a SPI with DMA...
> My operations are: send CMD (1byte), send ADDRESS (2 bytes) and send
> 1kByte.
> I tryed to make a step by step sending, but i think it will be better if i
> just concatenated CMD and ADDs bytes before my data and send it all as a
> block!
>
> Right?
>
> On Thu, Oct 4, 2012 at 12:19 PM, Onestone wrote:
>
>> **
>> Why would you need to do this? Possible solutions I can think of depend
>> on the rationale. if you actually only need to send 2 bytes then
>> obviously the DMA adds huge overhead.
>>
>> Al
>> On 5/10/2012 12:28 AM, favero.santos wrote:
>>> Hey, guys!
>>>
>>> Anyone knows if "block transfer" + "decrement source address" is a valid
>> operation in DMA?
>>> I'm trying to send the int 0x1011 as a block, but 0x10 must be sent
>> prior to 0x11.
>>> I thought maybe this would work fine, but up to now, nothing....
>>>
>>> Any suggestions?
>>>
>>> DMA0CTL |= DMA0TSEL_0;
>>>
>>> /* PASSO 2*/
>>> //unsigned int endereco = 0x0000;
>>> DMA0CTL |= DMASRCINCR_2 + DMADSTINCR_3 + DMADT_1 + DMASBDB;
>>> // DMASRCINCR_0 -> Incrementa endere de partida
>>> // DMADSTINCR_0 -> N incrementa endere de chegada
>>> // DMADT_1 -> Modo bloco
>>> // DMASBDB -> Transfercia byte para byte
>>>
>>> DMA0SA = (int)&endereco+1;
>>> // Endere de partida o endere da variel endere
>>> DMA0DA = 0x1500; //(unsigned char)&UCB0TXBUF;
>>> // Endere de chegada o buffer de transmiss SPI
>>> DMA0SZ = 2;
>>> // Configura tamanho da transfercia - endere de 2 bytes
>>> DMA0CTL |= DMAEN + DMAREQ;
>>> // Enable para transfercia
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
A status check is always a good thing, but check your memory data sheet,
I believe that some memories, in fact the 4 I've just looked at, return
status on the byte after the command byte, and every byte thereafter
when writing the memory, so it is a simple case of enabling the SPI
receive and checking the returned data.

My typical SPI sequence looks something like:-

set transaction length
enable ISR
send command byte to start things going.

in ISR, on first call enable RX isr
load next byte in to buffer

the Rx isr then collects stsua.

OR you can run only on the RX isr and get status every transmit, so the
isr does:-

get rxbuffer
send next byte
packet length checks

and you can decide when you want to actually test the status.

Al
On 5/10/2012 2:01 AM, Hugo Brunert wrote:
> I may be wrong, but I thought you needed STATUS in between CMD & ADDRs & data.
>
> At least I use it. Am I wasting time by using status en between each Xfer?
>
>
>
> From: m... [mailto:m...] On Behalf Of favero.santos
> Sent: Thursday, October 04, 2012 12:27 PM
> To: m...
> Subject: [msp430] Re: MSP430F2619 DMA block transfer
>
>
>
>
>
> Hello, Felipe.
>
> Nice to find another brazilian in this forum.
>
> DMA0SA = (int)&endereco+1;
> this means DMA should use as source address the next byte of the int endereco.
>
> Example:
> int endereco 0x2010.
> In memory, it will be stored as:
> 0x10 0x20.
> Writing the cmd as i did, 0x20 will be pointed firstly (if DMA0SA = (int)&endereco, 0x10 will be pointed firstly).
>
> Anyway, i found another solution:
>
> I'll make a block of CMD (1byte) + ADDS (2 bytes) + data (1k byte) and send as an unique block (the way first way was sending with DMA separated blocks!)
>
> Cheers!
>
> --- In m... , Luis Rossi wrote:
>> But what is the problem? Wrong data at SPI port, or no data at all? Still
>> you are going to have a problem with your trigger as it wont wait untill
>> the SPI TX buffer is empty to send the new data.
>>
>> And what is the meaning of this cast?
>>
>> DMA0SA = (int)&endereco+1;
>>
>> Regards,
>>
>> --
>> Lu Filipe Rossi
>> Electrical Engineer
>> Biomechatronics Lab. / Grupo de Sensores Integreis e Sistemas
>> Escola Politnica
>> Universidade de S Paulo
>> Cel. +55 (11) 7662-9234
>>
>>
>
>
>

The 2024 Embedded Online Conference