This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28388D: Trouble with CM core, sysbios, Hwi, and UART0

Part Number: TMS320F28388D
Other Parts Discussed in Thread: SYSBIOS

Hi

I am attempting to get Connectivity Manager core's UART0 Receiver interrupts working using SysBios Hwi.     Here are the tool versions I am using:

CCS Version 10_4_0_00006

xdcTools Version 3_55_02_00

Bios Version 6_76_01_12

Network Services Version 2_60_01_06

At this point the RTOS is running and NDK software is running on the CM ARM core. I can connect to a network and send and receive TCP messages.  Now I would like to use the CM UART.  I am able to transmit from the CM's UART0 and can receive if I poll the receive status register.  However, I have not been able to get Rx interrupts to fire using the Hwi module.  Here is the relevant part of the  configuration file:

var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
var ti_sysbios_family_arm_m3_Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');

//--------------------------------- Other stuff in here ------------------------------------------------

var hwi0Params = new Hwi.Params();
hwi0Params.instance.name = "hwi0";
hwi0Params.arg = 55;
Program.global.hwi0 = Hwi.create(18, "&hwi_IsrUart0rx", hwi0Params);

Before starting the bios by calling BIOS_start() I execute the following initialization of UART0:

#define U_BASE 0x4000C000

#define UART_DR 0x00 // Data Register
#define UART_RSR 0x04 // Receive Status/Clr
#define UART_FR 0x18 // Flags
#define UART_ILPR 0x20 // IRDA
#define UART_IBRD 0x24 // Integer Baud Rate Divisor
#define UART_FBRD 0x28 // Fractional Baud Rate Divisor
#define UART_LCRH 0x2c // Line Control
#define UART_CTL 0x30 // Control Register
#define UART_IFLS 0x34 // Interrupt FIFO Level Select
#define UART_IM 0x38 // Interrupt Mask
#define UART_RIS 0x3c // Raw Interrupt Status
#define UART_MIS 0x40 // Masked Interrupt Status
#define UART_ICLR 0x44 // Interrupt Clear

uint32_t *uartBase;

void CM_uartInit(uint32_t base){
uartBase = (uint32_t *)U_BASE;

UART0_RxWrite = UART0_RxRead = 0; // Init the Rx circular queue
GPIO_writePin(86, 1); // Enable RS485 Driver
GPIO_writePin(87, 0); // Enable RS485 Receiver

SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_UART0); // Make sure clocks are on

*((uint32_t *)(U_BASE + UART_CTL)) &= ~0x0001; // Disable UART (B0 of register) per TechRef

*((uint32_t *)(U_BASE + UART_IBRD)) = 0x43; // Set baud rate = 115200
*((uint32_t *)(U_BASE + UART_FBRD)) = 0x34;

*((uint32_t *)(U_BASE + UART_LCRH)) = 0x70; // 8N1      (0x70 = FIFOs on,     0x60 = FIFOs off)


*((uint32_t *)(U_BASE + UART_IFLS)) = 0x12;

UART_clearInterruptStatus(base, UART_INT_RX);
UART_enableInterrupt(base,UART_INT_RX);
*((uint32_t *)(U_BASE + UART_CTL)) = 0x0301; // Enable Tx, Rx and UART
}

The interrupt service routine looks like this:

void hwi_IsrUart0rx(){
     UART_clearInterruptStatus(U_BASE, UART_INT_RX);
}

Program compiles, links and runs but if I send characters from a terminal program to UART0 I can see them arriving in the data register (using CCS Memory browser or Register view) but no interrupt is fired.  I can put a breakpoint in the ISR but it never triggers.

I also have questions about the Interrupt Service Routine.  In the config file (see above) I am sending a parameter to the ISR with a value of 55.  Question is how do I write the ISR.  Like this?  

void hwi_IsrUart0rx(uint8_t param){

     //Other code goes here

}

or some other way?

Thanks in advance

          Joel

  • In your Hwi set up, I'm not sure 18 is the correct interrupt number. Can you try 34? The Hwi function pointer type is defined as "Void (*FuncPtr)(UArg);"

    If that doesn't work can you confirm that you see the interrupt flag being set in UART registers if you check them in the registers view?

    Whitney

  • That was the problem.  I used the IRQ number rather than the vector table offset.