Spresense FFT Analyzer Example not working
I tried this FFT analyzer example provided by SONY (https://github.com/TE-YoshinoriOota/Spresense_fftanalyzer_sample/blob/main/README.md) but it is not working.
I choose this Adafruit screen (https://www.mouser.ca/datasheet/2/737/adafruit_2_dot_8_color_tft_touchscreen_breakout_v2-1396576.pdf) and it is working fine by using the graphic test example. I followed everything from the readme part of the above project. When running, the screen displays nothing and the LED2 always blinks (Which means MP error). The serial port also prints out the following info: MP.begin error: -116. I really have no idea why such multicore communication is not working.
I do not connect any push buttons right now and this should not be related to the MP issue. Any ideas on the MP issue?
Thank you in advance for any help.
@Larry said in Spresense FFT Analyzer Example not working:
It's interesting that it is not being able to initialize the subcore.
Error -116 means simply "Connection timed out".
You know what you could do?
Have you tried the Message Data example?
It is a simpler application that will allow you to test if everything is okay with the multicore communication.
Could you try that and tell me if everything is working well?
@CamilaSouza Hi Camila, I tried the message data example together with other built-in MP examples. It is working fine. So the hardware should be fine. I also tried the audio FFT and it is also fine. I have no ideal why this example is not working.
For time-saving, if possible, would you please take a look at this issue first? https://forum.developer.sony.com/topic/669/code-always-got-stuck-while-it-should-not-whether-the-core-powerful-enough-also-have-questions-for-mp-issues I modify the original audio fft example by adding subcore2 for TFT spectrum display while got stuck. The size for this project is small and should be easy to check.
Thank you in advance for any help.
Back to this discussion.
So I tried running the example, but I got the same error as you at first. (MP.begin error: -116.)
I'm not able to run the whole thing correctly right now because I don't have my Display plugged in, but doing some investigating I believe the error might not be related to MP at all.
I found out that the problem might be inside the hardwareSetup() function in the subcore..
If I go to the code of this function in the BuildScreen file and comment the following line:
Then that error goes away.
I can't go any further right now because I don't have the display connected, but can you test this and see what happens for you?
@CamilaSouza Hi Camila, Thank you so much for your kind help. It is working.
Besides, would you please teach me how you debug this? I do not have any debugger used right now (e.g. JTAG or JLINK). I simply flash the code and verify (sometimes with some print sentences). I sincerely hope to know how you debug this issue.
I may ask you later once I have issues connecting the four buttons (keys). Right now I only connect the TFT screen.
CamilaSouza DeveloperWorld last edited by CamilaSouza
To be honest, I don't use any debugger either. Just the simple print statement here and there and.. that's my trick.. commenting section by section to isolate the problem.
For example.. I'll describe my thought process here.
In this case, I first commented out everything the maincore was doing and left only the MP.begin in the setup. I saw that it was still giving me the same error, which led me to believe the error was coming from the subcore.
In the subcore, I commented out everything it was doing in the loop and left only the setup part. Still error.
So I saw that the setup had one function I knew nothing about (hardwareSetup). I commented that out and no error!
So I knew then that this function was making an impact.
Then I left the call for that function in the setup, but now went inside the actual function code (which I found in BuildScreen sketch by Ctrl+F) and commented out everything but the first part (pinModes). Still no error.
So I uncommented chunk by chunk until I found the line that was giving me a hard time.
I lucked out that the line looked removable, though. Otherwise the investigating would have to run deeper haha.
I hope this made some sense to you.
@CamilaSouza Hi Camila, Thank you so much for your kind reply. The 'isolation' method is indeed a good way of debugging. Besides, I connect the keys and the example is working. Maybe only some minor errors exist.
Thank you again for your kind help.
Of course! I'm happy to help.