Hola gente. ¿Cómo están?
Estuve anoche renegando a dos manos tratando de hacer andar el modulo de DMA de la LPC1769 usando los predecesores de LPOPen (Drivers/CMSIS) y no tuve éxito. Se genera una sola intrupción y no puedo hacer que sincronice con el match de Timer (0 o 1).
¿Alguno pudo hacerlo andar de esta forma ?
Les adjunto el código, en una de esas tiene un error el mismo y no lo estoy viendo.
Muchas gracias
Saludos !
PD/ Los printf es porque hice un semihost y trataba de ver que pasaba debuggeandolo con la placa.
void DMA_IRQHandler(void)
{
static uint32_t Channel0_TC = 0;
static uint32_t Channel0_EC = 0;
printf("Rutina de DMA, IRQ\n");
printf("Interrupcion del canal 0: %d\n",GPDMA_IntGetStatus(GPDMA_STAT_INT, 0));
if (GPDMA_IntGetStatus(GPDMA_STAT_INT, 0)){ //check interrupt status on channel 0
if(GPDMA_IntGetStatus(GPDMA_STAT_INTTC, 0)){
GPDMA_ClearIntPending(GPDMA_STATCLR_INTTC, 0);
printf("Limpieza del canal terminal count %d\n",Channel0_TC);
Channel0_TC++;
printf("Interrupcion del canal 0: %d\n",GPDMA_IntGetStatus(GPDMA_STAT_INT, 0));
}
if (GPDMA_IntGetStatus(GPDMA_STAT_INTERR, 0)) {
GPDMA_ClearIntPending(GPDMA_STATCLR_INTERR, 0);
printf("Limpieza del canal terminal error %d\n",Channel0_EC);
Channel0_EC++;
printf("Interrupcion del canal 0: %d\n",GPDMA_IntGetStatus(GPDMA_STAT_INT, 0));
}
}
return;
}
[...]
FIO_SetDir(0, 0xFFFFFFFF, 0); //Salida por GPIO.0
[...]
void configureDMA()
{
GPDMA_LLI_Type DMA_LLI_Struct;
GPDMA_Channel_CFG_Type GPDMAChannelConfig2;
GPDMA_Init();
GPDMA_REQSEL_TIMER;
DMA_LLI_Struct.SrcAddr= (uint32_t)data; //Direccion de los datos fuente (Un arreglo de 0 y 1)
DMA_LLI_Struct.DstAddr= (uint32_t)&(LPC_GPIO0->FIOPIN); //Destino: FIOPIN del GPIO0
DMA_LLI_Struct.NextLLI= (uint32_t)&DMA_LLI_Struct;; //Solo un juego de datos
DMA_LLI_Struct.Control= DMA_SIZE
| (2<<18) //Fuente: 32bits
| (2<<21) //Destino: 32bit
| (1<<26) //Incremento automático de la fuente
;
GPDMAChannelConfig2.ChannelNum=0;
GPDMAChannelConfig2.SrcMemAddr=(uint32_t)&data; //Dirección del puntero
GPDMAChannelConfig2.DstMemAddr = (uint32_t)&(LPC_GPIO0->FIOPIN); //Salida por GPIO0
GPDMAChannelConfig2.TransferSize=200; //cantidad de bytes a transferir en total
GPDMAChannelConfig2.TransferWidth=0; //No necesario
GPDMAChannelConfig2.TransferType=GPDMA_TRANSFERTYPE_M2M; //Memoria a Memoria
GPDMAChannelConfig2.SrcConn=GPDMA_CONN_MAT1_1; //
GPDMAChannelConfig2.DstConn=GPDMA_CONN_MAT1_1; // Dispuse esto aca igual, por como está implementada la función. Reescribe dependiendo dos parametros distntos el mismo registro, me llamo mucho la atención.
GPDMAChannelConfig2.DMALLI = (uint32_t)&DMA_LLI_Struct;
//GPDMAChannelConfig2.DMALLI = 0;
printf("El resultado de la configuracion del DMA es %d\n",GPDMA_Setup(&GPDMAChannelConfig2));
GPDMA_ChannelCmd(0, ENABLE);
NVIC_EnableIRQ(DMA_IRQn);
}