libretiny-eu / ltchiptool

Universal, easy-to-use GUI flashing/dumping tool for BK7231, RTL8710B and RTL8720C.
MIT License
85 stars 4 forks source link

question - need socket interface #36

Open rew1ndustry opened 3 months ago

rew1ndustry commented 3 months ago

the chips i need to flash are soldered onto their power supplies - as in most of the LED bulbs i can find around here.

i have built a wifi linked flashed using an esp8266 chip, provides a telnet service direct to the UART, and i have rewritten the hid_download_py scripts to operate over sockets, instead of serial, and all of this works quite well, and can be powered by the supply on the target board.

could itchiptool be converted to operate over wifi socket 23?

i presume it can - should i do the changes, and would these be useful to you?

kuba2k2 commented 3 months ago

It should be possible, but you would need to provide a socket based backend instead of the usual UART. There are some functions, such as baudrate setting, byte availability checking, etc. that would need to be reimplemented. Perhaps the simplest option would be to write a class compatible with PySerial.

The question is - in which cases would that be necessary? I assume you're connecting an esp8266 to the LED bulbs, instead of connecting an UART TTL adapter to them. Sure, connecting UART while powering the device from mains would be extremely dangerous, but why not simply apply 3.3V to the chip instead?

Usually these kinds of smart devices have some kind of low voltage regulator in the end, that steps the voltage down to 3.3V. I tend to either apply power at its output, or at its input (e.g. 5V) which gives me a stable supply.

rew1ndustry commented 2 months ago

On Aug 8, 2024, at 14:44, Kuba Szczodrzyński @.***> wrote:

It should be possible, but you would need to provide a socket based backend instead of the usual UART. There are some functions, such as baudrate setting, byte availability checking, etc. that would need to be reimplemented. Perhaps the simplest option would be to write a class compatible with PySerial.

devil in the details, am only beginner python myself - i could write a class to replace PySerial by import, but this would have to account for address and port on init, rather than serial device, and i'm not sure how to do that.

i'm handling reset via UDP control channel, toggles the CEN pin, and could easily change baud rates by the same mechanism, but so far the default 115200 is working for me.

The question is - in which cases would that be necessary? I assume you're connecting an esp8266 to the LED bulbs, instead of connecting an UART TTL adapter to them.

correct, generally anything IOT that is embedded with an A/C power supply, and cannot easily be disconnected from it, also allows me to flash modules in place, without having to desolder them first, because the new ones are getting far too small for me to work on.

Sure, connecting UART while powering the device from mains would be extremely dangerous, but why not simply apply 3.3V to the chip instead?

Usually these kinds of smart devices have some kind of low voltage regulator in the end, that steps the voltage down to 3.3V. I tend to either apply power at its output, or at its input (e.g. 5V) which gives me a stable supply.

it had not occurred to me i could feed DC into the BP2525D buck converter in my current devices - thank you, this makes sense.

in the end i do not have any good reasons for my method.

however it works, and i expect to keep using it - if i come up with any good excuses for it, i will get back to you.

thank you for being there, and for all that you do.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.