Skip to content

Commit

Permalink
ESP32S3 UART output mode for Tx (#22426)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Nov 4, 2024
1 parent 490c48e commit 57d8bea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
### Changed

### Fixed
- ESP32S3 UART output mode for Tx

### Removed

Expand Down
6 changes: 6 additions & 0 deletions tasmota/tasmota_xdrv_driver/xdrv_41_tcp_bridge.ino
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ void TCPInit(void) {
if (!Settings->tcp_baudrate) {
Settings->tcp_baudrate = 115200 / 300;
}
// patch for ESP32S3
#if CONFIG_IDF_TARGET_ESP32S3
pinMode(Pin(GPIO_TCP_TX), OUTPUT);
digitalWrite(Pin(GPIO_TCP_TX), HIGH);
sleep(1);
#endif // CONFIG_IDF_TARGET_ESP32S3
TCPSerial = new TasmotaSerial(Pin(GPIO_TCP_RX), Pin(GPIO_TCP_TX), TasmotaGlobal.seriallog_level ? 1 : 2, 0, TCP_BRIDGE_BUF_SIZE); // set a receive buffer of 256 bytes
tcp_serial = TCPSerial->begin(Settings->tcp_baudrate * 300, ConvertSerialConfig(0x7F & Settings->tcp_config));
if (PinUsed(GPIO_TCP_TX_EN)) {
Expand Down

4 comments on commit 57d8bea

@joba-1
Copy link
Contributor

@joba-1 joba-1 commented on 57d8bea Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be in TasmotaSerial (or even arduino core)? I guess this bites every serial user.

I happen to do my first project using S3s right now, so I just read about special pins yesterday. The S3 has some that are not even in gpio mode after boot. It is not enough to just set the direction (on IDF level). I think the S3 arduino core serial class should take care of this, but maybe it doesn't? What pin did you use?

Related info, including an esp function to print pin status: https://docs.espressif.com/projects/esp-idf/en/stable/esp32s3/api-reference/peripherals/gpio.html

@s-hadinger
Copy link
Collaborator Author

@s-hadinger s-hadinger commented on 57d8bea Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I just needed a quick fix for now, and impacting the whole TasmotaSerial is not that impactless. It needs proper troubleshooting.

Actually it should be fixed in esp-idf or Arduino.

Edit: in my case it was GPIO 19/20

@joba-1
Copy link
Contributor

@joba-1 joba-1 commented on 57d8bea Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, ok, these are the pins of the S3 builtin JTAG. Having to set pinMode is probably a fair reminder that you sacrifice debugging for serial :)

@s-hadinger
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this is probably the reason. Those GPIOs were not my choice, but the choice of Seedstudio SenseCap.
In such case, I'm not sure how we should address this in TasmotaSerial

Please sign in to comment.