Program-dfu: Error 74

Hi, here is the error I get when I run the command “make program-dfu”:

Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x08005000, size = 78172
Download	[                         ]   0%            0 bytesdfu-util: Page at 0x08005000 is not writeable
make: *** [program-dfu] Error 74

Any ideas what the problem is? I am compiling on Mac OS.

When I run command "make program-dfu" PLATFORM=photon, I get this error:

make[1]: *** No rule to make target `../../../build/target/user/platform-6-m-lto/src/libuser.a', needed by `../../../build/target/user-part/platform-6-m-lto/user-part.elf'.  Stop.
make: *** [modules/photon/user-part] Error 2

UPDATE: I ran both "make" and "make program-dfu" with "PLATFORM=photon" and it says the file downloaded successfully but gives both errors afterwards:

Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x080a0000, size = 4084
Download	[=========================] 100%         4084 bytes
Download done.
File downloaded successfully
dfu-util: Error during download get_status
make[1]: *** [program-dfu] Error 74
make: *** [modules/photon/user-part] Error 2

does your code run after DFU?

Yep, the code runs! It was a mistake on my part for not making and flashing with PLATFORM=photon :sweat_smile: Thanks!

1 Like

Can you shared what commands you used to fix the Error 74 and Error 2?

I’m using “make PLATFORM=photon clean all program-dfu” and still getting these two errors.

Is the Photon in DFU-mode? Watch the terminal and see that download (progress bar) is done to tell that it’s programmed :wink:

Yeah it is DFU mode (yellow LED blinking), this is what I get:

Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x080a0000, size = 2476
Download        [=========================] 100%         2476 bytes
Download done.
File downloaded successfully
Error during download get_status
make[1]: *** [program-dfu] Error 74
make[1]: Leaving directory `C:/Particle/firmware/modules/photon/user-part'
make: *** [modules/photon/user-part] Error 2

My code in firmware/user/src/application.cpp is this

/* Includes ------------------------------------------------------------------*/
#include "application.h"
SYSTEM_MODE(AUTOMATIC);
/* This function is called once at start up ----------------------------------*/
void setup()
{
    pinMode(D7,OUTPUT);
    digitalWrite(D7,HIGH);
}

/* This function loops forever --------------------------------------------*/
void loop()
{
    delay(1000);
    digitalWrite(D7,HIGH);
    delay(1000);
    digitalWrite(D7,LOW);
}

But the LED doesn’t blink.

So it’s done. Are you compiling locally? Did you update the system firmware if you are compiling locally?

I used

dfu-util -d 2b04:d006 -a 0 -s 0x8020000 -D system-part1-0.4.3-photon.bin
dfu-util -d 2b04:d006 -a 0 -s 0x8060000:leave -D system-part2-0.4.3-photon.bin

and my firmware code is from the “latest” branch. Is this correct?

Sounds right. Where is your user firmware placed?

I tried placing it under “firmware/user/src/application.cpp” and uploading it with

make PLATFORM=photon clean all program-dfu

I also tried placing it under “firmware/user/applications/test/application.cpp” and uploading it with

make PLATFORM=photon APP=test clean all program-dfu

I ran these commands from the “firmware/main” directory

The way I updated my firmware was by navigating to the “firmware/modules” directory and using

make PLATFORM=photon clean all program-dfu

Edit: The LED breaths magenta when I upload code.

Ok i know what’s wrong now.

You need to use the system firmware built using the latest code.

  • cd modules
  • make clean all PLATFORM=photon APP=test program-dfu
  • You only need to do the above once. After that,
  • cd main
  • make all PLATFORM=photon APP=test program-dfu

Have fun :wink:

I followed the steps and the terminal did not give any errors but the code is still not running i.e. the device is breathing magenta after I upload the app from main.

After that I’m able to flash code from the cloud IDE but not locally via dfu it seems (even though I get the “Download [=========================] 100%” message).

Breathing magenta means the Photon is connected to the :cloud: but no user firmware is running - Safe mode

I wonder if there’s issues with the building of user firmware locally.

Yeah, I read that in another one of your posts :wink: And like I said I am able to upload code from the cloud afterwards (so I guess the local firmware I upload is working but the app/user code isn’t?)

try doing this:

  • cd main
  • make clean all PLATFORM=photon APP=tinker program-dfu

Same result: breathing magenta.

After this I tried to upload using “particle flash device_name tinker.bin” from the CLI and still breathing magenta. I guess the user binaries might not be building correctly.

Yup totally. Im guessing about the CRC issue… Are there any errors when you build the user firmware?

Place the Photon in Listening mode, open a serial terminal and hit “s” then paste the output here.

No.

Here’s the output:

"p":6,"m":[
	{"s":16384,"l":"m","vc":30,"vv":30,"f":"b","n":"0","v":3,"d":[]},

	{"s":262144,"l":"m","vc":30,"vv":28,"f":"s","n":"1","v":3,"d":[]},

	{"s":262144,"l":"m","vc":30,"vv":28,"f":"s","n":"2","v":3,"d":
		[{"f":"s","n":"1","v":3,"_":""}]},
	{"s":131072,"l":"m","vc":30,"vv":28,"u":"xxxxxxxxxxxxxxxxxxx","f":"u","n":"1","v":2,"d":
		[{"f":"s","n":"2","v":3,"_":""}]},
	{"s":131072,"l":"f","vc":30,"vv":30,"u":"xxxxxxxxxxxxxxxx","f":"u","n":"1","v":2,"d":
		[{"f":"s","n":"2","v":1,"_":""}]}
]

Edit:

I’m pulling from the “latest” branch and my code is up to date.

It’s interesting that the user firmware is on v:2 when you are using the latest which is v:3 but user code should will work and run.

What happens when you flash code via OTA through Web IDE?

I’m able to flash through the Web IDE (and the code I give works), just not through the CLI or DFU (even though I don’t get any errors and the photon acts like it was flashed i.e. blinking magenta and reset).

I’m going uninstall and reinstall my local tools again :frowning: Unless you have some other ideas?Something might have gone wrong. But thanks for the fast and great support :slight_smile: