STM32 - two errors in turns during programming

Discussion in 'Embedded Systems and Microcontrollers' started by PiotrK, Mar 24, 2014.

  1. PiotrK

    Thread Starter New Member

    Mar 24, 2014
    8
    0
    I'm trying to program STM32F107VCT6 via SWD and I'm constantly getting two errors in turns (literally):


    • Error: Connect failed, check config and cable connection
    • Error: Flash driver function execute error, Erase: [ 0%]
    By "in turns" I mean that when I click "Download Code To Flash" in CooCox CoIDE, I'm getting the first error, and after the second try, I'm getting the second one.

    I have a PCB made from the same schematics with this model of STM32 and it works just fine. Changes between the old board and the new one are very insignificant.

    I thought the problem may be in connecting NRST line, but everything is fine. I used 10k pull-up resistor, and the connections seem to be OK. Also, the crystal oscillator looked guilty, but I disconnected it to check if I could program STM32 on the internal oscillator, but it didn't help. All signals are connected correctly and all GNDs are connected together.

    Could someone point out some possibilities why STM32 could behave like this? I would be grateful for any help.
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    I presume that to mean that you have a STM32F0DISCOVERY demo board and it connects and programs successfully.

    You don't need the external XTAL or the NRST line connected for it to program.
    Make sure that all VSS and VSSA pins are connected to GND.
    Make sure that all VDD and VDDA pins are connected to 3.3V
    Make sure that you have 0.1μF caps at all VSS and VDD paired pins.

    What pins have you connected to the SWD connector on the programmer?
    Have you made the required changes on the STM32F0DISCOVERY board.
     
  3. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Also make sure Vbat is connected too. I had similar problems with stm320f107CBT6 without it.
     
  4. PiotrK

    Thread Starter New Member

    Mar 24, 2014
    8
    0
    I don't have this eval board, but the programmer works for sure - it can program the slightly older board I designed, with the same uC.

    I connected these STM's pins to the programmer: SWD_TMS, SWD_TCK, GND and 3.3V.

    Vbat is connected.
     
    Last edited: Mar 24, 2014
  5. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    Can you show us a photo of the working board and one of the not working board?
     
  6. PiotrK

    Thread Starter New Member

    Mar 24, 2014
    8
    0
  7. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    I was hoping to see clearer photos so that we can check the pins and look for bad solder joints.

    Do you know that the new board works, i.e. that this is not the first test run?

    If this is the first test, how do you know that the board and MCU are both good?
     
    Last edited: Mar 24, 2014
  8. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    I got some fresh new chips today, STM32F429VIT6, never worked with these before.

    So I am going to test them on a board that was laid out for STM32F407VGT6.
    I know the board is good. I am going to start with just the MCU and power supply decoupling capacitors, nothing more.
     
  9. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Can you try if jtag works?
     
  10. PiotrK

    Thread Starter New Member

    Mar 24, 2014
    8
    0
    Ok, I'll try to take such photos today.

    Code ( (Unknown Language)):
    1. Do you know that the new board works, i.e. that this is not the first test run?
    2. If this is the first test, how do you know that the board and MCU are both good?    
    It is the first run and the problem is I don't know if the board itself is OK. So far it seems that it's not - I've tried several different units of this MCU and the behavior was exactly the same.

    I see the point - I'd probably do the same to isolate the problem, if only I had more time, but unfortunately I have only one day now to the deadline. As I wrote yesterday, I have this older board which is really similar to the new one and it works just fine. It means that all connections should be logically correct (the schematics are nearly identical, regarding connections to the MCU). There must be something which causes such distinctive behavior of the MCU. I think there is something wrong with the board or rather the way it's been put together, and I'm looking for a clue what it might be.

    Unfortunately no - all JTAG pins are used for something else and soldered to the PCB in such way that I can't check it.

    Despite the deadline, I won't stop trying to run the board, just not in such a big hurry. I'll keep you posted if something new comes up.
     
  11. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    Have you checked with a DMM that the supply voltage is correct?
     
  12. PiotrK

    Thread Starter New Member

    Mar 24, 2014
    8
    0
    Yes, +3.3V is everywhere where it should be.
     
  13. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    If this is the first run on this PCB, how many of these boards have you assembled and tested?
     
  14. PiotrK

    Thread Starter New Member

    Mar 24, 2014
    8
    0
    This particular board - none, unfortunately. This is the first and probably the last one. But we already had about 3 similar boards and they worked fine.

    We're a small team of students taking part in robotics competitions, so basically all circuits are like prototypes, not mass production. I'm writing in behalf of our electronics engineer so I also may not have the full picture.

    Here are the photos I promised. I did my best to make the pins look as sharp as possible:
    http://i.imgur.com/gtmiUe3.jpg
    http://i.imgur.com/YbQoXTp.jpg
    http://i.imgur.com/faoVHil.jpg
    http://i.imgur.com/y4YrOSk.jpg
     
  15. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    Thanks for the photos. I will look them over but not in time for your deadline.

    So these are proto PCBs?
    Were they designed and assembled by you?
    Someone already assembled an identical board and tested that the MCU connects to the programmer?

    I ask many questions because many times the devil is in the details.
    That is how I succeed in diagnostic work.
     
  16. PiotrK

    Thread Starter New Member

    Mar 24, 2014
    8
    0
    Yes.
    Yes.
    No.
     
  17. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Do you have another bare pcb that you could partially populate? Or remove some parts from the problematic board to try out the jtag?
     
  18. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    Have you connected VSSA pin-20 to GND
    and VDDA pin-22 to 3.3V?
     
  19. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Did the schematic change between the versions, or just the layout?
     
  20. PiotrK

    Thread Starter New Member

    Mar 24, 2014
    8
    0
    Sorry for not replying for several days. I've encountered a similar problem on another board and just resoldering the uC helped. I'll try to do it also in this case and I'll let you know if it helped.
     
Loading...