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.

TMS570LS3137: SCI Baudrate Issue

Part Number: TMS570LS3137
Other Parts Discussed in Thread: PROFIBUS, HALCOGEN

Hello everyone,

I developing an appliacation for profibus. TMS570 microcontroller send to profibus command to profibus transciver via UART(SCI).

We need to set the baud rate to 1.5Mbps. But I can't setting this speed for baud.

Our clock frequency(Vclk) is 90Mhz.

I calculated baud rate with this formula.

For prescaler=3

Baud rate is 1.4Mbps

For prescaler=2

Baud rate is 1.8Mbps

I can't get 1.5. Therefor receiver device can not understand our profibus messages.

Because of that I need to configure to baudrate with fractional. However, it never changes my Tx signal when I use the fractional divider selection bits(M).

On the other hand, I don't understand why the value of the M bit is between 0-3h? Isn't it 3 bits?

My goal is to set the baud rate to 1.5Mbps without making any changes to Vclk. Because I can set the baud rate to 1.5Mbps when Vclk=50Mhz.

I can follow the baud rate with oscilloscope.

  • Hi Ali,

    Which SCI you are using?

    Are you using direct SCI or SCI/LIN?

    If you are using direct SCI then we don't have fractional divider in its baudrate, you can just verify the BRS register in the SCI registers:

    As you can see here there is no M and 24 to 31 bits are reserved. Only P value is used in the formula, which is calling as "Baud".

    If you are using SCI/LIN, then only we have fractional adjuster M will also present in the formula. You can confirm the same by verifying BRS register in SCI/LIN

    If you use this then we will get 15 additional intermediate values in between 1.4 and 1.8Mbps because M value is 4bit.

     .

    If you are using direct SCI then it is not possible to get this intermediate values and the only way is to adjust vclk.

    (+) TMS570LC4357: BSR baud rate register - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    --
    Thanks & Regards,
    Jagadish.

  • Hi Jagadish,

    So sciREG doesn't have M fractional control bits? Have I got this right?

    Thanks

  • Hi Ali,

    So sciREG doesn't have M fractional control bits? Have I got this right?

    You are right. 

    sciREG doesn't have M fractional control and only scilinREG have M fractional control.

    --
    Thanks & regards,
    Jagadish.

  • Hi,

    I completely understand thank you.

    But I have two new problem for now.

    First of all I configured Vclk setting as following:

    When I set the Vclk to 0, program not run on microprocessor. I did debugging but it can't enter the main function. There is no change after throwing code. Is Vclk not compliatable with 0?

    Second question: I changed Vlck with 100Mhz and baudrate with 1.5Mpbs.

    When I send a message through SCI I can see the message completely. There are no problems

    But when I changed send command to receive command, the processor gets stuck on a certain command. I can't continue to debug

    Look like step by step.

    Starting without any problem:

    I pressed step into:

    The next step:

    I pressed the step into button. The debugger stays here. There's been no progress.

    Why? I don't understand this

    All of the codes following:

    /** @file sys_main.c 
    *   @brief Application main file
    *   @date 11-Dec-2018
    *   @version 04.07.01
    *
    *   This file contains an empty main function,
    *   which can be used for the application.
    */
    
    /* 
    * Copyright (C) 2009-2018 Texas Instruments Incorporated - www.ti.com 
    * 
    * 
    *  Redistribution and use in source and binary forms, with or without 
    *  modification, are permitted provided that the following conditions 
    *  are met:
    *
    *    Redistributions of source code must retain the above copyright 
    *    notice, this list of conditions and the following disclaimer.
    *
    *    Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in the 
    *    documentation and/or other materials provided with the   
    *    distribution.
    *
    *    Neither the name of Texas Instruments Incorporated nor the names of
    *    its contributors may be used to endorse or promote products derived
    *    from this software without specific prior written permission.
    *
    *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    *
    */
    
    
    /* USER CODE BEGIN (0) */
    #include "sci.h"
    #include "het.h"
    #include "gio.h"
    /* USER CODE END */
    
    /* Include Files */
    
    #include "sys_common.h"
    
    /* USER CODE BEGIN (1) */
    /* USER CODE END */
    
    /** @fn void main(void)
    *   @brief Application main function
    *   @note This function is empty by default.
    *
    *   This function is called after startup.
    *   The user can use this function to implement the application.
    */
    
    /* USER CODE BEGIN (2) */
    /* USER CODE END */
    
    uint8	emacAddress[6U] = 	{0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU};
    uint32 	emacPhyAddress	=	0U;
    
    int main(void)
    {
    /* USER CODE BEGIN (3) */
        int i;
    
        sciInit();
        hetInit();
        gioInit();
    
        uint8_t data[254] = {0xDA};
        uint8_t token[254] = {0xDC, 0x22, 0x22};
        uint8_t rxbuffer[254];
        gioSetBit(gioPORTA, 0, 1);
        gioSetBit(hetPORT1, 1, 1);
        gioSetBit(hetPORT1, 7, 1);
    
        while(1)
        {
            //sciSend(sciREG, 6, data);
            //for(i = 0; i<100000; i++) ;
            //sciSend(sciREG, 3, token);
            sciReceive(sciREG, 1, rxbuffer);
            for(i = 0; i<100000; i++) ;
        }
    /* USER CODE END */
    
        return 0;
    }
    
    
    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    

  • Hi Ali,

    When I set the Vclk to 0, program not run on microprocessor. I did debugging but it can't enter the main function. There is no change after throwing code. Is Vclk not compliatable with 0?

    You can configure 0 but if you configure "0" means then the output frequency should be less than or equal to 110Mhz.

    Are you make sure to configure vclk1 frequency less than or equal to 110Mhz?

    Second question: I changed Vlck with 100Mhz and baudrate with 1.5Mpbs.

    When I send a message through SCI I can see the message completely. There are no problems

    But when I changed send command to receive command, the processor gets stuck on a certain command.

    Let me test this condition.

    --
    Thanks & regards,
    Jagadish.

  • Hi Ali,

    Just now i tested your code and i don't see any issues at my end.

    I am attaching my code for your reference, please do verify.

    SCI_1_5Mbps_Baudrate_Test_LS3137.zip

    My suggestion would be, just do a clean build and test it again.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    I tested your code, it works for me. I think some of my halcogen settings are different from yours.

    I'm analysing it. I hope to solve it.

    You can configure 0 but if you configure "0" means then the output frequency should be less than or equal to 110Mhz.
    When I set the Vclk to 0, program not run on microprocessor. I did debugging but it can't enter the main function. There is no change after throwing code. Is Vclk not compliatable with 0?

    Yes you're right. Vlck greater than 110.

    Thank of all.

    Have a nice day.

    Best regards.