AnsweredAssumed Answered

UART3 won't send data

Question asked by turnewitsch.vance on Jul 29, 2014
Latest reply on Aug 1, 2014 by miroshnichenko.kiril
I'm using UART3 for RS-485 communications (I have a B&B RS-232 to RS-485 converter connected between the PC and the board). The trouble is that the UART3 won't "send" the data unless I put a debug break-point shortly after sending data via UART3. The data then sends fine. Without the break-point, the PC doesn't receive the data. Here is my function for sending data:

void send_485(uint8_t *ptr, uint8_t length)
{
  uint8_t i = 0;
     uint8_t count = _1s_counter;
  GPIO_WriteHigh(GPIOE, GPIO_PIN_4);
while(_1s_counter < count+5){}
  while (length-- > 0)
  {
    /* Wait while UART3 TXE = 0 */
    while (UART3_GetFlagStatus(UART1_FLAG_TXE) == RESET)
    {
    }
    UART3_SendData8((ptr[i++]));
  }
     count = _1s_counter;
    while (UART3_GetFlagStatus(UART1_FLAG_TXE) == RESET)
    {
    }
     while(_1s_counter < count + 1000){}
  GPIO_WriteLow(GPIOE, GPIO_PIN_4); // Put break-point on this line.
}     

Any ideas as to what the debugger does that makes the communication work? Adding that break-point, the bytes are received flawlessly.

Thanks,
Vance

Outcomes