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.

CCS/TMS320F280049: C2000™ microcontrollers forum

Part Number: TMS320F280049
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
//

  • Dear Sir, We are looking into your request and will get back to you today.   Regards, Krishna

  • Dear Jie Liu,

    Please provide us with the following details, so we help you better.

    1. Describe the overall topology of your system, when it is not in loopback mode. That is,
    a. Describe what is transmitting?
    b. Describe what is receiving?
    c. Send us a block diagram if possible
    2. If both Tx and Rx systems are using 280049C, please send us the contents of the Flag Register (SCIFLR)
    from both systems.
    3. Please confirm that you have reviewed LIN Configurations section described in the TRM (excerpt below)
    27.3.5 LIN Configurations
    The following list details the configuration steps that software should perform prior to the transmission or reception of data in LIN mode...

    Cheers!
    Krishna
  • Dear Krishna Allam,
                      Thank you very much。
               1.  I use “LAUNCHXL-F280049C”board to test the code。
    config pin 100 and 83 as lin rx/tx。 I  left these two pins unconnectted outside the board。 
        
               2.
    SCIFLR 0x00000904 Flag Register [Memory Mapped]
    I use only one “LAUNCHXL-F280049C”board, send and recive is use pin 100 and 83。
     
    3.
    becase LINa is in sci mode,i read “27.2.4 SCI Configurations ” and follow the steps。

    27.2.4 SCI Configurations

  • Jie, 

    You said that when the target is configured for loopback mode, it works right? 

    When you are not in loopback mode, you are using two boards right?  They are connected to each other via pins 100 and 83. 

    Thanks,

    Krishna 

  • Dear Krishna Allam,
    1. yes,it works right in loopback mode. When LinaRegs.SCIGCR1.bit.LOOPBACK = 1;
    2. I use one board,left pins 100 and 83 unconnected . I just change code “LinaRegs.SCIGCR1.bit.LOOPBACK = 1;”
    to “LinaRegs.SCIGCR1.bit.LOOPBACK = 0;” . complie and excute the code,the MCU is loop in “while(LinaRegs.SCIFLR.bit.IDLE == 1);”
  • Jie,
    Please explain what you are trying to accomplish? You want to just transmit and not receive? What is your goal with one board in your SCI/LIN communication system?
    Regards,
    Krishna
  • Dear Krishna Allam,

                  I only have one “LAUCHXL F280049C” board . I use LINa as sci to communicate with pc.

    first, I config LINa/sci_mode as master,  it send one byte first. I will check the pin 83 with oscilloscope.

    next ,PC with a usb-sci cable will connect to the board,  i will use PC software to check the byte sent by  F280049C board.

    now it stop in fist step. i think the configration of LINa/sci_mode is wrong.

  • Hi Jie,

    Thanks for providing the additional details.  I recommend you get your transmit path (from the launchpad to PC) fully working first.  Please refer to Section 27.2.4.2.1 - Transmitting Data in Single-Buffer Mode in the TRM.

    The IDLE state is only relevant in receive mode.  You can remove this check for now.

    Setup the launchpad to continuously transmit some data to the PC.  Are you able to do this successfully?

    Once your transmit path is working, we debug the receive path.

    Cheers!

    Krishna

     

  •   Dear Krishna Allam,

                    I  do not check the idle status. LINa can send byte by byte, I check the the send pin,its ok。

    then i connect send pin to recieve pin,recieve do not work 。the RXRDY status is always 0。

    SCIFLR    0x00000004    Flag Register [Memory Mapped]    

    code is below。

        for(;;)
        {

            scia_xmit(LoopCount);

            while(1)
            {
                if(LinaRegs.SCIFLR.bit.TXRDY)
                {
                    LoopCount++;
                    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++;
            }
        }

  • Dear Jie Liu, 

    You initial message said that loop back mode works...but your previous message says that send is connected to receive and it does not work.  Can you please clarify. 

    Also, does the transmit from your PC connected to the C28x operational?

    Thanks,

    Krishna 

  •  Dear Krishna Allam,
          When LinaRegs.SCIGCR1.bit.LOOPBACK = 1;
          loopback mode works.
          lina can recieve byte.

          Then i set “LinaRegs.SCIGCR1.bit.LOOPBACK = 0;”
          1. lina can send byte,i check it by  oscilloscope.
          2. I connect “lina send pin” to “lina recieve pin” in  the same “LAUCHXL F280049C” board.
             DO NOT use usb-sci module or PC com software.
          3. lina can't recieve any byte. SCIFLR = 0x00000004.

  • Hi Jie Liu, 

    Can you please confirm that you have been able to resolve your problem.  Let us know if we can be of any further assistance.

    Cheers!

    Krishna

  • Dear Krishna Allam,

                     no, i have not resolved this problem.

  • now ,i find the problem,S6 need switch to up.