Continuation from cog31s GPS issue.


Author Message
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 435
Posted: 07:24am 08 Oct 2019      

hi Jim and panky

thank for your helps

  panky said  
With the greatest respect, your somewhat pointed response to Geoff in your recent post on your problems, indicates that despite your lengthy resume of all your prowess and experience, you might benefit from suggestions on programming from others.


contrary to what you imply, I am quite open to any solution, otherwise I would not be on this forum. Moreover, computer requires that we learn to learn and listen and that we can question ourselves


  panky said  
1. As Jim has pointed out, it would be easier to wait on a specific character in the GPS stream before triggereing the interrupt - maybe the $ at the start of each frame then you can check for the particular frame you want eg. GPRMC has the time and speed data.

2.  Rather than just grabbing 1 character at a time with your input statement, grab at least 80 ( longer than the longest frame) then just keep everything up to the CR.


Ithink that you do not fully grasp the problem of GPS, especially underperforming Chinese modules (there is no activate writing functions and no speed change).

1 - When you start your program, you can receive any end of any frame without begin char, so you do not start with a "$". Because of this, you have to test each received character to know where your frame begins.

2 - the content of a frame is variable, depending on the state of reception of gps signals. Let's say that there are 4 states to a gps (no exchange, exchange without information, exchanges with invalid information - for example the internal clock only and no position, and exchanges with valid infos)

3 - my applications do not manage all the frames. For example for the reference clock, I only need the frame "RMC". on the other hand to do race recognition, I need almost all the frames.

4 - the current modules receive both gps and galileo or glonass, so the number of frames received in the second is more variable.

5 - if you looked at the last example that I put in the other thread, you would have seen that the more one puts of instruction in the part "reception of characters", the more one slowed strongly the duration of execution of the sub -program. And this is THE real problem: why is this duration so important, when it is only a few simple instructions (marked loop) that should be executed in less than 100 microseconds, and not more than 1 millisecond.

And i don't say about memory limitations on mx170. For exemple, it is not possible to have an array 8 by 18 (8 frames with 18 fields max) in string format, without have an memory capacity error

more generally, I think you have not understood the architecture of my program. the goal is to lose as little time as possible to read the received frame and only to store it in a rotating stack, then when there is time available, ie between two receptions of characters, we continue the work of depilation and in the right boxes.

The main loop can be interrupted as many times as necessary, it does not matter. But provided that the receiving routine leaves free time and does not take up too much CPU time. but in my case, it is this problem that annoys me. And so if, as you put it, I wait for the end of a frame to treat it, I have all the more characters to arrange, and so in this case, I would lose even frames. I tested your solution, and that's what happened to me. the more time you spend in the re-capture routine, the more chances you have to have overlapping frames.

remember that the interrupt generated by the chip does not go directly into my routine, but goes through a MMBasic layer, and what does this layer ??, you know?
What guarantee do I have that with the stop code(10), there will only be one interrupt or that, as I think, there will always be an interrupt with each character processed by MMBasic, and it's only MMbasic who after these treatments, will call my routine at the reception of the stop code. And  how many time is used by MMBasic to process internales interrupts?

Also, I know that in "UART by interrupt" pogram writing in "C" and given by Microchip, it is necessary to mask interrupt bit when you receive a char. Is it same case in MMbasic??

  panky said  
If none of that works for you, you could write your own CFunction or better still, move to another language.

I have also other GPS programs in other langages (Asm, "C" ,Pascal, Python) on other platforms. My choice depending of necessity to have more or less graphicals capacity and others reel-times process (like trip-master, car speed, alarms,etc). If I choice MMbasic, it is for simplicity (1 mx170/470 +1 GPS + 1 rtc + 1 tft 2.8"). My error is to think that a cpu (mmx470) who work at 120mghz can do more than an arduino in 16 mghz
Edited 2019-10-08 17:35 by goc30