Other Parts Discussed in Thread: HALCOGEN
Tool/software: TI C/C++ Compiler
Hi,
I read the Application report SPNA192 "UART Bootloader for Hercules TMS570LS12X MCU" and the associated code ( http://www.ti.com/lit/zip/spna192 ). However I am having an issue getting the board to respond to the SCI pins.
After compiling the code I simplified the void main( void ) function to have the following:
void main(void)
{
uint32_t fnRetValue;
uint32_t i=0;
/* Initialize SCI Routines to receive Command and transmit data */
sciInit();
UART_putString(UART, "\r\n Test ! ");
while(1){ }
}
Unfortunately I am unable to get the test serial message. In my (custom) board, I am using the SCI pins 38/39, and the serial communication works fine on normal applications (with all the registers set using Halcogen). When I debug the bootloader with my JTAG, I can definitely see that the code is being executed, except that the serial message is not being broadcast.
This is my void sciInit(void) function.
void sciInit(void) { /** @b intalise @b SCI1 */ unsigned f; double vclk = SYS_CLK_FREQ * 1000000 / 2; /** - bring SCI out of reset */ sciREG1->GCR0 = 0U; sciREG1->GCR0 = 1U; /** - Disable all interrupts */ sciREG1->CLRINT = 0xFFFFFFFF; sciREG1->CLRINTLVL = 0xFFFFFFFF; /** - global control 1 */ sciREG1->GCR1 = (1 << 25) /* enable transmit */ | (1 << 24) /* enable receive */ | (1 << 5) /* internal clock (device has no clock pin) */ | (0 << 4) /* number of stop bits */ | (0 << 3) /* even parity, otherwise odd */ | (0 << 2) /* enable parity */ | (1 << 1) /* asynchronous timing mode */ | (0 << 0); /** - set baudrate */ // sciREG1->BAUD = 42; /* 115.20K baudrate for 160MHz Vclk */ // sciREG1->BAUD = 259; /* 19.2K baudrate for 160MHz Vclk */ // sciREG1->BAUD = 155; /* 19.2K baudrate for 96MHz Vclk */ f = sciREG1->GCR1 & 2 ? 16 : 1; sciREG1->BAUD = ((unsigned)((vclk /(f*UART_BAUDRATE) + 0.5)) - 1) & 0x00FFFFFF; sciREG1->BAUD = 259; /** - tranmision length */ sciREG1->LENGTH = 7; /* length is 7+1 */ /** - set SCI pins functional mode */ sciREG1->FUN = (1 << 2) /* tx pin */ | (1 << 1) /* rx pin */ | (0); /* clk pin */ /** - set SCI pins default output value */ sciREG1->DOUT = (0 << 2) /* tx pin */ | (0 << 1) /* rx pin */ | (0); /* clk pin */ /** - set SCI pins output direction */ sciREG1->DIR = (0 << 2) /* tx pin */ | (0 << 1) /* rx pin */ | (0); /* clk pin */ /** - set SCI pins open drain enable */ sciREG1->ODR = (0 << 2) /* tx pin */ | (0 << 1) /* rx pin */ | (0); /* clk pin */ /** - set SCI pins pullup/pulldown enable */ sciREG1->PD = (0 << 2) /* tx pin */ | (0 << 1) /* rx pin */ | (0); /* clk pin */ /** - set SCI pins pullup/pulldown select */ sciREG1->PSL = (1 << 2) /* tx pin */ | (1 << 1) /* rx pin */ | (0); /* clk pin */ /** - set interrupt level */ sciREG1->SETINTLVL = (0 << 26) /* Framing error */ | (0 << 25) /* Overrun error */ | (0 << 24) /* Pariry error */ | (0 << 9) /* Receive */ | (0 << 8) /* Transmit */ | (0 << 1) /* Wakeup */ | (0); /* Break detect */ /** - set interrupt enable */ sciREG1->SETINT = (0 << 26) /* Framing error */ | (0 << 25) /* Overrun error */ | (0 << 24) /* Pariry error */ | (0 << 9) /* Receive */ | (0 << 1) /* Wakeup */ | (0); /* Break detect */ /** - inialise global transfer variables */ g_sciTransfer[0].mode = 0 << 8; g_sciTransfer[0].length = 0; /** - Finaly start SCI1 */ sciREG1->GCR1 |= 0x80; }
It seems that the pins 38/39 are not being correctly assigned to the SCI RX/TX functionality. Can you guys help me out setting these up?