UART/RS485 multiple Devices with MAX485

Post here all questions related to STM32 core if you can't find a relevant section!
Post Reply
jenspogo
Posts: 30
Joined: Mon Feb 24, 2020 10:42 am

UART/RS485 multiple Devices with MAX485

Post by jenspogo »

Hey everyone :)
I'm using some Bluepills with a STM32F103C8T6 and a Custom made Board also with a STM32F103C8T6.
The custom Made boards communicates with the Bluepill Board. I'm using a Max485 UART/RS485 Transceiver. This Transciever has an Enable Pin which needs to be High to send data and low to receive. The Idea is to send an address Byte to every Slave. The right Slaves sends back a fixed amount of bytes and ends with the address again.

There are two questions about the communication:
Is it possible to generate an Interrupt when new data is in the Databuffer of a Slave?

and the second question is about the timing of the Enable Pin. Right now I realized something like that:

Code: Select all

void sendData()
{
  
  digitalWrite(ENABLE_PIN, HIGH);
  
  // put data into buffer
  SysbusSerial.write(MKE_UARTstartMarker);
  for (int i = 0; i < MKE_DATA_BUFF_SIZE; i++)
  {
    SysbusSerial.write(DataBuffer[i]);
  }
  SysbusSerial.write(MKE_UARTstartMarker);  
  
  delayMicroseconds(MKE_UART_DELAY_US);
  
  // START LISTENING AGAIN
  digitalWrite(ENABLE_PIN, LOW);
   
  
}
Is it possible to generate something like a TX Buffer empty Interrupt?

Kind regards and Merry Christmas everyone!
Jens
cris
Posts: 1
Joined: Tue Apr 26, 2022 8:28 pm

Re: UART/RS485 multiple Devices with MAX485

Post by cris »

Hello friend!
have you managed to do this?
Could you share the codes, I'm trying to develop something similar to MAX485,
but I'm using the STM32 IDE, but any help is welcome!
Thanks
Post Reply

Return to “General discussion”