Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
お世話になります。
使用デバイス:mbed LPC1768
タイマーマッチ (MAT0.0) をトリガーとして1byteずつDMA転送をしたいと思っています。
下記に示すように0.5sごとに転送させることを想定して実装してみたのですが、 DMA転送は行われるものの一気に転送されてしまっているようです。
以下についてご教授いただけたらと思います。
何卒、よろしくお願い致します。
include the mbed library with this snippet
#include "mbed.h" uint32_t srcBuffer[] = { 0x00040000 , 0x00100000, 0x00040000, 0x00100000, 0x00040000, 0x00100000, 0x00040000, 0x00100000, }; uint32_t dstBuffer[sizeof(srcBuffer)]; Serial serial(USBTX, USBRX); int main() { serial.baud(115200); serial.printf("\r\n\r\nHello!\r\n"); // Timer Settings LPC_SC->PCONP |= (0x01 << 1) | (0x01 << 22); LPC_SC->PCLKSEL0 |= (0x01 << 2); LPC_PINCON->PINSEL7 |= (0x02 << 18); LPC_TIM0->TCR &= ~(0x01 << 0); LPC_TIM0->CTCR |= (0x00 << 0); LPC_TIM0->PR = 95999; // 1 count-up per 1ms LPC_TIM0->MR0 = 500; // 500ms LPC_TIM0->MCR |= (0x2 << 0); // DMA Settings uint32_t dstadr = (uint32_t)dstBuffer; LPC_GPIO1->FIODIR = (1 << 18) | (1 << 20); LPC_SC->PCONP |= (1UL << 29); LPC_GPDMA->DMACConfig |= 0x01; LPC_GPDMA->DMACIntTCClear = 0x0F; LPC_GPDMA->DMACIntErrClr = 0x0F; LPC_SC->DMAREQSEL |= (1 << 0); LPC_GPDMA->DMACSoftBReq |= (1 << 8); LPC_GPDMACH0->DMACCSrcAddr = (uint32_t)srcBuffer; LPC_GPDMACH0->DMACCDestAddr = dstadr; LPC_GPDMACH0->DMACCLLI = 0; LPC_GPDMACH0->DMACCControl = (uint32_t)sizeof(srcBuffer) | (1 << 12) | (1 << 15) | (2 << 18) | (2 << 21) | (1 << 26) | (1 << 27); serial.printf("%08X %08X %08X %08X %08X %08X %08X %08X\r\n", dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3], dstBuffer[4], dstBuffer[5], dstBuffer[6], dstBuffer[7]); LPC_GPDMACH0->DMACCConfig = (1 << 0) | (8 << 1) | (0 << 11) | (1 << 15); LPC_TIM0->TCR |= 0x01; // Enable Timer while(1) { wait(0.5); serial.printf("%08X %08X %08X %08X %08X %08X %08X %08X\r\n", dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3], dstBuffer[4], dstBuffer[5], dstBuffer[6], dstBuffer[7]); } }