Home arrow Support arrow Forums

Luminary Micro Forums

Jeni

Senior Boarder
Click here to see the profile of this user

2008/08/12 06:59

ADC sequencer-3 not working properly

Hello,
I am configuring ADC sequencer-3 with oversampling by 64 & differential mode.But when I try to debug the code with hardware,I am getting same count in sequencer,though differential input at ADC0-ADC1 is changed.
But if I use sequencer-0 code works fine.So can anybody tell me what is going wrong with sequencer-3?

login or register to reply

JorgeOrlando

Junior Boarder
Click here to see the profile of this user

2008/11/09 18:17

Re:ADC sequencer-3 not working properly

hi Jeni, im new with this kind of C programming. Im currently working with the sample sequencer 3, I just want to display the on-chip temperature on the OLED, but something its wrong, the value is getting null, I mean, I dunno why the "temperature" is 0 in my case.
Could you help me a bit ? here is my code:

#include "hw_types.h"
#include "debug.h"
#include "sysctl.h"
#include "diag.h"
#include "../displays/rit128x96x4.h"

#include "hw_memmap.h"
#include "hw_ints.h"
#include "adc.h"
#include "ustdlib.h"
#include <stdio.h>
#include "string.h"
#include "math.h"

// The error routine that is called if the driver library encounters an error.
#ifdef DEBUG
void
__error__(char *pcFilename, unsigned long ulLine)
{
}
#endif

int
main(void)
{
unsigned long temp;
unsigned long temp2;
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_8MHZ);
// Activar el clock del ADC
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC);
ADCHardwareOversampleConfigure(ADC_BASE,64);//
// Configure sample sequence 3: processor trigger, priority = 0
ADCSequenceConfigure(ADC_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
// Configure sample sequence 3 step 0
ADCSequenceStepConfigure(ADC_BASE, 3, 0, ADC_CTL_TS | ADC_CTL_END);
//Activa el sequencer 3
ADCSequenceEnable(ADC_BASE,3);
//Activa la interrupcion
ADCIntEnable(ADC_BASE, 3);

IntEnable(INT_ADC3);


// Configurar el ADC para muestrear 500KSps
//SysCtlADCSpeedSet(SYSCTL_ADCSPEED_500KSPS);
//SysCtlADCSpeedSet(SYSCTL_ADCSPEED_1MSPS);
// Desabilitar el sample sequencer 3
//ADCSequenceDisable(ADC_BASE, 3);





// Obtiene los datos del sample sequencer 3 de la FIFO
temp2 = ADCSequenceDataGet(ADC_BASE, 3, &temp);

char szBuffer [32];
unsigned long temporal1 = temp2;
int i;
for(i = 0; i < 10; i++){
szBuffer[i] = (temporal1%10) +0x30;
temporal1 = temporal1/10;
}
RIT128x96x4Init(1000000);
RIT128x96x4StringDraw(&szBuffer, 0, 24, 15);
DiagExit(0);
}


Could you help me please ? =(,

Thanks in advance

login or register to reply

LMI Dave

Expert Boarder
Click here to see the profile of this user

2008/11/24 12:06

Re:ADC sequencer-3 not working properly

Jeni,

Your question seems to have been here a while without an answer - sorry! This is probably not the correct place to post the question and it would likely get more attention over in the general discussion forum.

I can't offer any suggestions right now but if you could post the code that you are having problems with, someone would likely be able to help out. Also, could you let me know which Stellaris part you are using and, if you are using one of our boards, which one?

login or register to reply

LMI Dave

Expert Boarder
Click here to see the profile of this user

2008/11/24 12:15

Re:ADC sequencer-3 not working properly

Jorge,

I can answer your question, though. If you look at the function ADCSequenceDataGet, you will see that the return code is not the data item itself but the number of items read. In your case, this is always zero since you are reading the ADC immediately after you configure it and no samples have yet been generated.

Even if you were to wait a while before calling ADCSequenceDataGet, you would also see the same problem since, as far as I can see, you don't actually trigger the ADC anywhere to start a conversion. You need to call ADCProcessorTrigger to start the conversion based on the way you have configured the sequence.

I also note that you enable the ADC interrupt but don't seem to have an interrupt handler (or, at least, you don't show the source for this). You also don't configure the sequence to generate an interrupt when it is complete. To cause an interrupt to be generated, add ADC_CTL_IE to the configuration for the last step.

login or register to reply