I am new to TI-RTOS and the application that I want to create is to get a A/D reading every 3 uSecs I was thinking of using the sysTickIntHandler to call a function that start ADC. So as a starting point I created some code that is suppose to call the the system interrupt handler every 3 uSecs but the code gets the following exception when it runs. My stack size is = 4096 and heap = 512. Does the RTOS not support this interrupt does it need to be done using a task?
Start ADC InterruptClk count 0
ti.sysbios.family.arm.m3.Hwi: line 1120: E_noIsr: id = 15, pc = 00005858
Exception occurred in background thread at PC = 0x00005858.
Core 0: Exception occurred in ThreadType_Task.
Task name: ti.sysbios.knl.Task.IdleTask, handle: 0x200045a8.
Task stack base: 0x20001360.
Task stack size: 0x800.
R0 = 0x00000090 R8 = 0xffffffff
R1 = 0x200040ac R9 = 0xffffffff
R2 = 0x00000089 R10 = 0xffffffff
R3 = 0x00000004 R11 = 0xffffffff
R4 = 0x0000b97c R12 = 0x00000020
R5 = 0x0000b97c SP(R13) = 0x20001b10
R6 = 0x00000001 LR(R14) = 0x0000581d
R7 = 0x0000b970 PC(R15) = 0x00005858
PSR = 0x01000000
ICSR = 0x0042380f
MMFSR = 0x00
BFSR = 0x00
UFSR = 0x0000
HFSR = 0x00000000
DFSR = 0x0000000b
MMAR = 0xe000ed34
BFAR = 0xe000ed38
AFSR = 0x00000000
Terminating execution...
My Code
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
/* TI-RTOS Header files */
#include <ti/drivers/GPIO.h>
// #include <ti/drivers/I2C.h>
// #include <ti/drivers/SDSPI.h>
// #include <ti/drivers/SPI.h>
// #include <ti/drivers/UART.h>
// #include <ti/drivers/USBMSCHFatFs.h>
// #include <ti/drivers/Watchdog.h>
// #include <ti/drivers/WiFi.h>
#include <driverlib/rom_map.h>
#include <driverlib/sysctl.h>
#include <driverlib/systick.h>
/* Example/Board Header files */
#include "Board.h"
static volatile uint32_t g_ui32TickCount;
uint32_t g_ui32LastTick = 0;
//*****************************************************************************
//
// Handles the SysTick timeout interrupt.
//
//*****************************************************************************
void
SysTickIntHandler(void)
{
//
// Increment the tick count.
//
g_ui32TickCount++;
}
void taskUpdateStatus(UArg a0, UArg a1)
{
while(1)
{
System_printf("Clk count %d \n", g_ui32TickCount);
System_flush();
Task_sleep(300);
}
}
/*
* ======== main ========
*/
Int main(Void)
{
Task_Handle task0;
uint32_t ui32SysClock;
Error_Block eb;
/* Call board init functions. */
Board_initGeneral();
Board_initGPIO();
// Board_initDMA();
// Board_initI2C();
// Board_initSDSPI();
// Board_initSPI();
// Board_initUART();
// Board_initUSB(Board_USBDEVICE);
// Board_initUSBMSCHFatFs();
// Board_initWatchdog();
// Board_initWiFi();
Error_init(&eb);
/* Turn on user LED */
GPIO_write(Board_LED, Board_LED_ON);
//
// Set the clocking to run at 1 MHz.
//
MAP_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_XTAL_1MHZ |
SYSCTL_OSC_MAIN);
ui32SysClock = MAP_SysCtlClockGet();
//
// Configure SysTick to periodically interrupt once every 3uSec
//
g_ui32TickCount = 0;
SysTickPeriodSet(ui32SysClock / 3);
MAP_SysTickIntEnable();
MAP_SysTickEnable();
task0 = Task_create(taskUpdateStatus, NULL, &eb);
if(task0 == NULL)
System_abort("Task create failed");
System_printf("Start ADC Interrupt");
System_flush();
/* Start BIOS */
BIOS_start();
return (0);
}