I am currently trying to use an arduino to send an RS485 via an SP3078EEN RS485 transciever. I have my arduino code set the DE pin high, wait 1ms, then write and flush a data buffer to the serial which is connected to the DI pin of the transciever. Post-this it sets the DE pin low again. This is almost all working as intended except for the fact that I am getting an extra 0x00 byte after my data as read by my oscilloscope and PC (measured via an RS485 to USB converter).
Below I have the important portion of my code as well as the oscilloscope measurements of Di (Driver Input), A (RS485 Positive Output) and DE (Driver Enable). I also have provided a simplified schematic of my circuit. The only thing I can see that might be the cause of this is the seemingly capacitive discharge on the "A" signal which occurs when I switch DE from high to low. I don't know why this is happening or how to fix it. I have tried putting pullup / pulldown resistors on RO, RE and DI to no avail. I have also tried increasing the pre-write delay and also adding a post-write delay, also to no avail.
If anyone can help me figure this out it would be greatly appreciated.
Code:
void setup() {
Serial0.begin(19200, SERIAL_8E1);
Serial1.begin(19200, SERIAL_8E1);
}
void loop() {
// Setting the buffer to a static value for debugging purposes
byte buffer1 = { 0x01, 0x03, 0x00, 0x00, 0x00, 0x04, 0xC4, 0x0B };
// Set the DE_1 pin high to enable writing to the RS485 bus
digitalWriteFast(DE_1_PIN, HIGH);
delay(1);
// Write the buffer to the RS485 bus
Serial1.write(buffer1, 8);
Serial1.flush();
// Disable writing
digitalWriteFast(DE_1_PIN, LOW);
delay(1000);
}

