cancel
Showing results for 
Search instead for 
Did you mean: 

stm32l476rg with SN65HVD11P IC Transciever and AMT21 Encoder

AaravD356
Associate

Hi all,

I'm working on a project involving UART communication over RS-485 between an STM32 Nucleo board and a rotary encoder. I'd appreciate any advice or insights on whether my hardware and firmware setup looks correct, and what to check next to ensure reliable communication. 

Board: STM32 Nucleo-L476RG
Encoder: 6-pin rotary encoder with the following pinout:

  • Pin 1: 5V

  • Pin 2: B

  • Pin 3: A

  • Pin 4: GND

  • Pin 5: MODE

  • Pin 6: MCLR

RS-485 Transceiver: MAX485-compatible module

  • RO (Receiver Out) → PA10 (USART1_RX)

  • DI (Driver In) → PA9 (USART1_TX)

  • RE (Receiver Enable) → PB3

  • DE (Driver Enable) → PB4

  • VCC: 3.3V (from Nucleo 3.3V)

  • GND: common with Nucleo and encoder

  • A ---> Encoder Pin A
  • B ---> Enocder Pin B

PC Interface:

  • I'm using a USB cable from the laptop to the Nucleo, which powers the board and also uploads code.

  • USART2 is used for debug printouts via USB virtual COM port (seen in PuTTY).

  • USART1 is used for RS-485 communication

  • AaravD356_0-1746461833432.png

     

I believe my issue is in the software. How do I get communication?

Here are the datasheets:

Encoder: https://www.sameskydevices.com/product/resource/amt21.pdf

Transciever: https://www.ti.com/lit/ds/symlink/sn65hvd11.pdf?HQS=dis-dk-null-digikeymode-dsf-pf-null-wwe&ts=1746316269944&ref_url=https%253A%252F%252Fwww.ti.com%252Fgeneral%252Fdocs%252Fsuppproductinfo.tsp%253FdistId%253D10%2526gotoUrl%253Dhttps%253A%252F%252Fwww.ti.com%252Flit%252Fgpn%252Fsn65hvd11

 

1 REPLY 1
Peter BENSCH
ST Employee

Welcome @AaravD356, to the community!

At first glance, the hardware configuration looks OK. Do you have termination resistors on both sides of the RS-485 line?

We can only say something about the firmware once you have added at least a few lines of code.

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Announcement

We’re moving the ST Community to a new platform to give you a better and more reliable community experience.