1
\$\begingroup\$

I'm hacking a massage chair board based around a 8051 microcontroler (a QFP44 SinoWealth SH88F516). Images of the board here. I am not familiar with this IC so I come to you in hope of advice for a best approach.

  • Is there a way to get a dump of the current hex code that is on the chip? After messing with my own code, it would be a good fail safe to have so I could always revert to the original code.
  • Can I use any 8051 toolchain to work with this specific IC, or do I need to use whatever SinoWealth is offering?
  • Someone suggested certain Atmega's are pin compatible with the 8051 but I cannot find much info on that. Is it true?
  • As an alternative to reprogramming the 8051, I thought to pull down the RST pin and use another IC instead. However the 8051 doesn't reset when the RST pin is pulled down, however it does crash until I cycle the power when pulled high.
    • Why doesn't it stop functioning when pulled low and would it be safe to keep it high?
\$\endgroup\$
6
  • \$\begingroup\$ I'm assuming "takinlle" is a typo. Might want to fox that. \$\endgroup\$
    – Hearth
    Commented Jul 2, 2019 at 14:48
  • \$\begingroup\$ ...to fix that. I made a typo in my comment informing you of a typo. \$\endgroup\$
    – Hearth
    Commented Jul 2, 2019 at 14:48
  • \$\begingroup\$ @Hearth "Do as I say, not as do" \$\endgroup\$
    – DKNguyen
    Commented Jul 2, 2019 at 15:05
  • \$\begingroup\$ why are you mentioning a previous post that does not exist? \$\endgroup\$
    – jsotola
    Commented Jul 2, 2019 at 16:16
  • \$\begingroup\$ Oh, sorry, I realize I made that post in the reserve engineering SE, I'll remove the mention and add in relevant info from the original post. Also it seems like a mod already fixed my typo. \$\endgroup\$ Commented Jul 3, 2019 at 2:44

2 Answers 2

1
\$\begingroup\$

Is there a way to get a dump of the current hex code that is on the chip? After messing with my own code, it would be a good fail safe to have so I could always revert to the original code.

Only SinoWealth or someone experienced with that specific product family will be able to answer that.

Can I use any 8051 toolchain to work with this specific IC, or do I need to use whatever SinoWealth is offering?

Any 8051-targetting C compiler will convert C to valid machine code for that MCU.

But that doesn't mean that addresses of memory segments are right (i.e. you need linker scripts that match your hardware), or that any of the peripherals work like in any other 8051 MCU.

So, that's a "yes, with extensive work in making sure to tell the toolchain about the properties of the chip you're working with, and then potentially writing drivers for the more complex peripherals".

Someone suggested certain Atmega's are pin compatible with the 8051 but I cannot find much info on that. Is it true?

Why would that matter? What you're looking at is not an original Intel MCS-51, but a microcontroller that has the same CPU core; it's more than questionable your low-cost clone should have the same pinout as a 1980 Intel microprocessor.

As an alternative to reprogramming the 8051, I thought to pull down the RST pin and use another IC instead. However the 8051 doesn't reset when the RST pin is pulled down, however it does crash until I cycle the power when pulled high.

  Why doesn't it stop functioning when pulled low and would it be safe to keep it high?

I'd agree, simply investing cents to euros to get a modern MCU in there (e.g. one of the cheaper STM32) would make much more sense – especially since programming hardware that you'll need to flash your programs to the 8051-clone will not be free, either.

Why not simply measure all the DC voltages at all the 44 pins (not that many), figure out the power supply and ground pins, and use a cheap hot air gun to unsolder the MCU alltogether and use a cheap PCB board service (e.g. OSHpark) to manufacture an adapter board that allows you to use ribbon cables to connect your replacement to the original MCU's pads?

If that pays at all - often, it's easier to just scrap the control board alltogether and just interface with the actors (and if any, sensors) of the device directly from an MCU eval board of choice – these can be had for 2 to 20 €.

\$\endgroup\$
2
  • \$\begingroup\$ It's a 5V MCU, so an STM32 would not work without some additional tinkering \$\endgroup\$ Commented Jul 2, 2019 at 16:43
  • \$\begingroup\$ I think I will take your advice and not bother with the orignal microcontroller, although it doesn't even seem needed to make a custom PCB. I will start simply wiring relevant pins to my MCU and go from there. \$\endgroup\$ Commented Jul 3, 2019 at 2:49
0
\$\begingroup\$

Personally, I think it would be fun to attempt to reprogram the MCU on the board instead of hacking around it. From the datasheet, it looks like this is an 8051-core MCU with a base set of standard 8051-compatible peripherals, plus some Sinowealth special sauce. It's got 64K of flash, which is insane for an 8051 (which has much higher code density than RISC-style MCUs).

I'd bet that if you can program an AVR's peripherals, you can program this thing. 8051 peripherals are dead simple, and I think you'll enjoy having bitwise access to the most common registers. The datasheet is well-written with tons of peripheral block diagrams and tables that illustrate how the peripherals work.

While the core and peripherals are often standard across 8051 implementations, flash programming is not. Interestingly, section 8.3.3 mentions that you can activate a built-in UART bootloader by tying P1.0 and P1.1 to GND. It looks like they have freely-available downloads on their web site, but I didn't see anything specifically related to UART flash programming. If you want to use the UART bootloader, you'll have to do some detective work online, or reach out to them to get a download link.

Otherwise, if you want debug capability, you'll need to buy their JET51A debugger (they call is a "simulator"). These run for $75 on AliExpress and about half that price on Taobao. They also have production programmers like the Pro06A, but they're quite expensive (~$180).

As for development, you can use any 8051 toolchain. I'd recommend downloading a free version of Keil C51 / µVision, since that's what's officially supported by Sinowealth (so you can download headers and project templates for it), plus their debugger/programmers come with Keil µVision plugins.

Considering these parts are only about $0.50/unit in singles from China, you may end up throwing them in a future project. Who knows!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.