MPC5746C-Problem of LinFlexUART with DMA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5746C-Problem of LinFlexUART with DMA

970 Views
xiaoke1545
Contributor II

hi,

I need UART to transmit data with DMA , but there is a source bus error after DMA_SERQ = 0x00010000 is executed.

DMA TCD is set as follows:

DMA_TCD16_SADDR = (uint32)TxDataBufPtr;

DMA_TCD16_DADDR = (uinit32)(&LINFlexD_1.BDRL.R)+3;

DMA_TCD16_ATTR = 0;                       /* smod, ssize, dmode, dsize 0*/

DMA_TCD16_NBYTES_MLNO = 1;

DMA_TCD16_SOFF = 1;

DMA_TCD16_DOFF = 0;

DMA_TCD16_SLAST = 0;

DMA_TCD16_CITER_ELINKNO = TxDataBufLen;

DMA_TCD16_BITER_ELINKNO = TxDataBufLen;

DMA_TCD16_CSR = 0x000A;              /* INTMAJOR = 1, DREQ = 1 */

DMA_SERQ = 0x00010000;

After DMA_SERQ = 0x00010000 is excuted,

DMA_TCD16_SADDR = 0x40080000;

DMA_ES = 0x80001002;                      /* SBE = 1, ERRCHN = 0x10, VLD = 1*/

DMA_ERR = 0x00010000;                   /* ERR16 = 1*/

DMA_TCD16_SADDR is changed to 0x40080000.

I can find it is reserved area in Memory Map.

I think it is the reason why there is a source bus error.

But I don't know why it is changed.

And it seems that the DMA is already running because the value of DMA_TCD16_CITER_ELINKNO register varies and sometimes when I running and suspend in debug mode the ACTIVE bit of DMA_TCD16_CSR is 1.

Can any one help me to solve this problem, thank you.
Best wishes!

0 Kudos
7 Replies

793 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

to enable request for ch16 you should either use

DMA_SERQ = 16

or 

DMA_ERQ = 0x00010000 

BR, Petr

0 Kudos

793 Views
xiaoke1545
Contributor II

Hi PetrS,

Thank you for your answer.

I'm sorry that I write the register value of DMA_SERQ wrong by mistake.

I confirmed my code that the value of DMA_SERQ is set correctly.

But I don't know why it can not work.

I list the regsiter value of LinFlexD, DMA and DMAMUX in the attachment.

And I described the error in the attachment.

Could you help me to check it?

Best wishes!

0 Kudos

793 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

did you setup access rights for Masters and Peripherals on AIPS?

For DMA and LINFlex1 you can use this...

AIPS_B.MPRA.R |= 0x7000; // enable DMA to go through AIPS_B
AIPS_B.OPACR[11].R = 0x0; // LINFlex1 has no protection

BR, Petr

793 Views
xiaoke1545
Contributor II

Hi Petr,

I confirmed my code that I didn't set these two registers.

AIPS_B.MPRA.R |= 0x7000; // enable DMA to go through AIPS_B
AIPS_B.OPACR[11].R = 0x0; // LINFlex1 has no protection

But if I set the value of DMA_DCHMID16 to 0xC0, uart with DMA can work.

In my understanding,

If the value of DMA_DCHMID16.EMI is 0, the privileged protection level (supervisor mode) for DMA transfer is used.

Then AIPS_B.MPRA.R and AIPS_B.OPACR[11].R need to be set.

If the value of DMA_DCHMID16.EMI is 1, the privileged protection level (supervisor mode) for DMA transfer is not used.

Then AIPS_B.MPRA.R and AIPS_B.OPACR[11].R don't need to be set.

Is it correct?

 

Best wishes!

0 Kudos

793 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes you are almost right. If DMA_DCHMID16.EMI is set  DMA will use the same protection level and system bus ID of the master programming the DMA’s TCD, which is the core and it has access to peripheral enabled by default.

BR, Petr

793 Views
xiaoke1545
Contributor II

Hi petr,

Thank you very much for your answer. I have no additional questions.

Best wishes!

0 Kudos

793 Views
xiaoke1545
Contributor II

Hi Petr,

I'm not sure the value of these two registers. I will check it tomorrow.

Today I tried to change the value of DMA_DCHMID16 to 0xC0 and uart with DMA can work now.

Authough I don't understand it well.

Best wishes!

0 Kudos