P1 SOS OPENOCD Programming

Hi Everyone.

We’ve received our first boards with a P1 populated on it. On previous board revs we were using headers and a Photon or Electron, but figured it was time to get real!

On first boot of the boards straight out of the box, we get SOS from the P1. I figure that I could just update both the bootloader AND system firmware to the latest and greatest, the problem will “Just go away” tm. No big deal.

I put it into DFU mode and attempted to connect to it using OPENOCD, via the SWD interface. I’ve connected Ground, SWDIO and SWCLK to a Nucleo board which has an STLINK v2.1 on the top of it.

But I cannot get openocd to open the target. Here’s what I get:

openocd -f interface/stlink-v2-1.cfg -f target/stm32f2x.cfg -c "telnet_port 4444"
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport “hla_swd”. To override use 'transport select '.
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v27 API v2 SWIM v15 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.236292
Error: init mode failed (unable to connect to the target)
in procedure 'init’
in procedure ‘ocd_bouncer’

Any pointers that anyone has? Should I get an SOS directly out of the box with a P1?

Thanks in advance for your help people!

Best,

Matthew

@mblackler, do you have a setup button on your P1 board? If so, can you get into listening, DFU or safe modes?

You may want to check your 3.3v supply as well.

Hi @peekay123, yes I have a setup and reset button on my P1 board. I am able to get into DFU mode, but I cannot get into Safe Mode. If I release the setup button when it is magenta, it simply SOS’s. But I can get it to stay in DFU mode though.

I don’t have any dice connecting under DFU mode though, unfortunately. I’ll check my 3.3v supply - I don’t expect it to be the issue though, as it has been the same on the other boards of this run I had produced. None of which do anything other than SOS, by the way.

@peekay123, so you have USB on the board I assume. Can you put it in listening mode? Do you have an image of your board layout PCB layout you could share? The P1 is a different critter so board design is important.

Make sure you’re in DFU mode when you connect using OpenOCD. You probably won’t be able to connect using SWD/JTAG since you probably don’t have SWD enabled system firmware on the device yet but DFU mode will allow you to enter debugging mode.

As peekay123 said, the board design is critical for the P1. In addition to making sure you have sufficient power, capacitors, make sure you don’t connect anything to the test mode pins or the NC pins.

2 Likes

No, unfortunately I do not. I do have Tag-Connect debug connections, which surface SWD pins to allow for programming.

J5 is the connection we use to program.

Hey @rickkas7, my objective is to get the latest system firmware onto my P1 device, but don’t have access to USB. Given that SWD/JTAG may not be available to me, what method should I use to get the latest system firmware and bootloader onto the P1?

Thanks!

The JTAG FAQ has instructions on how to program the boot loader and system firmware by SWD/JTAG:

https://docs.particle.io/faq/particle-tools/jtag/

1 Like

Thanks Rickkas, I am not clear on how this will help with programming my P1, because you mentioned:

“You probably won’t be able to connect using SWD/JTAG since you probably don’t have SWD enabled system firmware on the device yet but DFU mode will allow you to enter debugging mode.”

Could you clarify for my benefit please? My only way of programming the P1 on my board is via SWD/JTAG is it not? If I can’t program using that, is there some other way?

Thanks for your help.

You can only successfully connect to a device using SWD/JTAG if:

  • You have a SWD/JTAG debugging system firmware (or monolithic) build installed on the device

OR

  • You are in DFU mode

Essentially, DFU mode is built with SWD/JTAG enabled, so if you can get into DFU mode you can then SWD/JTAG a boot loader, system, or user firmware image onto the device.

Even if you don’t have a USB port, entering DFU mode to force SWD to be enabled still works.

2 Likes

Great, got it! Thanks.

I am able to program the P1 now, so that seems to be working (… two wires round the wrong way… but we’ll ignore that…).

I successfully programmed the 0.7.0-rc1 bootloader, 0.7.0-rc3 part 1 & 2 system bins. I uploaded the tinker file, and then I tried a P1 build of my firmware.

However the P1 on my board is still SoS’ing directly after powering up.

At a bit of a loss at this point. Perhaps it’s a design flaw on my PCB mated with the P1?

@mblackler, so to be clear, you now have the P1 on your board running 0.7.0-rc3 system with tinker and it SOSs “directly after powering up”? What SOS code are you getting? Can you share your schematic?

Hi @peekay123, I’m getting 1 flash: Hard Fault.

Correct, yes, I am running 0.7.0-rc3, with the Tinker Core downloaded from Github on the same page as where I source 7-rc3 from.

Here is the main schematic:

Let me know if you want to see the power supply and power monitoring IC pages.

Cheers,

Matthew

@mblackler, I’m not seeing anything wrong on this schematic so can you please post the others?

Yes, I’d be glad to. Thanks for checking this out, by the way.

So, looking at the reference P1 implementation and comparing it to ours, one of the main differences I can see is that we tie all NC pins to ground. The reference implementation leaves them floating.

Could this POTENTIALLY be the issue?

I’ve seen that, for example, when tying WL_REG_ON to 3.3v instead of floating, SOS issues were had after OTA updates. Similar?

Thanks!

Yes, you must really leave the NC pins with no connection at all. I’ve seen the behavior you describe when there are connections on the NC pins.

3 Likes

Thanks @rickkas7. We’ve updated the design to detach from ground and leave the NC’s floating, hopefully this board spin will work.

Thanks!

1 Like