Other Parts Discussed in Thread: LAUNCHXL-F280049C
Tool/software: Code Composer Studio
Hello,
I am using 280049C, I want LINa work in sci mode.
when i test LOOPBACK , it works. when i try to disable loopback,the mcu is always waiting for IDLE.
code is stoped in the line “while(LinaRegs.SCIFLR.bit.IDLE == 1);”
code is bellow.
// // Included Files // #include "F28x_Project.h" #include "f28004x_pinmux.h" // // Defines // //#define DEVICE_GPIO_PIN_LED1 31 // // Function Prototypes // void SetupSCI(void); void error(void); void scia_xmit(char Char); void scia_msg(char *msg); // // Globals // Uint16 LoopCount; Uint16 ReceivedChar; // // Main // void main(void) { // // Initialize device clock and peripherals // InitSysCtrl(); // // Initialize GPIO and configure the GPIO pin as a push-pull output // //InitGpio(); // GPIO_SetupPinMux(DEVICE_GPIO_PIN_LED1, GPIO_MUX_CPU1, 0); // GPIO_SetupPinOptions(DEVICE_GPIO_PIN_LED1, GPIO_OUTPUT, GPIO_PUSHPULL); GPIO_setPinMuxConfig(); // // Initialize PIE and clear PIE registers. Disables CPU interrupts. // DINT; InitPieCtrl(); IER = 0x0000; IFR = 0x0000; // // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // InitPieVectTable(); // // Initialize and Enable BLIN SCI module // SetupSCI(); // // Enable Global Interrupt (INTM) and realtime interrupt (DBGM) // EINT; ERTM; EALLOW; LinaRegs.SCIFLR.bit.IDLE=0; // DELAY_US(1); LoopCount = 0; // // Wait for SCI to be idle and ready for transmission // while(LinaRegs.SCIFLR.bit.IDLE == 1); { } for(;;) { scia_xmit(LoopCount); // // Wait for a character to by typed // while(LinaRegs.SCIFLR.bit.RXRDY == 0); { } ReceivedChar = LinaRegs.SCIRD.bit.RD; //scia_xmit(ReceivedChar); LoopCount++; } } //////////// // // scia_xmit - // void scia_xmit(char Char) { // // Wait for the module to be ready to transmit // while(LinaRegs.SCIFLR.bit.TXRDY == 0); // // Begin transmission // LinaRegs.SCITD.bit.TD = Char; } // // scia_msg - // void scia_msg(char *msg) { int it; it = 0; while(msg[it] != '\0') { scia_xmit(msg[it]); it++; } } // // SetupSCI - // void SetupSCI(void) { // // Allow write to protected registers // EALLOW; LinaRegs.SCIGCR0.bit.RESET = 0; // Into reset // DELAY_US(1); LinaRegs.SCIGCR0.bit.RESET = 1; // Out of reset // DELAY_US(1); LinaRegs.SCIGCR1.bit.SWnRST = 0; // Into software reset // DELAY_US(1); // // SCI Configurations // LinaRegs.SCIGCR1.bit.COMMMODE = 0; // Idle-Line Mode LinaRegs.SCIGCR1.bit.TIMINGMODE = 1; // Asynchronous Timing LinaRegs.SCIGCR1.bit.PARITYENA = 0; // No Parity Check LinaRegs.SCIGCR1.bit.PARITY = 0; // Odd Parity LinaRegs.SCIGCR1.bit.STOP = 0; // One Stop Bit LinaRegs.SCIGCR1.bit.CLK_MASTER = 1; // Enable SCI Clock LinaRegs.SCIGCR1.bit.LINMODE = 0; // SCI Mode LinaRegs.SCIGCR1.bit.SLEEP = 0; // Ensure Out of Sleep LinaRegs.SCIGCR1.bit.MBUFMODE = 0; // No Buffers Mode LinaRegs.SCIGCR1.bit.LOOPBACK = 0; // External Loopback LinaRegs.SCIGCR1.bit.CONT = 1; // Continue on Suspend LinaRegs.SCIGCR1.bit.RXENA = 1; // Enable RX LinaRegs.SCIGCR1.bit.TXENA = 1; // Enable TX LinaRegs.SCIPIO0.bit.RXFUNC =1; LinaRegs.SCIPIO0.bit.TXFUNC =1; // // Ensure IODFT is disabled // LinaRegs.IODFTCTRL.bit.IODFTENA = 0x0; // // Set transmission length // LinaRegs.SCIFORMAT.bit.CHAR = 7; //Eight bits LinaRegs.SCIFORMAT.bit.LENGTH = 0; //One byte // // Set baudrate // LinaRegs.BRSR.bit.SCI_LIN_PSL = 194; //Baud = 9.6khz LinaRegs.BRSR.bit.M = 5; DELAY_US(1); LinaRegs.SCIGCR1.bit.SWnRST = 1; //bring out of software reset // // Disable write to protected registers // EDIS; } // // error - Error checking // void error(void) { __asm(" ESTOP0"); // Test failed!! Stop! for (;;); } // // End of File //