Skip to main content
sak hos
Associate II
June 18, 2017
Question

rs485 communication between stm32f103 and a pc

  • June 18, 2017
  • 2 replies
  • 3395 views
Posted on June 18, 2017 at 20:04

Hello,

i'm using stm32f103c8t6 in order to send data to my PC using RS485 (max485) and an USB/RS485 adapter , i made the right connection between components and i used uart to send the data to the max485 and i tried to check the data at reception using a hyperterminal and i found that i'm not receiving the correct data.

is there some special configuation to do to uart in order to communication with the max485 (data length , stop bit ...)

thank you 

#rs485
    This topic has been closed for replies.

    2 replies

    LMI2
    Senior III
    June 18, 2017
    Posted on June 18, 2017 at 20:19

    What I know the RS485 is just a quite simple level shifter. What are you trying to send, Ints or Floats or bytes. Then there is the full duplex and half duplex. Have you terminated the receiving end.

    I have just spent some 'quality time' with RS485 connection, and it works. But you must connect it correctly. Have your PC and controller a common ground. Maxim probably has application notes and such for RS485 and Max485.

    Edit: Do you know that you can connect your MAX chip for local echo. That is RX+ to TX+ and so on. At least it worked with my chip and helped knowing where the trouble was (in wiring).

    sak hos
    sak hosAuthor
    Associate II
    June 18, 2017
    Posted on June 18, 2017 at 20:33

    i declared as information to send a uint8_t with a value 0x22 or 0xBB

    i'm using half dubplex and i putted DE and RE to High level (to use max485 as transmitter ) i added a picture of my RS485/USB adaptaer, it's small circuit wich use a MAX485 and CH340G

    thank you for the reply0690X00000603t8QAA.jpg

    Tesla DeLorean
    Guru
    June 18, 2017
    Posted on June 18, 2017 at 21:02

    The settings would need to be coherent.

    Send a stream of 'U' characters, review the signalling on the scope, verify the bit timings,etc.

    Make sure the HSE, HSE_VALUE, and PLL setting are correct, and that you can verify the clocks with a scope.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..