parallaxinc / PropLoader

Parallax Propeller loader supporting both serial and wifi downloads
MIT License
27 stars 13 forks source link

What causes 400 error? #15

Open PropGit opened 8 years ago

PropGit commented 8 years ago

What causes the load returned 400 error?

When it happens, it happens very swiftly (fast response; no perceptible delay between loading second-stage loader message and the load returned 400 message. Also, it happens many time in a row during successive attempts.

Loading 'LargeSpinCodePABWX.binary'
Loading second-stage loader
error: load returned 400
error: load failed: -1
dbetz commented 8 years ago

I need to figure out the right error codes to use. I think pretty much any error returns the HTTP code 400 at present. Looking at the sources for the load command, this can be the result of:

1) The infamous "Transfer already in progress". 2) A load request with no data to load. 3) A load request where not all of the data came in the same packet.

Of these, I would guess that the first is most likely. You can figure this out by using the -v option with proploader. That will give you the gory details of the HTTP interactions.

PropGit commented 8 years ago

Thanks! Yes, it's the "Transfer already in progress" issue. This is a state it gets in where there's no recover short of physically power-cycling the Wi-Fi Module:

Loading 'LargeSpinCodePABWX.binary'
Loading second-stage loader
REQ: 59
POST /propeller/set-baud-rate?baud-rate=115200 HTTP/1.1

RES: 138
HTTP/1.0 200 OK
Server: esp-link
Connection: close
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0

REQ: 476
POST /propeller/load?reset-pin=12&baud-rate=115200 HTTP/1.1
Content-Length: 392

RES: 185
HTTP/1.0 400 ERROR
Server: esp-link
Connection: close
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0

Transfer already in progress: state Reset2
54 72 61 6e 73 66 65 72 20 61 6c 72 65 61 64 79
20 69 6e 20 70 72 6f 67 72 65 73 73 3a 20 73 74
61 74 65 20 52 65 73 65 74 32 0d 0a
error: load returned 400
error: load failed: -1
PropGit commented 7 years ago

I'm not sure, but I think this issue has been resolved.

dbetz commented 7 years ago

Unfortunately, I think the firmware uses a HTTP 400 error for everything. I should make a pass through and try to map these to more sensible error codes.