Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blue pills code looping on procedure return #40

Open
rromano001 opened this issue Sep 27, 2020 · 10 comments
Open

Blue pills code looping on procedure return #40

rromano001 opened this issue Sep 27, 2020 · 10 comments

Comments

@rromano001
Copy link

rromano001 commented Sep 27, 2020

Hello, I am not an Arduino user and lack of debugger is a terrific issue.
I loaded a test program from web,
https://maker.pro/arduino/projects/simple-fm-radio-receiver-with-arduino-uno-and-rda5807m
loaded doesn't work as is.
Adapting got some time to isolate where is stuck. Code is quite noobs and seems modified from other sources but issue come from library or bootloader.
Need spread a lot of wait time on setup around serial communication directive before use them.
At final code stuck at wire communication, procedure never return and loop as stack got corrupted, reenter procedure?
No debugger no idea what happen... Arduino IDE is just a time wasting.
changed key selector from analog to digital, added timeout on exit.
stuck on status read where never return back to main loop.
Code run enter exit setup, enter loop but stuck here:
if(( millis()-time2)>50)
{
Serial.print("Pre StatRD"); <<-- execute this
ReadEstado(); <<-- stuck here (stack fault?)
Serial.println("Post StatRD"); <<--- Never execute this line after enter previous line procedure. Procedure continue loop itself

init ok
sensor = 98
Post butt
Millis=2963 Time=2912 Time1=2912 Time2=2912 Time3=2912
Pre StatRDReqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST

2 3 second hang, stack overlow?
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom

rdatest.ino.zip

got similar issue from rf generator test file, this is SPI out only no hardware required for test.
Abandoned migrating to native code with minor issue.

ADF4351.zip

@rromano001
Copy link
Author

rromano001 commented Sep 28, 2020

Found the possible source of original radio library from maker.pro:
http://www.mathertel.de/Arduino/RadioLibrary.aspx
or from groove library:
https://wiki.seeedstudio.com/Grove-I2C_FM_Receiver/

Examples require again add delay on setup serial library.
Matthias: serial radio work, Lcdradio not but require adaptation. Serialscan loop on scan but never stop as if wire was broken.
Grove too doesn't work, loop on seek without stopping.
Radio hardware is Ok tested with serialradio example.

Next step is to migrate to mxCubeIDE code, this platform is unreliable in my point of view.
Matthias code look professional grade but other are just looking beginner level hash of Matthias lib or grabbed somewhere else.

Screenshot from 2020-09-28 11-31-55

@rromano001
Copy link
Author

rromano001 commented Sep 28, 2020

Here file adapted from examples to just not crash on BluePills.
fmradio.zip

After some interaction seems the cause of blocking USB subsystem on Linux mint 20.
Bluetooth still work, external wired stop.
no external device listed and reboot required to restore USB port functionality.

~$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 0bda:c024 Realtek Semiconductor Corp. Bluetooth Radio
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
~$

@KenjutsuGH
Copy link

Just to understand better, are there any problems with the STM32_HID_Bootloader then?

@rromano001
Copy link
Author

rromano001 commented Sep 30, 2020 via email

@KenjutsuGH
Copy link

What options do you have under Tools?

@rromano001
Copy link
Author

rromano001 commented Sep 30, 2020 via email

@KenjutsuGH
Copy link

Hi,

I am using macOS 10.13.6 so I can not help you with the Linux stuff. I have the same settings under Tools. I also noticed that as soon as Serial.begin(115200) is executed, it takes about 1.5s before I would see output in the serial monitor.

As an example, I modified the classic Blink sketch to output some info to the serial port:

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(115200);  
  Serial.println("Serial setup done");
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("LED_BUILTIN, HIGH");
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  Serial.println("LED_BUILTIN, LOW");
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

After the upload, I never see the "Serial setup done" message being displayed. Instead of using a delay() statement after Serial.begin() , I use

while (!Serial);

With the above code, all the info is displayed in the Serial Monitor and the program keeps on running. I can close the Serial Monitor and use a program such as CoolTerm (also available for Linux) to connect to the serial port of the BP and the output continues to be displayed.

Unfortunately, I do not have a RDA5807M module to test your program. I do have the same I2C OLED display, and when I upload your program, I see info on the OLED, and the following in the Serial Monitor:

init ok
sensor = 0
Post butt
Millis=2975 Time=2925 Time1=2925 Time2=2925 Time3=2925
Post millisFrecuencia = 210
Post FreqPost Volume>BLOCK_E found.
End Loop
sensor = 0
Post butt
Millis=3147 Time=2925 Time1=2925 Time2=2925 Time3=2925
Pre StatRDReqfrom for Loop after for 

@rromano001
Copy link
Author

rromano001 commented Oct 1, 2020 via email

@KenjutsuGH
Copy link

Have you tried another upload method such as SWD or Serial?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants