Skip to content

Commit

Permalink
interrupts, etc for ADCs
Browse files Browse the repository at this point in the history
  • Loading branch information
pwittich committed Jan 13, 2025
1 parent 1655fa3 commit 2f86b53
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion projects/prod_test/ADCMonitorTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static void initADC0SecondSequence(void)
}
extern TaskHandle_t TaskNotifyADC;
// ADC monitoring task.
void ADCMonitorTask(void *parameters)
void ADCMonitorTask(void *pvParameters)
{
// initialize to the current tick time
TickType_t xLastWakeTime = xTaskGetTickCount();
Expand Down
2 changes: 1 addition & 1 deletion projects/prod_test/CommandLineTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ BaseType_t help_command_fcn(int argc, char **argv, char *m)
if (left < len) {
return pdTRUE;
}
copied += snprintf(m + copied, SCRATCH_SIZE - copied, "%s:\r\n %s",
copied += snprintf(m + copied, SCRATCH_SIZE - copied, "%s:\r\n %s\r\n",
commands[i].commandstr, commands[i].helpstr);
}
i = 0;
Expand Down
2 changes: 1 addition & 1 deletion projects/prod_test/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ BaseType_t power_off_ctl(int argc, char **argv, char *m)
{
disable_ps();
snprintf(m, SCRATCH_SIZE, "Power off\r\n");
return pdTRUE;
return pdFALSE;
}

// direct copy paste from other project?
Expand Down
22 changes: 22 additions & 0 deletions projects/prod_test/prod_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "driverlib/sysctl.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/adc.h"
#include "inc/hw_ints.h"

// local includes
Expand All @@ -30,6 +31,7 @@

SemaphoreHandle_t xUARTMutex = 0;
void vCommandLineTask(void *pvParameters);
void ADCMonitorTask(void *pvParameters);

//*****************************************************************************
//
Expand Down Expand Up @@ -57,6 +59,25 @@ void SystemInit(void)
// initialize all pins, using file setup by TI PINMUX tool
PinoutSet();

// ADC
// initialize the ADCs.
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1);
// Set the reference to external
ROM_ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V);
ROM_ADCReferenceSet(ADC1_BASE, ADC_REF_EXT_3V);
ROM_ADCIntEnable(ADC0_BASE, 1); // enable interrupt for sequence 1
ROM_ADCIntEnable(ADC1_BASE, 0); // enable interrupt for sequence 0
// clear the interrupts
ROM_ADCIntClear(ADC0_BASE, 1);
ROM_ADCIntClear(ADC1_BASE, 0);
// FreeRTOS insists that the priority of interrupts be set up like this.
ROM_IntPrioritySet(INT_ADC0SS1, configKERNEL_INTERRUPT_PRIORITY);
ROM_IntPrioritySet(INT_ADC1SS0, configKERNEL_INTERRUPT_PRIORITY);

ROM_IntEnable(INT_ADC0SS1);
ROM_IntEnable(INT_ADC1SS0);

// initialize interrupts
UART0Init(g_ui32SysClock); // ZYNQ UART
initI2C1(g_ui32SysClock); // controller for power supplies
Expand Down Expand Up @@ -125,6 +146,7 @@ __attribute__((noreturn)) int main(void)
xUARTMutex = xSemaphoreCreateMutex();

xTaskCreate(vCommandLineTask, "CLIZY", 512, &cli_uart, tskIDLE_PRIORITY + 4, NULL);
xTaskCreate(ADCMonitorTask, "ADC", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 4, NULL);

Print("\r\n----------------------------\r\n");
Print("Staring Apollo CM MCU Production Test firmware ");
Expand Down

0 comments on commit 2f86b53

Please sign in to comment.