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: SCI Communication

Part Number: TMS570LC4357

Iam  working  on  SCI  where   two SCI   send  and  receive  that  can  seen  through  dock light   application  one  SCI  i will connect   directly  through USB  from controller to  laptop  and  other  will be  connect   RS422  later  to  laptop  using  USB  . send  and  receive  is  happen, but  required   things  is  by  opening  two  separate  dock light , whatever i  send  through dock light  SCI1  will be  receive  and  display  in  second  dock light , vice verse   whatever send  through second  dock light  should  receive  and  display in  one  dock light  , i will attach my code also  kind help me to over come  from  this logic 

  • #include "HL_sys_common.h"
    #include "HL_sci.h"
    #include "stdlib.h"
    void UART_Func(void);
    void sciDisplayText(sciBASE_t *sci, uint8 *text,uint32 length);
    void wait(uint32 time);
    
    #define UART (sciREG1)
    #define UART1  (sciREG2)
    #define TSIZE 15U
    uint8  TEXT[TSIZE]= {'S','C','I','P','R','O','T','O','C','A','L','\n','\r'};
    uint8 u8First_Rec[];
     uint8 u8Second_Rec[];
    uint8 size1= 0U ;
    uint8 size2= 0U ;
    static unsigned char ucfirstRX_Data;
    static unsigned char ucsecondRX_Data;
    void sciDisplayText(sciBASE_t *sci, uint8 *text, uint32 length);
    void wait(uint32 time);
    
    
    int main(void)
    {
    /* USER CODE BEGIN (3) */
      sciInit();
        _enable_IRQ();
        sciEnableNotification(UART, (uint32) SCI_RX_INT);
        sciReceive(UART,1U,(unsigned char*) &uc_firstRX_Data);
        sciEnableNotification(UART1, (uint32) SCI_RX_INT);
        sciReceive(UART1,1U,(unsigned char*) &uc_secondRX_Data
    
    while(1)
    {
        if(size1!=0U)
            {
              sciDisplayText(UART1 , u8First_Rec,size1 );
            }
       if(size2!=0U)
           {
               sciDisplayText(UART , u8Second_Rec,size2 );
            }
       }
     }
    void sciDisplayText(sciBASE_t *sci, uint8 *text , uint32 length)
    {
      while (length--)
       {
         if(sci==UART)
          {
             while ((UART->FLR & 0x4) == 4U){}
             sciSendByte(UART, *text++);
          }
         if(sci== UART1)
          {
            while ((UART1->FLR & 0x4) == 4U);
            sciSendByte(UART1, *text++);
            }
         }
     }
    void sciNotification(sciBASE_t *sci, uint32 flags)
     {
            if(sci== UART)
            {
              sciReceive(UART, 1U, (unsigned char*) &uc_firstRX_Data);
              u8First_Rec[size1++]= uc_firstRX_Data;
            }
            if(sci == UART1)
            {
              sciReceive(UART1, 1U, (unsigned char*) &uc_secondRX_Data);
              u8Second_Rec[size2++]= uc_secondRX_Data;
            }
      }
    void wait(uint32 time)
    {
    while(time>0)
      {
        time--;
      }
    }
    

  • while(1)
    {
    if(size1!=0U)
    {
    sciDisplayText(UART1 , u8First_Rec,size1 );
    size1=0U;
    sciReceive(UART,1U,(unsigned char*)&u8First_Rec[0]);
    }
    if(size2!=0U)
    {
    sciDisplayText(UART , u8Second_Rec,size2 );
    size2=0U;
    sciReceive(UART1,1U,(unsigned char*)&u8Second_Rec[0]);
    }
    }
    }   sir  in  display  function  i  have  implemented  this  logic  will this  fine  to  work  , Tell me sir

  • sir  in  display  function  i  have  implemented  this  logic  will this  fine  to  work

    Yes, it is fine.