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.

ARM Cortex-R4F RM48x MCU baud question

Other Parts Discussed in Thread: HALCOGEN

Hello


Use Hercules MCU for product development


Model ARM Cortex-R4F RM48


Found when baud is set to 1200, 2400, and 4800


Unable to receive


I would like to ask how to solve it.

  • Hello Willy,

    The SCI uses the 24-bit integer prescaler P value of BRSR register to select the required baud rates. If VCLK is 80MHz, the P values for 1200/2400/4800 baudrate are 4168/2082/1041.

    baudrate = VCLK /((P+1) *16)

    Please double check the frame format on your PC side
    1. start bit: 1
    2. data bit: 1 to 8
    3. stop bit: 0 to 2
    4. Parity: 0 or 1

    We don't support HW flow control.

    BTW, does other baudrate works: 9600, 115200, etc?
  • Hello

    When VCLK=110MHz
    I want to set the baud to 4800/2400/1200
    And how much should P value be set?
  • Hello Willy,

    If VCLK is 110MHz,

    For 4800 baudrate: p=110*10^6/(16*4800)-1 = 1431

    For 115200: p=110*10^6/(16*115200)-1 = 59

    For 1200: p=110*10^6/(16*1200)-1 = 5728

    TI has a code generation tool (HALCoGen) which can be used to generate lower level driver for TMS570/RMx devices. Here is the download side:

    http://www.ti.com/tool/HALCOGEN

  • 2061.HALCoGen04.05.02 selftest.zipHello QJ Wang

    I used the version of HalCoGen is 4.05.02.

    But when I want to use baud rate of 4800 and P value is set to 1431, I can only transfer data and cannot receive data.

    And the attach file is my HalCoGen project file.

  • Hi Willy,

    Please enable the RX interrupt and write a sciNotification() to read the RXed data:

    1. set RX interrupt: Check the RX interrupt under SCI/LIN Global
    2. enable SCI interrupt: check the VIM channel 13 (high level) and channel 27 (low level)
    3. In your main()

    unsigned char rxData[8];
    void main(){
    _enable_IRQ();
    sciInit();

    /** - Configure SCI to receive 8 bytes of Command information */
    sciReceive(scilinREG, 8, rxData);
    }

    add sciNotifcation():

    /** @fn void sciNotification(unsigned flags) */
    void sciNotification(sciBASE_t *sci, unsigned flags)
    {
    /** - Get ready to receive the next Command */
    sciReceive (scilinREG, 8, rxData);

    /** send rxData back to terminal */
    sciSend (scilinREG, 8, rxData);
    }
  • Hello QJ Wang

    I used this sub-function as below, and I used the version of HalCoGen is 4.05.02.

    void sciSetBaudrate(sciBASE_t *sci, uint32 baud)
    {
    float64 vclk = 110.000 * 1000000.0;
    uint32 f = ((sci->GCR1 & 2U) == 2U) ? 16U : 1U;
    uint32 temp;
    float64 temp2;

    temp = (f*(baud));
    temp2 = ((vclk)/((float64)temp))-1U;
    temp2 = floor(temp2 + 0.5); /* Rounding-off to the closest integer */
    sci->BRS = (uint32)((uint32)temp2 & 0x00FFFFFFU);
    }
    and this function OK for TX , Baudrate 115200/57600/38400....9600/4800/2400/1200
    but for RX 115200/57600/38400....9600 OK , 4800/2400/1200 not OK

    thanks
  • Hello Willy,

    Didn't you receive anything for 4800/2400/1200? or you received something but they are not correct?
    Can you share your code with me? Thanks
  • Hello QJ Wang

    I do not receive anything for baud rate set 4800/2400/1200.
    The code is as follows:

    void sciSetBaudrate(sciBASE_t *sci, uint32 baud)
    {
    float64 vclk = 110.000 * 1000000.0;
    uint32 f = ((sci->GCR1 & 2U) == 2U) ? 16U : 1U;
    uint32 temp;
    float64 temp2;

    temp = (f*(baud));
    temp2 = ((vclk)/((float64)temp))-1U;
    temp2 = floor(temp2 + 0.5);
    sci->BRS = (uint32)((uint32)temp2 & 0x00FFFFFFU);

    }

    And I try another method
    void sciSetBaudrate(sciBASE_t *sci, uint32 baud)
    {
    /** - set baudrate */
    scilinREG->BRS = 1431; /* pre-scale 1431 = 4800 pbs*/
    }

    But the same can't receive by baud rate set to 4800

    thanks

  • HI Willy,

    The code looks good to me. Please probed the RX signal using oscilloscope to make sure the transmitter sends data. Is the INTVCT0 or INVECT1 set or the RXRDY bit in FLG register set after the host transmits data to MCU? What is the value of SCIFLG?