1 Reply Latest reply on Oct 16, 2017 11:04 PM by anks

    PSOC UART - Mark/Space character sending

    user_176220371

      Hi all,

       

      I am going nuts with MDB serial communication, sending MARK/SPACE data. CPU clock is se to 24Mhz.

       

      I have an UART block, set to 9600 and no hw flow. 1 bit parity. I use the block only for sending. The problem that i'm facing that MARK is set on wrong characters which i trace on the line. If i CyDelay(100) it always works, but the problem arises when I want to sent characters in sequence:

       

      For example following code:

       

              UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_MARK);

              UART_MDB_SLAVE_TX_PutChar((uint8) 0x01); //

              UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_SPACE);

              UART_MDB_SLAVE_TX_PutChar((uint8) 0x02); //

              UART_MDB_SLAVE_TX_PutChar((uint8) 0x03); //

              UART_MDB_SLAVE_TX_PutChar((uint8) 0x04); //

       

                Puts mark on byte 0x03 ?! or sometimes 0x02...

       

      If i send 5 bytes

              UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_MARK);

              UART_MDB_SLAVE_TX_PutChar((uint8) 0x01); //

              UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_SPACE);

              UART_MDB_SLAVE_TX_PutChar((uint8) 0x02); //

              UART_MDB_SLAVE_TX_PutChar((uint8) 0x03); //

              UART_MDB_SLAVE_TX_PutChar((uint8) 0x04); //

              UART_MDB_SLAVE_TX_PutChar((uint8) 0x04); //

       

                Puts mark correctly on 0x01

       

       

      So am i getting this wrong somehow ? To me it looks random, if i send in a while loop:

      while(1)

      {

              UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_MARK);

              UART_MDB_SLAVE_TX_PutChar((uint8) 0x01); //

              UART_MDB_SLAVE_TX_SetTxAddressMode(UART_MDB_SLAVE_TX_SET_SPACE);

      }

       

      Mark is set ever 5 - 10th byte ?!

       

       

      What am i missing ?

      Please some help