Hi all !
I'm trying for days to get the waveshare ESP32-CAN-RS485 module to communicate with my Controllino MAXI. Even the simplest demo for sending receiving does do anything.
It's confirmed the waveshare has GPIO 17 for TX and 18 For RX , GPIO 21 for EN
The controllino code for receiving :
#include <SPI.h>
#include <Controllino.h>
void setup()
{
Serial.begin(115200);
delay(3000);
Serial.println("CONTROLLINO RS485 READY");
Serial3.begin(9600);
// IMPORTANT
Controllino_RS485Init();
// receive mode
DDRJ = DDRJ | B01100000;
PORTJ = PORTJ & B10011111;
PORTJ = PORTJ | B00100000;
Serial.println("RS485 RECEIVE ENABLED");
}
void loop()
{
while (Serial3.available())
{
char c = Serial3.read();
Serial.write(c);
}
}
And the ESP32 code for sending (ESPIF):
#include <cstring>
#include "driver/uart.h"
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#define TEST_UART UART_NUM_1
extern "C" void app_main()
{
uart_config_t uart_config = {};
uart_config.baud_rate = 9600;
uart_config.data_bits = UART_DATA_8_BITS;
uart_config.parity = UART_PARITY_DISABLE;
uart_config.stop_bits = UART_STOP_BITS_1;
uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE;
uart_config.source_clk = UART_SCLK_DEFAULT;
uart_driver_install(TEST_UART, 512, 512, 0, NULL, 0);
uart_param_config(TEST_UART, &uart_config);
uart_set_pin(TEST_UART,
GPIO_NUM_17,
GPIO_NUM_18,
UART_PIN_NO_CHANGE,
UART_PIN_NO_CHANGE);
while (true)
{
const char *msg = "HELLO FROM ESP32\r\n";
uart_write_bytes(TEST_UART,
msg,
strlen(msg));
uart_wait_tx_done(TEST_UART,
pdMS_TO_TICKS(100));
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
Whatever i try , swapping A+ and B- , trying other GPIO's , nothing works.
The LED on the waveshare ESP32 indicates that it is indeed sending over RS485.
But by no means i can receive on the controllino. For now i don't have a USB dongle to test.
Any ideas someone ? Thanks a zillion if you do ![]()