Part Number: TMS320F280025C
Other Parts Discussed in Thread: C2000WARE
Tool/software:
Dear Sir,
I have an issue related to SCI communication: SCI Communication not working in standalone mode
1. The SCI communication works well after flashing the program (Setting: boot from flash/ Get Mode) in the TI F280025C with SCI interface of other MCU.
2. But after turning off and ON (reboot), the system's power. Then, SCI communication fails between TI F280025C MCU and other connected microcontrollers (Display: NX8048P050-011C-Y).
After restart the system other part of program working fine but SCI does not working.
The Program file is attached here
//
// Included Files
//
#include "driverlib.h"
#include "device.h"
// Globals
//
uint16_t frequency, measured_voltage;
float voltage, duty;
volatile uint16_t Data_Available = 0, Data_Available_TX=0 ;
//
// Send data for SCI-A
//
uint16_t tx_buffer[17];
//
// Received data for SCI-A
//
uint16_t rx_buffer[17];
//
// Function Prototypes
//
__interrupt void sciaTXFIFOISR(void);
__interrupt void sciaRXFIFOISR(void);
void initSCIAFIFO(void);
void error(void);
//
extern uint16_t RamfuncsLoadStart;
extern uint16_t RamfuncsLoadSize;
extern uint16_t RamfuncsRunStart;
// Main
//
void main(void)
{
//
// 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_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_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();
//
measured_voltage=123;
Interrupt_enable(INT_SCIA_RX);
Interrupt_enable(INT_SCIA_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)
{
asm(" ESTOP0"); // Test failed!! Stop!
for (;;);
}
//
// sciaTXFIFOISR - SCIA Transmit FIFO ISR
//
__interrupt void sciaTXFIFOISR(void)
{
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}
//
// sciaRXFIFOISR - SCIA Receive FIFO ISR
//
__interrupt void sciaRXFIFOISR(void)
{
//
//Parameters for transmit the VDC voltage to display
// measured_voltage = adcA7_VDC2_pu_avg*800;
tx_buffer[0] = 0x76;//(V)
tx_buffer[1] = 0x6f;//(o)
tx_buffer[2] = 0x6c;//(l)
tx_buffer[3] = 0x74;//(t)
tx_buffer[4] = 0x2E;//(.)
tx_buffer[5] = 0x74;//(t)
tx_buffer[6] = 0x78;//(x)
tx_buffer[7] = 0x74;//(t)
tx_buffer[8] = 0x3D;//(=)
tx_buffer[9] = 0x22;//(")
tx_buffer[10] = ((measured_voltage/100)+0x30);//(Voltage)
tx_buffer[11] = (((measured_voltage%100)/10)+0x30);//(Voltage)
tx_buffer[12] = ((measured_voltage%10)+0x30);//(Voltage)
tx_buffer[13] = 0x22;//(")
tx_buffer[14] = 0xFF;
tx_buffer[15] = 0xFF;
tx_buffer[16] = 0xFF;
//end transmit the VDC voltage to display
// Enable the TXFF interrupt again.
//
// Receive 17 Byte in Uart ISR
SCI_readCharArray(SCIA_BASE, rx_buffer, 17);
//If the First Byte is Ox65, then move data in an actual variable from the Receive Buffer
if (rx_buffer[0] == 0x65)
{
voltage = (((rx_buffer[7] - 0x30) * 100) + ((rx_buffer[8] - 0x30) * 10) + (rx_buffer[9] - 0x30));
frequency = (((rx_buffer[12] - 0x30) * 100) + ((rx_buffer[13] - 0x30) * 10) + (rx_buffer[14] - 0x30));
duty=(((rx_buffer[15] - 0x30)*10) + (rx_buffer[16] - 0x30));
}
// }
SCI_writeCharArray(SCIA_BASE, tx_buffer, 17);
// Clear the SCI RXFF interrupt and acknowledge the PIE interrupt.
//
SCI_clearOverflowStatus(SCIA_BASE);
SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_RXFF);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}
//
// initSCIAFIFO - Configure SCIA FIFO
//
void initSCIAFIFO()
{
//
// 8 char bits, 1 stop bit, no parity. Baud rate is 9600.
//
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
//
Regards
Ajeet