Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect ADC channel mapping #40

Merged
merged 2 commits into from
Feb 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 27 additions & 21 deletions projects/cm_mcu/ADCMonitorTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,27 @@ struct ADC_Info_t {
// channel sensor.
static
struct ADC_Info_t ADCs[] = {
{12, "VCC_12V", 6.},
{13, "VCC_2V5", 2.},
{14, "VCC_M3V3", 2.},
{16, "VCC_3V3", 2.},
{ 7, "VCC_1V8", 1.},
{15, "VCC_M1V8", 1.},
{ 3, "V_VCCINT", 1.},
{ 8, "K_VCCINT", 1.},
{ 0, "V_MGTY1_AVTT", 1.},
{19, "V_MGTY2_AVTT", 1.},
{11, "K_MGTH_AVTT", 1.},
{ 4, "K_MGTY_AVTT", 1.},
{ 2, "V_MGTY1_VCCAUX", 1.},
{17, "V_MGTY2_VCCAUX", 1.},
{ 6, "K_MGTY_VCCAUX", 1.},
{ 9, "K_MGTH_VCCAUX", 1.},
{ 1, "V_MGTY1_AVCC", 1.},
{18, "V_MGTY2_AVCC", 1.},
{ 5, "K_MGTY_AVCC", 1.},
{10, "K_MGTH_AVCC", 1.},
{ADC_CTL_TS, "TM4C_TEMP", 1.}, // this one is special, temp in C
{ADC_CTL_CH12, "VCC_12V", 6.},
{ADC_CTL_CH13, "VCC_2V5", 2.},
{ADC_CTL_CH14, "VCC_M3V3", 2.},
{ADC_CTL_CH16, "VCC_3V3", 2.},
{ADC_CTL_CH7, "VCC_1V8", 1.},
{ADC_CTL_CH15, "VCC_M1V8", 1.},
{ADC_CTL_CH3, "V_VCCINT", 1.},
{ADC_CTL_CH8, "K_VCCINT", 1.},
{ADC_CTL_CH0, "V_MGTY1_AVTT", 1.},
{ADC_CTL_CH19, "V_MGTY2_AVTT", 1.},
{ADC_CTL_CH11, "K_MGTH_AVTT", 1.},
{ADC_CTL_CH4, "K_MGTY_AVTT", 1.},
{ADC_CTL_CH2, "V_MGTY1_VCCAUX", 1.},
{ADC_CTL_CH17, "V_MGTY2_VCCAUX", 1.},
{ADC_CTL_CH6, "K_MGTY_VCCAUX", 1.},
{ADC_CTL_CH9, "K_MGTH_VCCAUX", 1.},
{ADC_CTL_CH1, "V_MGTY1_AVCC", 1.},
{ADC_CTL_CH18, "V_MGTY2_AVCC", 1.},
{ADC_CTL_CH5, "K_MGTY_AVCC", 1.},
{ADC_CTL_CH10, "K_MGTH_AVCC", 1.},
{ADC_CTL_TS, "TM4C_TEMP", 1.}, // this one is special, temp in C
};

static float fADCvalues[ADC_CHANNEL_COUNT]; // ADC values in volts
Expand Down Expand Up @@ -206,6 +206,8 @@ void ADCMonitorTask(void *parameters)
// handle error here
configASSERT(0);
}
ROM_ADCSequenceDisable(ADC1_BASE, 0);

// ADC0,first sequence
initADC0FirstSequence();
TaskNotifyADC = xTaskGetCurrentTaskHandle();
Expand All @@ -220,6 +222,7 @@ void ADCMonitorTask(void *parameters)
// handle error here
configASSERT(0);
}
ROM_ADCSequenceDisable(ADC0_BASE, 1);


// second sequence for ADC0
Expand All @@ -237,6 +240,8 @@ void ADCMonitorTask(void *parameters)
// handle error here
configASSERT(0);
}
ROM_ADCSequenceDisable(ADC0_BASE, 1);

initADC1SecondSequence();
TaskNotifyADC = xTaskGetCurrentTaskHandle();
ROM_ADCProcessorTrigger(ADC1_BASE, 0);
Expand All @@ -252,6 +257,7 @@ void ADCMonitorTask(void *parameters)
// handle error here
configASSERT(0);
}
ROM_ADCSequenceDisable(ADC1_BASE, 0);

// convert data to float values
for ( int i = 0; i < ADC_CHANNEL_COUNT; ++i ) {
Expand Down