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.

TMS570LC4357: TMS570LC4357 Serial Communication Problem

Part Number: TMS570LC4357

Hi,

I would like to send hexadecimal data to serial port in CCS, however I couln't achieve it. I cannot send hex data, eventhough I can do  it for the string. 

Basically, I use the codes below:

uint8* TEXT1[1]= {0x05};

#define UART sciREG1

int main(void){

 sciInit();

 while (1){

       sciSendByte(UART, &TEXT1[0]);

}

And I see "p" on terminal. Any reply would be appreciated.

Regards.

  • Hello,

    You nee to convert string to integer based on ASCII table first:


    void UART_send32BitData(sciBASE_t *sci, uint32_t data)
    {
         uint8_t c_get ;
         volatile int i = 0;
         for (i = 8 ; i > 0 ; i--)
         {
              c_get = (data >> 28) & 15 ;


              if (c_get > 9)
                  c_get += 7 ;

              c_get += 48 ;

              while ((sci->FLR & SCI_TX_INT) == 0) { /* wait */ };

              sci->TD = c_get;
              data = data << 4 ;
          }
    }