AnsweredAssumed Answered

STM32F429 UART7 Rx question

Question asked by Baev.Alexander on Sep 19, 2014
Latest reply on Sep 20, 2014 by Baev.Alexander

Hello friends.

I'm trying to communicate with DS18B20 via 1-wire interface.

Here is the example of reset function (all pins and clk are set erlier). The problem is that the variable data does not receive UART7 DR value. I use EWARM. I see that DR receives the response from the DS18B20. Is this some compiler options?

print_number (data) – prints 3 digit number on the LCD. In this function it is always 255, however data variable is unavailable in the watch window.

 

void ow_reset()

{

  USART_InitTypeDef USART_InitStructure;

  uint16_t data;

 

USART_InitStructure.USART_BaudRate = 9600;

USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

USART_InitStructure.USART_Parity = USART_Parity_No;

USART_InitStructure.USART_StopBits = USART_StopBits_1;

USART_InitStructure.USART_WordLength = USART_WordLength_8b;

USART_Init(UART7,&USART_InitStructure);

  USART_Cmd(UART7,ENABLE);

 

  USART_ClearFlag(UART7, USART_FLAG_TC);

  USART_SendData(UART7, 0xf0);

  data = USART_ReceiveData(UART7);

while(USART_GetFlagStatus(UART7, USART_FLAG_RXNE) == RESET);

  while (USART_GetFlagStatus(UART7, USART_FLAG_TC) == RESET);

  print_number (data);

}

 

 


Outcomes