paulhamsh / SparkMIDI

Midi control capability for the Spark 40 Amp
Apache License 2.0
10 stars 4 forks source link

SparkIO bad block header #9

Closed MrRSquared closed 1 year ago

MrRSquared commented 2 years ago

Hello, So, I am having another issue (that may be the amp). Not related to this project, the app (I think) keeps soft crashing (Just the Bluetooth). So, I thought I would try the Spark MIDI, and I am getting the following error. Here is the readout. I am wondering if the crashing Bluetooth in the app is related to this or if it is an unrelated issue (just with the Spark Midi). The amp is the mini running the latest firmware 1.9.2.34.

PINGING SPARK
 * F0 *  * 1 *  * 24 * 1 24 FE
SparkIO bad block header
 * 4 *  * 3 *  * 23 *  * 2 *  * 10 *  * 30 *  * 53 *  * 31 *  * 30 *  * 31 *  * 31 *  * 0 *  * 47 *  * 31 *  * 32 *  * 35 *  * 30 *  * 30 *  * 32 *  * 8 *  * 39 *  * 33 *  * 42 *  * 77 *  * F7 *  * F0 *  * 1 *  * 49 * 1 49 FE
SparkIO bad block header
 * 2F *  * 3 *  * 71 *  * 50 *  * F *  * 4 *  * 1 *  * 1 * 1 1 FE
SparkIO bad block header
 * 4D * 1 4D FE
SparkIO bad block header
 * F *  * 4E *  * 5 *  * 4D *  * C *  * 27 *  * 1B *  * F7 * PINGING SPARK
 * F0 *  * 1 *  * 25 * 1 25 FE
SparkIO bad block header
 * 4 *  * 3 *  * 23 *  * 2 *  * 10 *  * 30 *  * 53 *  * 31 *  * 30 *  * 31 *  * 31 *  * 0 *  * 47 *  * 31 *  * 32 *  * 35 *  * 30 *  * 30 *  * 32 *  * 8 *  * 39 *  * 33 *  * 42 *  * 77 *  * F7 * PINGING SPARK
 * F0 *  * 1 *  * 26 * 1 26 FE

You can see the last few blocks then just repeat.

paulhamsh commented 2 years ago

Sometimes that happens I never worked out why. I usually turn it all off and on again, change presets on the amp manually, change any setting on the amp manually, factory reset in the worst case. Often it just fixes itself. The Spark 40 can certainly crash the bluetooth stack so I expect the Mini can as well.

MrRSquared commented 2 years ago

Thank you. With he Spark Midi though, the error above is all I ever get. Do you have any thoughts? I have reinstalled the app on the ESP. Since this error is consistent, I am thinking that the two issues may be unrelated (unless the Android app is smart enough to ignore the bad header most of the time).

paulhamsh commented 2 years ago

Describe what happens - the app crashes each time you use it? Does it connect ever? Does it ever work? At what point does it crash - and what happens with the crash? Have you tried reinstall of app and factory reset of the Spark?

MrRSquared commented 2 years ago

Thank you again for your reply. Initially, I thought the issue with the app and the SparkMidi ESP32 were related, and indeed, they may be, but I am not as certain now. I will separate the two so we can see what is going even though I am totally aware that the BT disconnect from the phone is a me/ Positive Grid Issue, not an issue with the ESP32 or Pedal.

Phone Issue:

I connect the amp to the phone, and it works swimmingly for a few minutes. I can play music through the speaker or headphones (both canned music, and my guitar), and it works well. the hardware dials on the amp all seem to work as expected. I can sample sounds (using the tone library) with little issue. However, when I attempt to change the current tone in the app, it seems to begin to work, and then it loses Bluetooth. If I attempt to adjust the current amp volume in the app, it crashes instantly (To some degree, this bug is understandable). If I adjust any of the pedal settings, it works for a few seconds, and then disconnects from the amp (which resets the pedal setting in the app.

To connect again, I need to go through any number of the following steps. Sometimes it works the first shot, and sometimes it takes some time. 1) Attempting to re-pair by clicking on the amp in the app and clicking tone control and connect (this almost never works, but I look at it as the least destructive option). 2) Changing the tone on the amp from the current (flashing) tone to a new one. and attempting to connect (this never works) 3) Rebooting the amp and/ or phone and trying to pair it again (this works ~1/100 times) 3) Pressing the Pairing button on the app and attempting to reconnect (this works ~1/100 times) 4) Forgetting the amp in the app and reconnecting/ sometimes I will reboot in between attempts. (this works ~1/50 times) 5)Resetting the amp by turning it off and pressing the pair and power until I get the white light (this works most often, but still not consistently (~1/20 times) 6) Clearing the cache and data in the app and logging back in. This works more frequently, but still does not always work. At this point, I have definitely lost any data that I have worked on. 7)After doing the above, resetting the app (this works often but not always. 8) Re-installing the app. This works more often still, but not always 9) Repeat step 1 and continue through the list until it works. Eventually, this system works, but then I begin to tune a sound in the app, and it loses connection again. Reverb, delay, chorus, and distortion effects seem to be the worst.

With the ESP32:

I plug it into the computer, open the serial monitor, and I can see that it connects. Once it does, I get the following message...

PINGING SPARK
 * F0 *  * 1 *  * 24 * 1 24 FE
SparkIO bad block header
 * 4 *  * 3 *  * 23 *  * 2 *  * 10 *  * 30 *  * 53 *  * 31 *  * 30 *  * 31 *  * 31 *  * 0 *  * 47 *  * 31 *  * 32 *  * 35 *  * 30 *  * 30 *  * 32 *  * 8 *  * 39 *  * 33 *  * 42 *  * 77 *  * F7 *  * F0 *  * 1 *  * 49 * 1 49 FE
SparkIO bad block header
 * 2F *  * 3 *  * 71 *  * 50 *  * F *  * 4 *  * 1 *  * 1 * 1 1 FE
SparkIO bad block header
 * 4D * 1 4D FE
SparkIO bad block header
 * F *  * 4E *  * 5 *  * 4D *  * C *  * 27 *  * 1B *  * F7 * PINGING SPARK
 * F0 *  * 1 *  * 25 * 1 25 FE
SparkIO bad block header
 * 4 *  * 3 *  * 23 *  * 2 *  * 10 *  * 30 *  * 53 *  * 31 *  * 30 *  * 31 *  * 31 *  * 0 *  * 47 *  * 31 *  * 32 *  * 35 *  * 30 *  * 30 *  * 32 *  * 8 *  * 39 *  * 33 *  * 42 *  * 77 *  * F7 * PINGING SPARK
 * F0 *  * 1 *  * 26 * 1 26 FE

I have tried all of the steps above (the ones for troubleshooting the phone connectivity) with it in the mix as well attempting to connect to the ESP32 before connecting to the phone (or even adding the amp to the phone in the first place), with and without pressing the pairing button, and nothing seems to change the behavior. EIther it does not connect, or it does and generates the error above in a loop (which is a blocking cycle as it does not connect to the midi board after). I just built SparkMIDI13 to see if that will help, but have not yet tried it.

The two things I have not yet tried. 1) Using a different phone to set up the amp 2) Using my work iPad to set up the amp (I realize that with the iPad version the CLassic is less stable). However, I can also not try classic in that instance, and it may shed some light on the situation.

Thank you again for your help. You have already supported me more than most devs would.

paulhamsh commented 2 years ago

Wow - certainly not right! Perhaps install older firmware on the amp and see if that helps? It is a strange problem. A bit like the amp had a preset that the app doesn’t like and gets confused. Also try compiling SparkMIDI without classic - I have a feeling the Mini only uses ble even on Android - so that may work. I will try with my Mini later - and may put a full debug traffic dumping version on github to see what is actually being transferred.

MrRSquared commented 2 years ago

Yes, definitely. Thank you. I did try compiling both 14 and 15 without the classic and received the same error on both. I will try to use the older firmware later (that should theoretically overwrite any sound settings on it too). But it will take some time to get there. I have a few things to do first. Thank you again for your help.

paulhamsh commented 2 years ago

I don’t think SparkMIDI has the Mini code in it yet - I hadn’t realised! I will make a SpakrMIDI16 which hopefully works with the Mini - bear with me

MrRSquared commented 2 years ago

Excellent. Thank you.

paulhamsh commented 2 years ago

Try SparkMIDI16 - this now has the Mini code in it. Works ok with my Mini. Try with NimBLE first, then Classic if that doesn't work.

MrRSquared commented 2 years ago

That was quick. Thank you so much.

paulhamsh commented 2 years ago

No problem. I had all the code, just spread over different repos - just not in SparkMIDI :-(

MrRSquared commented 2 years ago

In other news? I tried my old phone, and though it would not connect at first, after a reset on the amp, I have been tweaking dials and effects for about 45 minutes, and not one dropped BT signal. So, I am assuming the other issue is with my phone, not so much the amp.

paulhamsh commented 2 years ago

Ah - good progress. Hopefully this SparkMIDI will also work and things will get easier!

MrRSquared commented 2 years ago

Thank you. That is working well. The pedal is not yet recognized, but I think I am going to just see what I can do with DIO on the ESP32 for now. I am wondering if that pedal is not BLE.

Moving forward with the project, is there a manual for the software side of the device? I am aware that some of the codes may be different for the mini v the larger spark. If not, I may make one as I proceed. This is of course depending on how far down the rabbit hole I want to go :).

Edit: I found the software API in the readme and, I re-read the connection order. I think I have been doing the steps backwards. I am leaving this in case anyone comes searching.

Thanks so much for all of your help.

paulhamsh commented 2 years ago

Manual - only what I have written here: https://github.com/paulhamsh/Spark

With the pedal bluetooth, try lightblue to detect it on the standard midi ble address and see what it generates - else see what address it does have and what it generates then we can code it appropriately

MrRSquared commented 1 year ago

Thank you so much for your help. I realized that the issue with that pedal was that it is really only a HID pedal and not BT Bluetooth. I have moved on to two other projects. 1) I built the spark controller directly. 2) I am trying to figure out some looper stuff.

Thank you again. Edit: I forgot to mention. I am using Spark Box as the platform for my pedal as it has a lot of flexibility and works with hardware I have laying around.