Tool/software: Code Composer Studio
Dear all,
I notice that after we initiate the SysTick, when we implement SysTick_getvalue() it will return the count value instead of the time value. I am trying to find a way to convert the count value to the time value right now because my team's design requires the clock runs 36MHz, which means the clock will tick every 27.78ns. Let's say if I create an integer named count, and then every time the clock ticks, the count will be increased by 1. For instance, when the clock ticks 300 times (equivalent to 8.334us), my count value will become 300? I also want to use a GPIO as an input, and every time the input is high I can append the current count value into an empty vector. Then after 2.65ms (count=95392), the input will be disabled, and no matter if the input is high or not, the whole operation will be called off.
Now I only have a rough idea of how to do it:
/* start of the code*/
int count=0;
int main (void){
MAP_WDT_A_holdTimer();
MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);
MAP_GPIO_interruptEdgeSelect(PIO_PORT_P1, GPIO_PIN1, GPIO_HIGH_TO_LOW_TRANSITION);
MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1);
MAP_FPU_enableModule();
MAP_CS_setDCOFrequency(36000000);
MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);
MAP_FlashCtl_setWaitState(FLASH_BANK0, 1);
MAP_FlashCtl_setWaitState(FLASH_BANK1, 1);
MAP_SysTick_enableModule();
MAP_SysTick_setPeriod(1);
MAP_SysTick_enableInterrupt();
MAP_Interrupt_enableMaster();
while (count<=95392)
{
if (/*PIN1.1 high*/){
/*array append current count value*/
}
}
}
Void SysTick_Handler(void){
count++;
}
Is it a good approach? I do not want to just attempt it on the board since I have made so many mistakes on running the clock with high frequency and the MCUs were just bricked, and I had to purchase another one.
