Photon gets into safe mode after flashing Firmware locally

Hi,

I have made some changes to the ADC HAL, to read in and process more samples, than the hardcoded 10 samples. I have been able to build the firmware and my application locally, and flash it to the device.

However, the moment the firmware part1 and part2 is flashed, the device gets into Safe mode, by Blinking Magenta. It does connect to the cloud, as I can see the device active in the Particle Web IDE. I am trying to setup a debugging environment with a ST-Link connected over a Programmer Shield, but in the mean time, can anyone help me figure out any possible reason for this behavior?

Also, I looked into this thread, where CRC mismatch seemed to be the issue. I do not know how to cross check the same in my build. Can anyone please help?

-Karthik

I tried running ‘xxd .bin’ on Firmware part1, part2 and my user application. I see that in all the three files, the last four bytes are 7856 3412.

Is the generated CRC wrong?

yes. double check you have crc32 in your path.

Yes! That was the problem. I found that MSYS installation had a CRC32, which was being used for the build. I removed that and the one from MinGW started getting invoked and the build worked fine! Thanks @mdma.

Now, I have a much bigger issue and here is my analysis: (I am on Windows 10, btw.)

  1. After I flash this modified firmware onto my Photon, it breathes cyan for about 10 seconds, and then starts to breathe green (Not connected to the cloud). I tried to debug the code, and I also see that the device is in Low power mode and isn’t executing any code either. The PC seems to be stuck at 0x0. (Verified with OpenOCD session connected over the Programmer Shield)

  2. I cleaned up my workspace, cloned the firmware code from Github as is, and built the firmware. I see the same behavior, even with unmodified code from github. Basically, I am unable to build firmware locally and make it work on my Photon, even without any code changes. Evenrything goes helter-skelter the moment I flash locally built firmware onto the Photon.

Is the build going wrong anywhere? How do I figure out which build component isn’t built fine? I have spent a lot of time looking at the community threads, but haven’t been able to get over this issue. I have no clue how to proceed on this.

Any suggestions/pointers are welcome.

P.S: After replacing my PC USB drivers with libusbk ones for OpenOCD setup, I am not able to connect to Photon over a serial connection. I cannot run a basic ‘particle serial wifi’ command now. It throws an error saying ‘No serial device found’. This is adding to my misery!

@mdma @Dave Can you guys please help me with this? I am totally stuck :frowning:

1 Like

Reading this again now…

I’m wondering if this could be related to the version of the arm-none-eabi-gcc toolchain you’re using? It’s also worth checking to be sure you’re targeting a release branch, and not necessarily the latest develop branch. Can you check the version of your toolchain, your git branch, and maybe do a build of tinker? Then we could compare the raw tinker binary against a known good tinker, and that’ll show if your toolchain is producing good binaries or not?

Thanks,
David

btw, i believe @karthikuvce is using a Windows10 machine? does that make any difference?
@karthikuvce please correct me if im wrong

@corey, I’m using Windows 10 Pro 64bit and have no problem with it.

I used Mumblepins Windows installer to setup my dev env.

Put the device in listening mode, connect to serial and press ‘s’ - please paste the output here. I suspect the version of crc32 you’re using isn’t using the same crc algorithm so the crc is not accepted as valid.

You’ll see attributes vc and vv - they should be equal - if not then the firmware isn’t passing the validation checks.

@Dave @corey @ScruffR When I started off setting up the build tools, I did try out installing the Mumblepins Windows installer, but ran into a lot of build issues, while compiling the Firmware, and hence went back to the old way of installing the tools one by one. I did not dig too much into the issue then. As @mdma suggested, I might be using older/incompatible versions, but I had no way of figuring that out, as even my Serial drivers are broken :sob: I only relied on xxd (Hex Dump) to look at the last four bytes of the generated .bin file, for the CRC.

I will try cleaning up all of my previously setup tools, and retry with the Windows installer. Fingers crossed!

Thanks for your suggestion guys. I will keep you all posted.

1 Like