Part Number: TMS320C5517
I have a TMS320C5517 EVM development board made by Spectrum Digital Incorporated. I want to use timer 0, but I was surprised to see in register.h that the timer registers don't exist. Does anybody know why? I added them myself like this
#define T0CR *(ioport volatile uint16_t *)0x1810 #define TIM0PRD1 *(ioport volatile uint16_t *)0x1812 #define TIM0PRD2 *(ioport volatile uint16_t *)0x1813 #define TIM0CNT1 *(ioport volatile uint16_t *)0x1814 #define TIM0CNT2 *(ioport volatile uint16_t *)0x1815 #define TISR *(ioport volatile uint16_t *)0x1C3E
but when I put in a break point and look at the register values in the Code Composer Studio register view then the registers have default values. Does anybody know what's wrong? My source can be found below.
.sect "vector" .def _VECSTART .ref _timerIsr .ref _dmaIsr .ref _gpioIsr .ref _communicationIsr .ref _c_int00 .ref _dummyIsr .align 256 ; Interrupt vector definitions _VECSTART: _RST: .ivec _c_int00, USE_RETA ; Reset / Software Interrupt #0 NMI: .ivec no_isr ; Nonmaskable Interrupt INT0: .ivec no_isr ; External User Interrupt #0 INT1: .ivec no_isr ; External User Interrupt #1 TINT0: .ivec _timerIsr ; Timer #0 / Software Interrupt #4 PROG0: .ivec no_isr ; Programmable 0 Interrupt UART: .ivec no_isr ; IIS #1 Receive Interrupt .
.
. #define SYSTEM_CLK_FREQ_Hz ((uint32_t)196000000) uint16_t configAndRestartTimer(uint16_t delayMs, uint16_t timerIntCallbackPtr) { T0CR = 0x8000; // Enable timer uint32_t timerFreq = SYSTEM_CLK_FREQ_Hz / 8192; uint32_t numNeededTimerTicks = timerFreq/(1000 * ((uint32_t)delayMs)); TIM0PRD2 = (uint16_t)(numNeededTimerTicks >> 16); // Set period of timer TIM0PRD1 = (uint16_t)(numNeededTimerTicks >> 0); // Set period of timer TIM0CNT2 = 0; // Reset the count value TIM0CNT1 = 0; // Reset the count value TISR = 1; // Timer 0 interrupt is routed to CPU non-maskable interrupt (NMI). T0CR = (((uint16_t) 1) << 15) | // Enable timer (((uint16_t) 0xC) << 2) | // 8192 as prescalar. This will give a timer freq of 196 MHz / 8192 = 23.926 kHz (((uint16_t) 0) << 1) | // Auto-reload is disabled (((uint16_t) 1) << 0); // Start the counter return 0; } interrupt void timerIsr(void) { UART_SW_Tx_ONLY_transmitNullTermString("\r\ntimerIsr"); }