-
Notifications
You must be signed in to change notification settings - Fork 85
Conversation
Hi @mayopan ,
The Low memory available, stability problems may occur. warning is very important. When the code in your .ino calls a function, it will push information onto the stack which uses even more RAM. Even with 305 bytes available, bad things can still happen. The stack use is not included in the dynamic memory calculation from the compiler. Something that can help is: where you use (e.g.):
always use this way instead:
The first way stores the "Module Info : " in RAM. The second way stores it in program memory.
It is better, but bad things could still happen. Now, your example 20_1 is really nice!
before the
If the #define MAX_PAYLOAD_SIZE 384 is missing, only 256 bytes are allocated for the payload. The module information exceeds that. Please try this example. It is the same as yours but is written for I2C (which most u-blox users use). Here is the output from a ZED-F9K:
If you take this example and submit it as a new PR on the master branch, then I will merge it for you. |
Hi, @PaulZC Thank you very much for your kind and very useful advice!!!
Yes! I notice it on this issue now. According to your new example, I modified again to fit UART connection (because I don't have any GPS modules with I2C output), and it works perfectly! The critical point of mine is that it uses too much RAM, as you say. On the other hand, the change of MAX_PAYLOAD_SIZE makes no difference on "processUBX: counter hit MAX_PAYLOAD_SIZE" warning. (Of course RAM usage is increased.) Now, I'm glad to hear my name is on credit in the example you cleaned up!
OK, I'll do in short time.
Best regards, |
I think I did it! |
Hi @mayopan,
This turns off all of the NMEA messages, leaving only UBX.
Or, if you need to leave some NMEA messages enabled, you can selectively turn off individual NMEA messages with (e.g.):
Have fun! |
Hi, @PaulZC Actually, I'm using M8N GPS module that has the RAM for saving the configurations. M8Q module has just 2 extensions of module information. There is no "counter hit" warning without disabling NMEA. I don't understand very much about such difference now, but I'll post if I find something. Best regards, |
Refer to #103
2.Added example20_1 (You can use getModuleInfo function without merging this PR to library)
First, PR works well on both arduino nano and arduino pro mini that uses ATmega328p.
@PaulZC concerns about RAM usage, but there is a room yet shown below.
The SoftwareSerial is slow compared with (hardware) Serial, so 19200 or lower baud rate should be used. And if the AutoPVT is enabled in high rate, it's better to be disabled before polling module info.
Second, I made a example that enable this function using SendCustomCommand without library change, followed by @PaulZC advice.
It works nearly good, but something wrong.
A part of the received payload is overwritten(?).
example8_1 works good, but example20_1 doesn't.
Is there any advice?
The result of example20_1 is shown below.
The result of example8_1 is shown below.