Copying stm32 chip

Jateu01
Sun Mar 05, 2017 2:34 pm
Hi All,

Silly question for everyone. I’m not a developer or a coder. I have a damaged brushless motor controller and I have found the fault to be the stm32 chip. I have removed it and replaced it with a new one. My problem is that I need to copy the data from a working chip to this new one. Can anyone offer advice or point me in the right direction.

Many thanks

James


RogerClark
Sun Mar 05, 2017 8:28 pm
See this acrive thread

viewtopic.php?f=35&t=1854

Basically, if the stm32 is read protected, which its likely to be, then you will probably not be able to read the program inside it

You may be able to send it away to get it unlocked at a laboratory, ( for a large fee )


Jateu01
Sun Mar 05, 2017 8:38 pm
I don’t think it is protected. The esc can be upgraded with new firmware at any time. The thing is I have limited knowledge of this but whst I do know is the that the esc’s board has 5 desitict areas where links have been made. I have back tracked and here are a list of pins on the stm32f051k6t6.

Reset pad links to pin 4 reset.
DIO pad links to pin 23 SWDIO.
TX pad links to pin 24 SWCLK.
RX pad links to pin 25
BT pad links to pin 31 Boot.
TLM pad links to pin 24 SWCLK.
PWM pad links to pin 26 SPI1_SCK.

Which of these do I need to read the chip. Because this is what looks like the manufacturer us to program with.

Many thanks again

James


BennehBoy
Sun Mar 05, 2017 9:08 pm
Do you need to read it? Or can you not just load the firmware from the manufacturer?

Jateu01
Sun Mar 05, 2017 9:16 pm
Problem is the original chip is totaled and the new chip from electronics supplier is clean. So getting it to talk between demo software and ftdi is difficult because there is no bootloader on chip to begin with. So Im looking to see if I can just copy a good chips contents to put on a fresh clean chip.

James


RogerClark
Sun Mar 05, 2017 11:30 pm
Jateu01 wrote:Problem is the original chip is totaled and the new chip from electronics supplier is clean. So getting it to talk between demo software and ftdi is difficult because there is no bootloader on chip to begin with. So Im looking to see if I can just copy a good chips contents to put on a fresh clean chip.

James


Jateu01
Sun Mar 05, 2017 11:47 pm
Thank you Roger. Apologies very new to this but my chips have been supplied as component level there have nothing on them from what I can see. I have looked for documentation and youtube videos but clearly looking in the wrong place!

James


zmemw16
Mon Mar 06, 2017 1:42 am
what sort of package?
how many pins?
can you post pictures of the board top & bottom ?
identify any connections? to the pcb and to components within the pcb
identify the power pins, 3v3, 5v & 0v
peruse a lot of data sheets

there are blc motor control app notes on st.com, sometime the sample circuits are used almost as is.

not sure if that helps at all, that’s the problem with a lack of info ;)

stephen


Jateu01
Mon Mar 06, 2017 1:50 am
Stephen,

I have specified the pins above and the exact chip I’m using. It look like they used pins 14 and 15 for uart communication. I have connected wires as per usb converter instruction but I can’t get demo software to see chip! 3v3 power to chip. Am I meant to power the chip while programming or is it powered via converter. Again sorry to be vague but very new to this.

James


ddrown
Mon Mar 06, 2017 2:21 am
Jateu01 wrote:I don’t think it is protected. The esc can be upgraded with new firmware at any time. The thing is I have limited knowledge of this but whst I do know is the that the esc’s board has 5 desitict areas where links have been made. I have back tracked and here are a list of pins on the stm32f051k6t6.

Reset pad links to pin 4 reset.
DIO pad links to pin 23 SWDIO.
TX pad links to pin 24 SWCLK.
RX pad links to pin 25
BT pad links to pin 31 Boot.
TLM pad links to pin 24 SWCLK.
PWM pad links to pin 26 SPI1_SCK.

Which of these do I need to read the chip. Because this is what looks like the manufacturer us to program with.

Many thanks again

James


Jateu01
Mon Mar 06, 2017 2:29 am
I don’t have stlink just a standard usb converter. The manufacturer will not respond to me. Ddrown am I correct in thinking I can just connect converter up to the tx, rx and ground to get demo software you see bootloader?

Many thanks

James


RogerClark
Mon Mar 06, 2017 6:03 am
Pull pin Boot0 high
Pull pin Boot1 low
Connect TX and RX on your USB to Serial to PA9 and PA10
(Note you may need to swap the order if that does work for you as different USB to Serial have different labels on the pins)

See my video, which covers connecting a USB to Serial , and ignore the stuff about the Arduino IDE

https://www.youtube.com/watch?v=G_RF0a0hrak

Download STM’s “Flash Loader Demonstrator”
http://www.st.com/en/development-tools/ … stm32.html

Install and run that.

If it doesnt work first time, swap TX and RX around

If it still doesnt connect, try a few more times, with TX and RX around different ways, Because it doesnt always connect.
You can also try changing the speed settings if it doesnt connect, some USB to Serial adaptors work best slow some work better going faster

Once you have connected.

Make sure you don’t overwrite what’s in the chip, Look very carefully about what they call Uploading and what they call Downloading, as these can be counter-intuitive.


victor_pv
Mon Mar 06, 2017 6:34 am
Jateu01 wrote:I don’t think it is protected. The esc can be upgraded with new firmware at any time. The thing is I have limited knowledge of this but whst I do know is the that the esc’s board has 5 desitict areas where links have been made. I have back tracked and here are a list of pins on the stm32f051k6t6.

Reset pad links to pin 4 reset.
DIO pad links to pin 23 SWDIO.
TX pad links to pin 24 SWCLK.
RX pad links to pin 25
BT pad links to pin 31 Boot.
TLM pad links to pin 24 SWCLK.
PWM pad links to pin 26 SPI1_SCK.

Which of these do I need to read the chip. Because this is what looks like the manufacturer us to program with.

Many thanks again

James


Jateu01
Mon Mar 06, 2017 7:56 am
Roger and Victor. Thank you for your responses.

Roger there is only boot0 on the stm32f051k6t6! I will try the tx and rx connections the other way around and see what happens.

Victor I will get my self a stlink and see where to go from there.

Many thanks to you both for your help. I will try both ideas and see what happens but I will be sure to post a reply how everything goes.

Thanks again

James


RogerClark
Mon Mar 06, 2017 9:09 am
OK

on the F103 boot1 controls whether the bootloader interacts with Flash or the RAM, but I guess the F051 bootloader will only interact with flash

Also, getting a cheap STLink e.g. eBay or Aliexpress is a good idea, they are not extensive, and work better than USB to Serial


Nutsy
Mon Mar 06, 2017 10:42 am
I agree about the StLink, its a more fool proof way of uploading and reading the flash… Ive managed to unbrick a chip or two with it as well where the serial bootloader was totally knackerd for some odd reason…

While I applaud you for getting into SMT32 stuff and this is an interesting way to get into learning about it… But wouldnt it be easier to just buy a new motor? Or are these motors really expensive? I guess were not talking about your average PC case fan or hobby motor?

As for read protection, i didnt even know that was a thing… Good to be aware of it. So i can lock down some of my stuff if i decide to sell it so it doesnt get cloned by some Chinese factory :p Which is funny as Ill be getting a chinese factory to mass produce things if I did that :p

But also as some one else mentioned. Could you get the firmware hex file off the manufacturer? Maybe if you even asked really nicely in an email. They might give it to you


Squonk42
Mon Mar 06, 2017 5:18 pm
Nutsy wrote:As for read protection, i didnt even know that was a thing… Good to be aware of it. So i can lock down some of my stuff if i decide to sell it so it doesnt get cloned by some Chinese factory :p Which is funny as Ill be getting a chinese factory to mass produce things if I did that :p

Jateu01
Mon Mar 06, 2017 7:08 pm
Nutsy the motor control boards are £40 a pop and ive fried 4 of them well the stm32 at least. I’m pretty handy with a soldering iron so I’ve managed to extract of chips and replaced with a new one for £1.65. Yes granted it’s a silly way to get around the problem. But the way I look at it is that if this happens again then it’s only an hours work and £1.65. I have manged to get the demo software to recognise the new chip I just have to get a good board see if I can copy a good chips contents and then copy across. Fingers crossed it will work. I have a stlink on order but going to give the basic process ago while I wait. Than you all again for your advice and guidance.

James


Nutsy
Tue Mar 07, 2017 10:36 am
Ohhhh… is this like a control board for a 3d printer or cnc machine?

Leave a Reply

Your email address will not be published. Required fields are marked *