Hi All,
I'm new on Arduino ESP32 world and I turn to You as experts for Arduino ESP32 hints.
I'm using ESP32 in kind of Token MODBUS, on logic level, TX , RX lines. Therefore, I need to change TX pins on bus to three state, when not transmiting. I tried all kind of hints to do this, I get not working comm or the trick does no effect. I used to programming Microchips from 12F to DSPICs and PIC32, where this was pretty easy, here I'm struggling a bit using Arduino on ESP, working in Visual Code Platformio IDE. The various methods I used, are listed bellow:
void MODBUSDIS(void)
{
uart_set_pin((uart_port_t)2, -1, 27, -1,-1);
//gpio_set_direction((gpio_num_t)26,GPIO_MODE_INPUT);
//Serial2.begin(4800, SERIAL_8N1, 27, -1);
// pinMode(26,INPUT);
// digitalWrite(26, LOW);
//Serial2.setPins(-1,-1,-1,-1);
}
void MODBUSEN(void)
{
// gpio_set_direction((gpio_num_t)26,GPIO_MODE_OUTPUT);
//Serial2.begin(4800, SERIAL_8N1, 27, 26);
// pinMode(26,OUTPUT);
// digitalWrite(26, HIGH);
// Serial2.setPins(-1,-1,-1,-1);
}
Thanks a lot for any useful information,
Regards,
Vojko