2020-09-02 12:40 AM
1) CubeMX create a usart type port, without opportunity to use UART_AdvFeatureConfig(); I implemented by myself the setting of MSBFIRST bit and works fine.
2) using USART2 in synchronous mode, on the read operation tx and rx lines are exactly equal and on both ones I get wrong voltage level on (using oscilloscope)
2020-09-02 12:49 AM
2. There are no internal shorts between pins (except on the SO-8 package - do you use such?). Check your board.
JW
2020-09-02 02:43 AM
I tried changing PA3(USART2TX) form AF to INPUT just before starting a read operation and now read operation is correct
2020-09-02 05:12 AM
I tested my board and I didn't find any shortcut; as I wrote in previous message, changing temporarily PA2(USART2TX) (sorry, i made a mistake in previous message) the RX line reaches the correct voltage levels and I'm able to read data correctly
2020-09-02 07:25 AM
I forgot, I'm using L010RB LQF64
2020-09-02 08:37 AM
What do you exactly mean by "read operation"?
Read out and check/post the USART and relevant GPIO registers content.
What are the hardware connections to the given pins?
JW
2020-09-02 11:57 PM
here a part of the schematics and reading code
cmd[0]=(IIS3DHHC_WHO_AM_I+IIS3DHHC_READ); // read who am i register
HAL_GPIO_WritePin( GPIOA, GPIO_PIN_1, GPIO_PIN_RESET); // enable /CS2
// HAL_USART_TransmitReceive(&husart2, cmd, type, 2, 100); // first try, uncorrect reading
HAL_USART_Transmit(&husart2, cmd, 1, 100); // second try, transmit, disable pin, receive, correct reading
disable_tx_usart2(); // set PA2 pin (uasrt2tx) to input mode
HAL_USART_Receive(&husart2, type, 1, 100); // read operation
HAL_GPIO_WritePin( GPIOA, GPIO_PIN_1, GPIO_PIN_SET);
enable_tx_usart2(); // set back PA2 pin to usart2tx
2020-09-03 02:37 AM
I don't see anything suspicious here...
Read out and post the USART2 registers content.
JW
2020-09-03 04:50 AM
here the the USART2 registers condition before and after tx/rx operation; as a 2nd byte is transmitted, in this case i wrote 0xff. If I write 0x00, RDR an TDR will be 00 in the second screenshot.
2020-09-03 03:38 PM
I can't see anything suspicious here either.
Sorry but I have no more idea what could be wrong.
JW