M52259DEMO - DMA transfers to peripherals

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

M52259DEMO - DMA transfers to peripherals

ソリューションへジャンプ
3,672件の閲覧回数
BatTech
Contributor I

Hi All,

 

I've been playing with DMA transfers and I can quite happly move data from memory to memory. My problem is moving data from memory to peripherals.

 

I'm using Processor Expert Init_DMA to set everything up and if specify the source as (uint8)&MemorySource and the destination as (uint8)&MemoryDestination, with a 1 byte transfer then this works fine.

 

If however, I change the destination to (uint8)&PWMDTY2 for example (I've tried others) then the transfer fails with a BED error in DSR2 -> "The DMA channel terminated with a bus error during the write portion of a transfer."

 

Now in the 52259 Ref Manual, 22.4.3.2 gives " If the transfer is from memory to a peripheral device, DARn is loaded with the address of the peripheral data register. This address can be any aligned byte address."

 

Unfortunately, I'm not sure what it means by aligned byte address. Can anyone enlighten me?

 

Thanks in advance - Colin

ラベル(1)
0 件の賞賛
返信
1 解決策
2,553件の閲覧回数
mjbcswitzerland
Specialist V

Hi Colin

 

"aligned byte address" doesn't make a lot of sense since a byte is always aligned.

I checked in some existing projects and found one reading from an edge port via DMA (EPPDR0 is at the address (IPSBAR + 0x130005)) so this does suggest that there should be no problems reading from an odd address.

 

The DMA controller doesn't however automatically have full rights to access parts of memory, therefore you may be seeing access violations due to this. Make sure that you have given the controller adequate rights by doing:

 

GPACR0 = SUP_USER_FULL_ACCESS;                                   // enable peripheral SRAM access (value is 0x4)

 

others which may be useful are:

 

    PACR1 = 0x04;                                                        // enable DMA to access FLASH
    GPACR1 = 0x04;

 

Regards

 

Mark

 

www.uTasker.com
- OS, TCP/IP stack, USB, device drivers and simulator for M521X, M521XX, M5221X, M5222X, M5223X, M5225X. One package does them all - "Embedding it better..."

 

 

 

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
2,554件の閲覧回数
mjbcswitzerland
Specialist V

Hi Colin

 

"aligned byte address" doesn't make a lot of sense since a byte is always aligned.

I checked in some existing projects and found one reading from an edge port via DMA (EPPDR0 is at the address (IPSBAR + 0x130005)) so this does suggest that there should be no problems reading from an odd address.

 

The DMA controller doesn't however automatically have full rights to access parts of memory, therefore you may be seeing access violations due to this. Make sure that you have given the controller adequate rights by doing:

 

GPACR0 = SUP_USER_FULL_ACCESS;                                   // enable peripheral SRAM access (value is 0x4)

 

others which may be useful are:

 

    PACR1 = 0x04;                                                        // enable DMA to access FLASH
    GPACR1 = 0x04;

 

Regards

 

Mark

 

www.uTasker.com
- OS, TCP/IP stack, USB, device drivers and simulator for M521X, M521XX, M5221X, M5222X, M5223X, M5225X. One package does them all - "Embedding it better..."

 

 

 

0 件の賞賛
返信
2,553件の閲覧回数
BatTech
Contributor I

Thanks Mark you are a star. Now stop answering silly questions on a Sunday night and find yourself a beer.:smileywink:

 

An alternative solution i've found is to set the MPR2 bit in the MPR register to elevate the DMA controllers access rights.

 

(The HC08 devices were so much simpler....)

0 件の賞賛
返信
2,553件の閲覧回数
pslavkin
Contributor I
Hi Gonzalo, I'm Pablo, Have you solved your problem regarding DMA and UART?? I've exactly the same problem, on same board, and I'm still working on it without succes... Thanks in advance. Pablo.
0 件の賞賛
返信
2,553件の閲覧回数
J2MEJediMaster
Specialist I

Please do not cross-post questions in the forums.

 

---Tom

0 件の賞賛
返信