Part Number: TMS320F28388D
Hi,
I am working with TMS320F28388D controller and trying to develop a code for reading data using SCI (Interrupt based). But I am not able to get any interrupt in the SCI Rx line while I am sending data using Docklight. Data transmission is working fine with the code. Rx should work as interrupt based and Tx can work normal also.
Code is given below for your reference.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "device.h"
#include "driverlib.h"
#define BUFFER_SIZE 128
uint16_t rdata_pointA; // Used for checking the received data
uint16_t rdataA[BUFFER_SIZE]; // Received data for SCI-A
void UART_GPIO_init();
void SCI_A_init();
__interrupt void sciaRxISR(void);
void main(void)
{
Device_init();
Device_initGPIO();
DINT;
UART_GPIO_init();
SCI_A_init();
Interrupt_initModule();
Interrupt_initVectorTable();
// Map the ISR to the wake interrupt.
//
Interrupt_register(INT_SCIA_RX, sciaRxISR);
Interrupt_enable(INT_SCIA_RX);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
EINT;
ERTM;
Interrupt_enableMaster();
while(1)
{
SCI_writeCharArray(SCIA_BASE, (uint16_t *)"sci communication interrupt mode\r\n", sizeof("sci communication interrupt mode\r\n"));
DEVICE_DELAY_US(1000000);
}
}
void UART_GPIO_init()
{
//SCIB -> SCI0 Pinmux
GPIO_setPinConfig(GPIO_28_SCIA_RX);
GPIO_setPinConfig(GPIO_29_SCIA_TX);
}
void SCI_A_init()
{
SCI_performSoftwareReset(SCIA_BASE);
//
// Configure SCIA for echoback.
//
SCI_setConfig(SCIA_BASE, DEVICE_LSPCLK_FREQ, 9600, (SCI_CONFIG_WLEN_8 |
SCI_CONFIG_STOP_ONE |
SCI_CONFIG_PAR_NONE));
SCI_resetChannels(SCIA_BASE);
SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_TXRDY | SCI_INT_RXRDY_BRKDT);
SCI_enableModule(SCIA_BASE);
SCI_performSoftwareReset(SCIA_BASE);
//
// Enable the TXRDY and RXRDY interrupts.
//
SCI_enableInterrupt(SCIA_BASE, SCI_INT_TXRDY | SCI_INT_RXRDY_BRKDT);
#ifdef AUTOBAUD
//
// Perform an autobaud lock.
// SCI expects an 'a' or 'A' to lock the baud rate.
//
SCI_lockAutobaud(SCIA_BASE);
#endif
}
__interrupt void
sciaRxISR(void)
{
//rdataA[rdata_pointA]=SciaRegs.SCIRXBUF.all;
SCI_readCharArray(SCIA_BASE, rdataA, 2);
rdata_pointA++;
if(rdata_pointA>=BUFFER_SIZE)
rdata_pointA = 0;
if(rdataA[rdata_pointA-1]=='\n')
{
SCI_writeCharArray(SCIA_BASE, (uint16_t*)rdataA, rdata_pointA);
memset(rdataA,'\0',128);
rdata_pointA = 0;
}
//
// Issue PIE ack
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}
Can you please help me to resolve this.
Regards
Dipin