Part Number: EK-TM4C123GXL
Hello,
I setup GPIO PB2 as PWM Signal generated from Timer3a.
The Signal runs.
But i need a basic setup to setup the Timer3a to trigger a dma request.
The Timer3a have to trigger dma when Timer3a has a timeout.
I have a logicanalyzier to debug the signal.
My actual Timer Setup:
void init_TIMER_FOR_UDMA()
{
//
// Use GPIO PB2 as PWM Signal generated from Timer T3CCP0 Timer3a
//
//
// The Timer1 peripheral must be enabled for use.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER3);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_TIMER3));
//
// Enable interrupts from the TIMER 3A software channel.
//
//IntEnable(INT_TIMER3A);
//
// Configure the GPIO pin muxing for the Timer/CCP function.
// This is only necessary if your part supports GPIO pin function muxing.
// Study the data sheet to see which functions are allocated per pin.
// TODO: change this to select the port/pin you are using
//
GPIOPinConfigure(GPIO_PB2_T3CCP0);
//
// Configure the ccp settings for CCP pin. This function also gives
// control of these pins to the SSI hardware. Consult the data sheet to
// see which functions are allocated per pin.
// TODO: change this to select the port/pin you are using.
//
GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_2);
//
// Configure Timer3A as a 16-bit periodic timer.
//
TimerConfigure(TIMER3_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM);
//
// Set the Timer3A load value to 50000. For this example a 66% duty cycle
// PWM signal will be generated. From the load value (i.e. 50000) down to
// match value (set below) the signal will be high. From the match value
// to 0 the timer will be low.
//
//TimerLoadSet(TIMER3_BASE, TIMER_A, (SysCtlClockGet() / 1));
TimerLoadSet(TIMER3_BASE, TIMER_A, 65535);
//
// Set the Timer3A match value to load value / 3.
//
//TimerMatchSet(TIMER3_BASE, TIMER_A, TimerLoadGet(TIMER3_BASE, TIMER_A) / 4);
//TimerMatchSet(TIMER3_BASE, TIMER_A, ((TimerLoadGet(TIMER3_BASE, TIMER_A) / 4)) * 3);
TimerMatchSet(TIMER3_BASE, TIMER_A, 65535 / 4);
//
// Enables individual timer interrupt sources.
//
//TimerIntEnable(TIMER3_BASE, TIMER_TIMA_TIMEOUT);
//
// Enables the events that can trigger a uDMA request.
//
TimerDMAEventSet(TIMER3_BASE, TIMER_DMA_TIMEOUT_A);
//
// Gets the enabled attributes of a uDMA channel.
//
//static uint32_t ret_can_tri_req = 0;
//ret_can_tri_req = TimerDMAEventGet(TIMER3_BASE);
// Breakpoint
//for(int i = 0; i < 3; i++);
//
// Enable Timer3A.
//
TimerEnable(TIMER3_BASE, TIMER_A);
//
// Wait for the clock configuration to set.
//
SysCtlDelay(10);
}
My actual DMA Setup:
void init_uDMA_TIMER_REQUEST()
{
//
// Use GPIO PF1 to show the Datatransfer via uDMA.
// Trigger is GPIO PB2 as PWM Signal
// generated from Timer T3CCP0 Timer3a.
// REGISTER 0x40025000
// OFFSET 0x00000008
// PF1 REGISTER 0x40025008
//
//
// PF1 Data Register.
//
#define PF1_REG ( uint32_t *)0x40025008
//
// Set PF1 as Digital Output.
//
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);
//
// Prepare source buffer with 2 increment 0x0, 0x2.
//
for (int i = 0; i < (MEM_BUFFER_SIZE - 1); i = i +2)
{
pui8SourceBuffer[i] = 0x2;
}
//
// Enable the UDMA peripheral
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_UDMA));
//
// Enable the uDMA controller error interrupt. This interrupt will occur
// if there is a bus error during a transfer.
//
IntRegister(INT_UDMAERR, uDMAErrorHandler);
IntEnable(INT_UDMAERR);
//
// Enable interrupts from the uDMA software channel.
//
IntRegister(INT_UDMA, uDMAIntHandler);
IntEnable(INT_UDMA);
//
// Enable interrupts
//
IntMasterEnable();
//
// Enable the uDMA controller.
//
uDMAEnable();
//
// Set the base for the channel control table.
//
uDMAControlBaseSet(&pui8DMAControlTable[0]);
// NOT DONE !!!!!!!!
//
// Assigns a peripheral mapping for a uDMA channel.
//
//uDMAChannelAssign(UDMA_CH2_TIMER3A);
// NOT DONE !!!!!!!!
//
// Put the attributes in a known state for the uDMA ADC0 channel. These
// should already be disabled by default.
//
uDMAChannelAttributeDisable(UDMA_SEC_CHANNEL_TMR3A, UDMA_ATTR_ALTSELECT |
UDMA_ATTR_HIGH_PRIORITY | UDMA_ATTR_REQMASK);
// NOT DONE !!!!!!!!
//
// Enables attributes of a uDMA channel.
//
//uDMAChannelAttributeEnable(UDMA_CH2_TIMER3A, UDMA_ATTR_USEBURST |
// UDMA_ATTR_HIGH_PRIORITY);
//
// Now set up the characteristics of the transfer for 8-bit data size, with
// source and destination increments in bytes, and a byte-wise buffer copy.
// A bus arbitration size of 8 is used.
//
uDMAChannelControlSet(UDMA_SEC_CHANNEL_TMR3A | UDMA_PRI_SELECT,
UDMA_SIZE_8 | UDMA_SRC_INC_8 |
UDMA_DST_INC_32 | UDMA_ARB_64);
//
// The transfer buffers and transfer size are now configured. The transfer
// uses AUTO mode, which means that the transfer automatically runs to
// completion after the first request.
//
uDMAChannelTransferSet(UDMA_SEC_CHANNEL_TMR3A | UDMA_PRI_SELECT,
UDMA_MODE_AUTO, pui8SourceBuffer, PF1_REG, MEM_BUFFER_SIZE);
//
// Set the USEBURST attribute for the uDMA ADC0 channel. This will force
// the controller to always use a burst when transferring data from the
// TX buffer to the UART. This is somewhat more efficient bus usage than
// the default which allows single or burst transfers.
//
uDMAChannelAttributeEnable(UDMA_SEC_CHANNEL_TMR3A, UDMA_ATTR_USEBURST);
// NOT DONE !!!!!!!!
//
// Finally, the channel must be enabled. Because this is a software-
// initiated transfer, a request must also be made. The request starts the
// transfer.
//
uDMAChannelEnable(UDMA_SEC_CHANNEL_TMR3A);
//
// Wait for the clock configuration to set.
//
SysCtlDelay(10);
}
