I am using rs485 protocol to communicate other modules on Arduino Mega.
But STM32F103 (bluepill+bootloader), i cant send any serial1 message. i am getting messages well.
This is my Arduino Mega working code:
Code: Select all
digitalWrite(enablePin, HIGH); //high signal to send data
Serial1.println("message"); //message
while (!(UCSR1A & (1 << UDRE1))) // Wait for empty transmit buffer
UCSR1A |= 1 << TXC1; // mark transmission not complete
while (!(UCSR1A & (1 << TXC1))); // Wait for the transmission to complete
digitalWrite(enablePin, LOW); //data send
Code: Select all
while (!(UCSR1A & (1 << UDRE1))) // Wait for empty transmit buffer
UCSR1A |= 1 << TXC1; // mark transmission not complete
while (!(UCSR1A & (1 << TXC1))); // Wait for the transmission to complete