Other Parts Discussed in Thread: C2000WARE
Tool/software:
Hello,
I am working on SCI-UART (TMS320F28388S) .
taken example sci_ex2_loopback_interrupts from devicelib in that just commented loopback function
but not getting output what is the issue
I have attached code for reference
//
// Included Files
//
#include "driverlib.h"
#include "device.h"
//
// Globals
//
//
// Send data for SCI-A
//
uint16_t sDataA[2];
//
// Received data for SCI-A
//
uint16_t rDataA[2];
//
// Used for checking the received data
//
uint16_t rDataPointA;
//
// Function Prototypes
//
__interrupt void sciaTXFIFOISR(void);
__interrupt void sciaRXFIFOISR(void);
void initSCIAFIFO(void);
void error(void);
//
// Main
//
void main(void)
{
uint16_t i;
//
// Initialize device clock and peripherals
//
Device_init();
//
// Setup GPIO by disabling pin locks and enabling pullups
//
Device_initGPIO();
//
// GPIO28 is the SCI Rx pin.
//
GPIO_setControllerCore(DEVICE_GPIO_PIN_SCIRXDA, GPIO_CORE_CPU1);
GPIO_setPinConfig(DEVICE_GPIO_CFG_SCIRXDA);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_DIR_MODE_IN);
GPIO_setPadConfig(DEVICE_GPIO_PIN_SCIRXDA, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_QUAL_ASYNC);
//
// GPIO29 is the SCI Tx pin.
//
GPIO_setControllerCore(DEVICE_GPIO_PIN_SCITXDA, GPIO_CORE_CPU1);
GPIO_setPinConfig(DEVICE_GPIO_CFG_SCITXDA);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(DEVICE_GPIO_PIN_SCITXDA, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_QUAL_ASYNC);
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
//
Interrupt_register(INT_SCIA_RX, sciaRXFIFOISR);
Interrupt_register(INT_SCIA_TX, sciaTXFIFOISR);
//
// Initialize the Device Peripherals:
//
initSCIAFIFO();
//
// Init the send data. After each transmission this data
// will be updated for the next transmission
//
for(i = 0; i < 2; i++)
{
sDataA[i] = i;
}
rDataPointA = sDataA[0];
Interrupt_enable(INT_SCIA_RX);
Interrupt_enable(INT_SCIA_TX);
// Interrupt_enableInPieCtrl(9); // PIE Group 9 controls SCI interrupts (RX, TX)
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// IDLE loop. Just sit and loop forever (optional):
//
for(;;);
}
//
// error - Function to halt debugger on error
//
void error(void)
{
GPIO_writePin(31, 1); // Turn on LED at GPIO31 for debugging (Optional)
asm(" ESTOP0"); // Test failed!! Stop!
for (;;);
}
//
// sciaTXFIFOISR - SCIA Transmit FIFO ISR
//
__interrupt void sciaTXFIFOISR(void)
{
uint16_t i;
// Ensure TX FIFO is not full before writing
while (SCI_getTxFIFOStatus(SCIA_BASE) == SCI_FIFO_TX16);
SCI_writeCharArray(SCIA_BASE, sDataA, 2);
//
// Increment send data for next cycle
//
for(i = 0; i < 2; i++)
{
sDataA[i] = (sDataA[i] + 1) & 0x00FF;
}
SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_TXFF);
//
// Issue PIE ACK
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}
//
// sciaRXFIFOISR - SCIA Receive FIFO ISR
//
__interrupt void sciaRXFIFOISR(void)
{
uint16_t i;
SCI_readCharArray(SCIA_BASE, rDataA, 2);
//
// Check received data
//
for(i = 0; i < 2; i++)
{
if(rDataA[i] != ((rDataPointA + i) & 0x00FF))
{
error();
}
}
rDataPointA = (rDataPointA + 1) & 0x00FF;
if (SCI_getOverflowStatus(SCIA_BASE))
{
SCI_clearOverflowStatus(SCIA_BASE);
}
SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_RXFF);
//
// Issue PIE ack
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}
//
// initSCIAFIFO - Configure SCIA FIFO
//
void initSCIAFIFO()
{
//
// 8 char bits, 1 stop bit, no parity. Baud rate is 9600.
//uint16_t sysClockFreq = SysCtl_getClock(DEVICE_OSCSRC_FREQ);
SCI_performSoftwareReset(SCIA_BASE);
SCI_setConfig(SCIA_BASE, DEVICE_LSPCLK_FREQ, 9600, (SCI_CONFIG_WLEN_8 |
SCI_CONFIG_STOP_ONE |
SCI_CONFIG_PAR_NONE));
SCI_enableModule(SCIA_BASE);
// SCI_enableLoopback(SCIA_BASE);
SCI_resetChannels(SCIA_BASE);
SCI_enableFIFO(SCIA_BASE);
//
// RX and TX FIFO Interrupts Enabled
//
SCI_enableInterrupt(SCIA_BASE, (SCI_INT_RXFF | SCI_INT_TXFF));
SCI_disableInterrupt(SCIA_BASE, SCI_INT_RXERR);
//
// The transmit FIFO generates an interrupt when FIFO status
// bits are less than or equal to 2 out of 16 words
// The receive FIFO generates an interrupt when FIFO status
// bits are greater than equal to 2 out of 16 words
//
SCI_setFIFOInterruptLevel(SCIA_BASE, SCI_FIFO_TX2, SCI_FIFO_RX2);
//SCI_performSoftwareReset(SCIA_BASE);
SCI_resetTxFIFO(SCIA_BASE);
SCI_resetRxFIFO(SCIA_BASE);
}
//
// End of file
//