libretiny-eu / libretiny

PlatformIO development platform for IoT modules
http://docs.libretiny.eu/
MIT License
401 stars 59 forks source link

RTL8710BX with 2 MB flash on a T102-V1.1 cannot connect to Wi-Fi network #247

Open spupetic opened 8 months ago

spupetic commented 8 months ago

I have generic Tuya smart sockets with a T102-V1.1 board, but it doesn't have the RTL8710BN, but the BX, without the 4 MB flash, according to ltchiptool, it has a 2 MB flash. I have installed ESPHome kickstart (RTL8710BN) on them, but I couldn't get Wi-Fi client mode working. I have tried different APs, changing channels and WPA mode, password, without success. Then, I have compiled ESPHome with the same and different (X-based) board, but it did not help. The fallback AP works though.

kuba2k2 commented 8 months ago

Can you post a photo of the T102 board? That way so I can see the exact chip markings of the RTL and the flash.

spupetic commented 8 months ago

RTL8710BX_socket

This is one of the boards, they are identical.

RF197 commented 7 months ago

I have the same plugs (blew one up though), yet it connects just fine.

Here are my config settings:


substitutions:
  device_name: 'Plug 2'

esphome:
  name: plug-2
  comment: '20A Smart Plug RTL 1'

rtl87xx:
  board: wr2

logger:
  level: DEBUG

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password

  ap:
    ssid: "Smart Plug 2 AP"
    password: "xxxxxxxxxxxxx"

api:

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

captive_portal:

web_server:
  port: 80

I have issues getting the BL0937 to work (something with CHANGE intterupts not allowed) though, and PA15 does not switch.

spupetic commented 7 months ago

How did you blew it up? By does not switch you mean the relay switching does not work?

Raddie12 commented 7 months ago

how did you get it in boot mode? ESPHOME tells me to connect CEN ro GRD, TX2 to GRD, remove CEN from GRD and then remove TX2 from GRD. I didn´t manage to do so ...

mabey I unse the wromg (CEN PIN?

spupetic commented 7 months ago

how did you get it in boot mode? ESPHOME tells me to connect CEN ro GRD, TX2 to GRD, remove CEN from GRD and then remove TX2 from GRD. I didn´t manage to do so ...

mabey I unse the wromg (CEN PIN?

I was just shorting TX2 to GND while plugging the USB to Serial adapter into the computer. Probably not the best way to do it, but I worked well for me. So I have not used CEN.

Raddie12 commented 7 months ago

Do you use GPIO_A30/DEBUG_LOG_TX & GPIO_A 29/DEBUG_LOG_RX. And do you use ESPHome or Tasmota? I tried both also both TX/RX but it´s nor working :(

Do you release the TX2 from GRD after usb-plugging?

spupetic commented 7 months ago

Do you use GPIO_A30/DEBUG_LOG_TX & GPIO_A 29/DEBUG_LOG_RX. And do you use ESPHome or Tasmota? I tried both also both TX/RX but it´s nor working :(

Do you release the TX2 from GRD after usb-plugging?

It is a bit confusing with the RTL's RX TX situation, you need to use UART2 (RX2 TX2) refered here: https://docs.libretiny.eu/boards/t102-v1.1/#usage

After plugging in the USB, I released GND from TX2.

I am using ESPHome, Tasmota and OpenBeken is not (yet) compatible with this board.

RF197 commented 7 months ago

How did you blew it up? By does not switch you mean the relay switching does not work?

Errh yes, trying to connect debug UART while the device was in the mains power. Not my brightest moment.... It also killed the USB ports on my PC, and took my keyboard to the grave with it (plus killed the power in the house). So don't try that at home...

You indeed have to use pins PA29/30 and ground TX while powering up. This only needs to happen the first time by the way.

I'm also using ESPhome.

Update: the relay works if you use the WR2 board (there's a separate issue on that, known bug) (since it's on PA15).

Enabling BL0937 causes the whole thing to bootloop until it goes into emergency mode. This is due to pin change interrupts not being supported in the chips; though they are needed to use the pulse counter plugin. There may be a workaround using two interrupt sources in one handler (it does have support for rising and falling edge interrupts), but I haven't been able to figure out how to convince esphome to use that....

spupetic commented 7 months ago

How did you blew it up? By does not switch you mean the relay switching does not work?

Errh yes, trying to connect debug UART while the device was in the mains power. Not my brightest moment.... It also killed the USB ports on my PC, and took my keyboard to the grave with it (plus killed the power in the house). So don't try that at home...

You indeed have to use pins PA29/30 and ground TX while powering up. This only needs to happen the first time by the way.

I'm also using ESPhome.

Update: the relay works if you use the WR2 board (there's a separate issue on that, known bug) (since it's on PA15).

Enabling BL0937 causes the whole thing to bootloop until it goes into emergency mode. This is due to pin change interrupts not being supported in the chips; though they are needed to use the pulse counter plugin. There may be a workaround using two interrupt sources in one handler (it does have support for rising and falling edge interrupts), but I haven't been able to figure out how to convince esphome to use that....

Thanks for the tips. Sadly, the Wi-Fi issue is still present for me, I have tried OTA update from the fallback hotspot, it works, but the device does not connect to any Wi-Fi (even tried with a different access point).

RF197 commented 7 months ago

How did you blew it up? By does not switch you mean the relay switching does not work?

Errh yes, trying to connect debug UART while the device was in the mains power. Not my brightest moment.... It also killed the USB ports on my PC, and took my keyboard to the grave with it (plus killed the power in the house). So don't try that at home... You indeed have to use pins PA29/30 and ground TX while powering up. This only needs to happen the first time by the way. I'm also using ESPhome. Update: the relay works if you use the WR2 board (there's a separate issue on that, known bug) (since it's on PA15). Enabling BL0937 causes the whole thing to bootloop until it goes into emergency mode. This is due to pin change interrupts not being supported in the chips; though they are needed to use the pulse counter plugin. There may be a workaround using two interrupt sources in one handler (it does have support for rising and falling edge interrupts), but I haven't been able to figure out how to convince esphome to use that....

Thanks for the tips. Sadly, the Wi-Fi issue is still present for me, I have tried OTA update from the fallback hotspot, it works, but the device does not connect to any Wi-Fi (even tried with a different access point).

As a sanity check - the wifi access points are at 2.4GHz and have DHCP enabled, right?. If so this is very odd....

spupetic commented 7 months ago

How did you blew it up? By does not switch you mean the relay switching does not work?

Errh yes, trying to connect debug UART while the device was in the mains power. Not my brightest moment.... It also killed the USB ports on my PC, and took my keyboard to the grave with it (plus killed the power in the house). So don't try that at home... You indeed have to use pins PA29/30 and ground TX while powering up. This only needs to happen the first time by the way. I'm also using ESPhome. Update: the relay works if you use the WR2 board (there's a separate issue on that, known bug) (since it's on PA15). Enabling BL0937 causes the whole thing to bootloop until it goes into emergency mode. This is due to pin change interrupts not being supported in the chips; though they are needed to use the pulse counter plugin. There may be a workaround using two interrupt sources in one handler (it does have support for rising and falling edge interrupts), but I haven't been able to figure out how to convince esphome to use that....

Thanks for the tips. Sadly, the Wi-Fi issue is still present for me, I have tried OTA update from the fallback hotspot, it works, but the device does not connect to any Wi-Fi (even tried with a different access point).

As a sanity check - the wifi access points are at 2.4GHz and have DHCP enabled, right?. If so this is very odd....

Of course, and Beken, ESP devices connect fine. I would try setting a static IP, but I have seen that it does not work for now with this platform.

vladT0 commented 4 months ago

I had the exact same problem, tried all the changes and could not connect to WIFI. Finally, I examined the board under a microscope and found a solder ball on one of the chip pins. I removed it and everything worked. Second, if you unsolder the module from the main board and use 3.3V from the UART PCB, note that its current is not enough to boot this module normally, it will reboot without stopping (at least in my case) and the WIFI will not work either. Try flashing a very simple PinScan example from the library, but use a module with a good LDO or solder it back to the main board.