I'm using S32cubeMX to create a project for a stm32L010; on a proprietary board we connected a SPI ST mems to USART2. I have 2 questions
1) I can't select MSBFIRST bit using standard HAL drivers.
2) it seems USART2 tx/rx lines have an internal shortcut
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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)
- Labels:
-
STM32CubeMX
-
STM32L0 Series
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-02 2:43 AM
I tried changing PA3(USART2TX) form AF to INPUT just before starting a read operation and now read operation is correct
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-02 5: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-02 7:25 AM
I forgot, I'm using L010RB LQF64
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-02 8: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-03 2:37 AM
I don't see anything suspicious here...
Read out and post the USART2 registers content.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-03 4: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-09-03 3:38 PM
I can't see anything suspicious here either.
Sorry but I have no more idea what could be wrong.
JW
