Hi all,
I've been trying to get a TM4C123GXL to transmit a chirp by using the on-board PWM to make a DAC and simultaniously record it with the on-board ADC. So far I haven't had much success, partly due to using the PWM and ADC with interrupts, causing the functions to interfere with each other (while trying to set a new PWM value I miss an ADC sequence-getting interrupt). Due to the microcontroller's relatively small memory for this cause (I have to work with the FPU so I can't make my arrays too large) I've been forced to try and split the labor between two MCUs- one to transmit said chirp and one to receive it, that are synchronized.
The DAC part seems to be working well, but the ADC's giving me some problems. The ADC interrupt isn't very long- the relevant code:
void ADC0Sequencer1IntHandler(void) { uint32_t ui32ADC0Value[4]; ROM_ADCIntClear(ADC0_BASE, 1); ROM_ADCSequenceDataGet(ADC0_BASE, 1, ui32ADC0Value);
for(i = 0; i < 4; i++) { y[ADC_sample_counter + i] = (float)(ui32ADC0Value[i]); } ADC_sample_counter += 4; ADC_flag = 0; }
but even that seems to be long enough for me to spend a significant amount of time putting the values received into an array, and miss out on some of the transmitted signal. So, I've been doing a bit of reading into the uDMA as I've been told it might help me with the issue. This brings me to the following questions:
1. Is there anywhere I can get an example code of using the ADC and the uDMA together? I've been trying to change the example given in the workshop for using the UART and the uDMA, but I'm having some issues with it.
2. Is there a way to transfer data from the ADC directly to an array of floats using the uDMA? This seems like an odd question but I'm trying to avoid any extra arrays if at all possible, including the uint32_t array I'll have to make otherwise.
Thanks in advance,
Avner.