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.

TMS320F28375S: SCI- Communication is not happening in Custom Board(F28375S )

Part Number: TMS320F28375S

Hi,

  Using Custom Board TMS320F28375S , Working with f28375S example SCI Loop back interrupt code but i couldn't communicate it .Previously i had used LauncpadXl-F28379D for that i have used for SCI Communication "_LAUNCHXL_F28379D" As a predefined symbol.

 

So , I have tried with "_LAUNCHXL_F28375S " &"_LAUNCHXL_F28377S" as predefined symbol , but its not works ...

Is there any configuration methods for SCI -Communication in TMS320F28375S  controller ?

when i have checked with transmit pin in logic analyzer, its show always high ..

  

The code below i have Checked :

//
// Included Files
//
#include "driverlib.h"
#include "device.h"

//
// Defines
//
// Define AUTOBAUD to use the autobaud lock feature
//#define AUTOBAUD

//
// Globals
//
uint16_t loopCounter = 0;

//
// Main
//
void main(void)
{
    uint16_t receivedChar;
    unsigned char *msg;
    uint16_t rxStatus = 0U;

    //
    // Configure PLL, disable WD, enable peripheral clocks.
    //
    Device_init();

    //
    // Disable pin locks and enable internal pullups.
    //
    Device_initGPIO();

    //
    // Configuration for the SCI Rx pin.
    //
    GPIO_setMasterCore(71, GPIO_CORE_CPU1);
    GPIO_setPinConfig(DEVICE_GPIO_CFG_SCIRXDA);
    GPIO_setDirectionMode(71, GPIO_DIR_MODE_IN);
    GPIO_setPadConfig(71, GPIO_PIN_TYPE_STD);
    GPIO_setQualificationMode(71, GPIO_QUAL_ASYNC);

    //
    // Configuration for the SCI Tx pin.
    //
    GPIO_setMasterCore(70, GPIO_CORE_CPU1);
    GPIO_setPinConfig(DEVICE_GPIO_CFG_SCITXDA);
    GPIO_setDirectionMode(70, GPIO_DIR_MODE_OUT);
    GPIO_setPadConfig(70, GPIO_PIN_TYPE_STD);
    GPIO_setQualificationMode(70, GPIO_QUAL_ASYNC);

    //
    // Initialize interrupt controller and vector table.
    //
    Interrupt_initModule();
    Interrupt_initVectorTable();

    //
    // Initialize SCIA and its FIFO.
    //
    SCI_performSoftwareReset(SCIB_BASE);

    //
    // Configure SCIA for echoback.
    //
    SCI_setConfig(SCIB_BASE, DEVICE_LSPCLK_FREQ, 9600, (SCI_CONFIG_WLEN_8 |
                                                        SCI_CONFIG_STOP_ONE |
                                                        SCI_CONFIG_PAR_NONE));
    SCI_resetChannels(SCIB_BASE);
    SCI_resetRxFIFO(SCIB_BASE);
    SCI_resetTxFIFO(SCIB_BASE);
    SCI_clearInterruptStatus(SCIB_BASE, SCI_INT_TXFF | SCI_INT_RXFF);
    SCI_enableFIFO(SCIB_BASE);
    SCI_enableModule(SCIB_BASE);
    SCI_performSoftwareReset(SCIB_BASE);

#ifdef AUTOBAUD
    //
    // Perform an autobaud lock.
    // SCI expects an 'a' or 'A' to lock the baud rate.
    //
    SCI_lockAutobaud(SCIB_BASE);
#endif

    //
    // Send starting message.
    //
    msg = "\r\n\n\nHello World!\0";
    SCI_writeCharArray(SCIB_BASE, (uint16_t*)msg, 17);
    msg = "\r\nYou will enter a character, and the DSP will echo it back!\n\0";
    SCI_writeCharArray(SCIB_BASE, (uint16_t*)msg, 62);

    for(;;)
    {
        msg = "\r\nEnter a character: \0";
        SCI_writeCharArray(SCIB_BASE, (uint16_t*)msg, 22);

        //
        // Read a character from the FIFO.
        //
        receivedChar = SCI_readCharBlockingFIFO(SCIB_BASE);

        rxStatus = SCI_getRxStatus(SCIB_BASE);
        if((rxStatus & SCI_RXSTATUS_ERROR) != 0)
        {
            //
            //If Execution stops here there is some error
            //Analyze SCI_getRxStatus() API return value
            //
            ESTOP0;
        }

        //
        // Echo back the character.
        //
        msg = "  You sent: \0";
        SCI_writeCharArray(SCIB_BASE, (uint16_t*)msg, 13);
        SCI_writeCharBlockingFIFO(SCIB_BASE, receivedChar);

        //
        // Increment the loop count variable.
        //
      
    }
}

//
// End of File
//


Thanks & Regards,

Rani

  • Hi Ajay,

    When you say "custom board" did you design it yourself and modeled it after the F28377S? If so, there might be something in hardware going on preventing you from establishing the communication. I would double check with the LAUNCHXL_F28377S schematic and make sure everything is correct there.

    If you run the 'sci_ex2_loopback_interrupts" example does that work for you? This is using internal loopback mode so its a good way to make sure your SCI module is still functional.

    Also, when you run "sci_ex3_echoback" example" what do you see when you open up a terminal window?

    Best Regards,

    Marlyn

  • Dear Marlyn,

     we checking with respect to  reply,    please find our custom board circuit below , we directly connected F28375S  SCI_B pins to jumper pin(JP_12 and JP13) and we checking loopback program not working..... so We tried LED on / off GPIO 70 and 71.. its working..

    but with respect to last reply sci example loop back  program which we are attached is not working..

    Kindly guide us project setting

     Regards

    Rani

  • Hi Rani,

    When you tried the sci_ex2_loopback_interrupts' example did you modify anything in the code? Does it just result in a data mismatch error or how do you know it does not work?

    Looking at the configuration code you attached a bit closer I see that you configured the SCI pins below,

     GPIO_setPinConfig(DEVICE_GPIO_CFG_SCIRXDA);  
     GPIO_setPinConfig(DEVICE_GPIO_CFG_SCITXDA);

    DEVICE_GPIO_CFG_SCIRXDA actually maps to 'GPIO_28_SCIRXDA' and DEVICE_GPIO_CFG_SCITXDA maps to 'GPIO_29_SCITXDA'. 

    Instead can you please try to set the pin configuration in the following way,

    GPIO_setPinConfig(GPIO_71_SCIRXDB)
    GPIO_setPinConfig(GPIO_70_SCITXDB)

    Best Regards,

    Marlyn

  • Marlyn,

    Marlyn Rosales Castaneda20 said:
    When you tried the sci_ex2_loopback_interrupts' example did you modify anything in the code? Does it just result in a data mismatch error or how do you know it does not work?

    .

      Now loop back is working fine . When I am communicate with external device getting "framing error" in logic analyzer .

     We are using Oscillator as 20Mhz for that changed in device .h file

    Then I have added in _LAUNCHXl_F28377S in predefined symbol. but we using TMS320F28375S for our custom board ... any configuration require for 176pin..

     How to set low speed clock pre scalar value properly?

      

    one more doubt , Without using external crystal oscillator can do communication process (Example using System clock(200mhz))?

    how to configure the using only system clock  for communication Process?

     I think so Frequency mismatching is happen . I couldn't find out can you help me to sort out this problem.

    Thanks & Regards,

    Rani

  • Hi Rani,

    I see on the screenshot you attached that you changed DEVICE_OSCSRC_FREQ to have a frequency of 20000000U,

    However, DEVICE_SYSCLK_FREQ is still defined as ((DEVICE_OSCSRC_FREQ * 40 * 1) / 2) which will give you 400MHz,

    You need the following configuration for your 20MHz oscillator:

    //
    // 20MHz XTAL. For use with SysCtl_getClock().
    //
    #define DEVICE_OSCSRC_FREQ          20000000U
    
    //
    // Define to pass to SysCtl_setClock(). Will configure the clock as follows:
    // PLLSYSCLK = 20MHz (XTAL_OSC) * 20 (IMULT) * 1 (FMULT) / 2 (PLLCLK_BY_2)
    //
    #define DEVICE_SETCLOCK_CFG         (SYSCTL_OSCSRC_XTAL | SYSCTL_IMULT(20) |  \
                                         SYSCTL_FMULT_NONE | SYSCTL_SYSDIV(2) |   \
                                         SYSCTL_PLL_ENABLE)
    
    //
    // 200MHz SYSCLK frequency based on the above DEVICE_SETCLOCK_CFG. Update the
    // code below if a different clock configuration is used!
    //
    #define DEVICE_SYSCLK_FREQ          ((DEVICE_OSCSRC_FREQ * 20 * 1) / 2)

    The above configuration is actually the default one if you do not define _LAUNCHXL_F28377S. Try setting the above configuration and see if that works.

    Ajay S said:
     How to set low speed clock pre scalar value properly?

    In your main() function within the sample projects there is a 'Device_init()' function. Within that function you can change your low speed clock prescalar

        //
        // Make sure the LSPCLK divider is set to the default (divide by 4)
        //
        SysCtl_setLowSpeedClock(SYSCTL_LSPCLK_PRESCALE_4);

    Ajay S said:
    Without using external crystal oscillator can do communication process (Example using System clock(200mhz))?

    Yes, you can choose your clk source through the CLKSRCCTL1 register. For example, the code above chose 'SYSCTL_OSCSRC_XTAL' but there are other options such as 'SYSCTL_OSCSRC_OSC1', check in sysctl.h

    Best Regards,

    Marlyn

  • Marlyn,

       

    Marlyn Rosales Castaneda20 said:
    Yes, you can choose your clk source through the CLKSRCCTL1 register. For example, the code above chose 'SYSCTL_OSCSRC_XTAL' but there are other options such as 'SYSCTL_OSCSRC_OSC1', check in sysctl.h

    Instead of SYSCTL_OSCSRC_OSC1 used  SYSCTL_OSCSRC_OSC2  . For SCI communication can I use OSC2?

    #define DEVICE_SETCLOCK_CFG         (SYSCTL_OSCSRC_OSC2  | SYSCTL_IMULT(38) |  \
                                        SYSCTL_FMULT_3_4 | SYSCTL_SYSDIV(2) |   \
                                         SYSCTL_PLL_ENABLE)
      

    Thanks & Regards,

    Rani

  • Rani,

    Ajay S said:
    Instead of SYSCTL_OSCSRC_OSC1 used  SYSCTL_OSCSRC_OSC2  . For SCI communication can I use OSC2?

    You may, but note that this is not just setting the frequency that will go through the LSP divider and eventually be the LSPCLK for the SCI, it is setting up SYSCLK for your device. Please take a look at the diagram below.

    Did you try the configuration I showed in my last reply?

    Best Regards,

    Marlyn

  • Marlyn,

    Marlyn Rosales Castaneda20 said:
    Did you try the configuration I showed in my last reply?

      Yes ,tried but it doesn't work.

    Marlyn Rosales Castaneda20 said:
    but note that this is not just setting the frequency that will go through the LSP divider and eventually be the LSPCLK for the SCI, it is setting up SYSCLK for your device. Please take a look at the diagram below.

    I not am sure my understanding is correct ... OSC1, OSC2 ,XTAL everything works same in setting up SYSCLK,LSPCLK from this diagram .

    It may varies in application wise given in the table ...

    I have configured OSC2 with reference to TRM.


    #define DEVICE_SETCLOCK_CFG         (SYSCTL_OSCSRC_OSC2  | SYSCTL_IMULT(38) |  \
                                        SYSCTL_FMULT_3_4 | SYSCTL_SYSDIV(2) |   \
                                         SYSCTL_PLL_ENABLE)

    How to configure OSC1?  (SYSCTL_IMULT,  SYSCTL_FMULT_3_4).

    Thanks & Regards,

    Rani

  • Hi Rani,

    Ajay S said:
    Yes ,tried but it doesn't work.

    Are you still getting the framing error? Would it be possible to check what your baud rate is through an oscilloscope?

    Ajay S said:
    How to configure OSC1?  (SYSCTL_IMULT,  SYSCTL_FMULT_3_4).

     

    You have configured OSC2 correctly based on what you provided. To configure OSC1 it would be the same configuration (they are both 10MHz), just swap 'SYSCTL_OSCSRC_OSC2' for 'SYSCTL_OSCSRC_OSC1'.

    Best Regards,

    Marlyn

  • Marlyn,

       

    Marlyn Rosales Castaneda20 said:
    You have configured OSC2 correctly based on what you provided. To configure OSC1 it would be the same configuration (they are both 10MHz), just swap 'SYSCTL_OSCSRC_OSC2' for 'SYSCTL_OSCSRC_OSC1'.

      Thanks,OSC1 and OSC2 are working fine .

    Marlyn Rosales Castaneda20 said:
    Are you still getting the framing error? Would it be possible to check what your baud rate is through an oscilloscope?

     From controller to Logic analyzer Communication is works fine . If i am use OSC1 and OSC2 there is no problem at all.

    But after RS485 module am getting wrong data ..

    When I am work  same code  and  RS485 Module with Launchpad F28379D works fine ..

    Only difference is Oscillator , in launchpad using XTAL  ,  custom board working with OSC1 / OSC2 ...

    In launchpad F28379D if I am use OSC1/ OSC2 getting ESTOP error in device .c file , after force debugging (three times pressing the run button)code runs fine getting output at RS485 module side also .. Using XTAL  doesnt get this ESTOP error any more.

    May oscillator affect this communication ? please suggest me to any mistake have done in choosing oscillator for communication process.

    Can I go with OSC1/ OSC2 for communication( SCI) process to outside device  ?

    Thanks & Regards,

    Rani

  • Rani,

    I see on your last screenshot that you commented out the XTAL portion. Was this what you used to select the XTAL? If so, what is your DEVICE_OSCSRC_FREQ? For an XTAL of 20MHz the bellow code should work:

    #define DEVICE_OSCSRC_FREQ          20000000U
    
    //
    // Define to pass to SysCtl_setClock(). Will configure the clock as follows:
    // PLLSYSCLK = 20MHz (XTAL_OSC) * 20 (IMULT) * 1 (FMULT) / 2 (PLLCLK_BY_2)
    //
    #define DEVICE_SETCLOCK_CFG         (SYSCTL_OSCSRC_XTAL | SYSCTL_IMULT(20) |  \
                                         SYSCTL_FMULT_NONE | SYSCTL_SYSDIV(2) |   \
                                         SYSCTL_PLL_ENABLE)
    
    //
    // 200MHz SYSCLK frequency based on the above DEVICE_SETCLOCK_CFG. Update the
    // code below if a different clock configuration is used!
    //
    #define DEVICE_SYSCLK_FREQ          ((DEVICE_OSCSRC_FREQ * 20 * 1) / 2)

    If you are unable to get it to work using the XTAL configuration above then it might be due to the tolerance level of your specific oscillator. If the frequency deviates too much from 20MHz then this could affect your communication as the baud rate is ultimately derived from the fact that your clocking source is 20MHz.

    Ajay S said:
    Can I go with OSC1/ OSC2 for communication( SCI) process to outside device  ?

    Can you please elaborate on this question? Using OSC1/OSC2 should be fine. 

    Best Regards,

    Marlyn

  • Marlyn,

     

    OSC1/OSC2 are working well , Thanks for timely guidance.

    Thanks & Regards,

    Rani