Forum Rule: Always post complete source code & details to reproduce any issue!
Page 5 of 5 FirstFirst ... 3 4 5
Results 101 to 111 of 111

Thread: uBlox Library

  1. #101
    Junior Member
    Join Date
    Mar 2019
    Posts
    14
    @brtaylor-


    I want to give you a link to the question I raised on the Arduino forum.

    http://forum.arduino.cc/index.php?topic=604991.0

    All persist in insisting that the UBLOX library does not provide work in the mode of continuous long data reception. I disagree with them! But no one was able to explain the patterns observed by me with exceeding 240 bytes and with always successful first parsing after CPU reset. Maybe you will be interested. I believe that everything is connected with a buffer overflow between two parsing and I suggest to clear it with each failed parsing (when the PVT package is not identified). Approximately as I was advised on the forum:
    Code:
    bool UBLOX::_parse(uint8_t msg_class,uint8_t msg_id,uint16_t msg_length)
    {
    	// read a byte from the serial port
    	while (_bus->available()) {
    		_byte = _bus->read();
    		// identify the packet header
    		if (_parserState < 2) {
    			if (_byte == _ubxHeader[_parserState]) {
    				_parserState++;
    			} else {
    				_parserState = 0;
    //************ clean serial buffer ***************
    
     while(Serial.available()) Serial.read();
    
    //*******************************************
    			}
    		} else {
    			if ((_parserState - 2) < msg_length) {
    				*((uint8_t *) &_tempPacket + _parserState - 2) = _byte;
    			}
    			_parserState++;
    			// compute checksum
    			if ((_parserState - 2) == msg_length) {
    				_calcChecksum(_checksum,((uint8_t *) &_tempPacket),msg_length);
    			} else if ((_parserState - 2) == (msg_length + 1)) {
    				if (_byte != _checksum[0]) {
    					_parserState = 0;
    				}
    			} else if ((_parserState - 2) == (msg_length + 2)) {
    				_parserState = 0;
    				if (_byte == _checksum[1]) {
    					memcpy(&_validPacket,&_tempPacket,sizeof(_validPacket));
    					return true;
    				}
    			} else if (_parserState > (msg_length + 4) ) {
    				_parserState = 0;
    			}
    		}
    	}
    	return false;
    }
    Do you think my proposal is correct?

  2. #102
    Member
    Join Date
    Jan 2016
    Location
    USA
    Posts
    45
    Hi Brian,
    I'd been successfully using another UBLOX parser, but saw that you'd updated yours and so .....
    Using the Master library with UBLOX8.h and UBLOX8.cpp, the included example needs some work. It loads UBLOX.h which of course isn't there.
    By any chance have you uodated the example somewhere to agree with your code improvements?

    best regards,

    john

    PS: I found another iteration of your library which works fine. In my earlier use of another parser, I Ublox meant I could only read lat/lon. Was that incorrect?
    Last edited by jferguson; 05-11-2019 at 02:36 PM.

  3. #103
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    522
    Quote Originally Posted by jferguson View Post
    Hi Brian,
    I'd been successfully using another UBLOX parser, but saw that you'd updated yours and so .....
    Using the Master library with UBLOX8.h and UBLOX8.cpp, the included example needs some work. It loads UBLOX.h which of course isn't there.
    By any chance have you uodated the example somewhere to agree with your code improvements?

    best regards,

    john

    PS: I found another iteration of your library which works fine. In my earlier use of another parser, I Ublox meant I could only read lat/lon. Was that incorrect?
    My latest and greatest is typically on GitHub, so this one should work fine:
    https://github.com/bolderflight/UBLOX

    It shows printing several values, but a full list of available methods to get data is located here:
    https://github.com/bolderflight/UBLOX#data-retrieval

  4. #104
    Member
    Join Date
    Jan 2016
    Location
    USA
    Posts
    45
    Hi Brian,

    I had thought, apparently wrongly, that the 10 Hz binary signal from an M8N could not include the clock data. Accordingly, my 2016 flight data recorder included a clock module. In addition to having time fields in each record, I used its output to name the flight-data files recorded in a micro-sd; 100101.csv for example. This would be a file created at 10:01.01 I had to do this so that on a day with 5 or 6 flights i would have discrete files which could be associated with particular flights.

    When present system is powered on, it writes a sequence of reports to SERIAL1 which is connected by removable cable to a little nano powered oled display terminal in a 3d printed box. After not-showing any killer error reports, it displays vacc, and hacc. this way I know when the GPS has settled down and a flight can commence.

    since the external clock works all the time, I can label and initialize the SD file as an early step in the SETUP. If I now depend on the clock in the gps, I will need to watch the gps output until it locks on and provides a usable clock signal, then initialize the sd file and start everything else.

    The usual clock modules do not output sub second intervals. Although I replaced the chip on one of AdaFruit's clocks with a chip that did, I foundered on modifying the code to output the 1/100s. I was getting ready to add a millis function to make my own sub-seconds, but now with your code can just read them from the gPS output. And I also can take the clock modules out of the planes.

    I realize that none of this may seem great shakes to people farther along this route than I am, but to me it's amazing that I can do this stuff and the code and equipment to do it with is so readily available.

    Cheers,

    John

  5. #105
    Member
    Join Date
    Jan 2016
    Location
    USA
    Posts
    45
    Bingo,
    After some fussing with Ublox-Center, I was able to configure my M8N to emit what your code was looking for. Works great and will allow me to clean up my data-recorder code.
    Thanks much,

    john

  6. #106
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    522
    Quote Originally Posted by jferguson View Post
    Bingo,
    After some fussing with Ublox-Center, I was able to configure my M8N to emit what your code was looking for. Works great and will allow me to clean up my data-recorder code.
    Thanks much,

    john
    Good! Glad it's working well for you.

    Brian

  7. #107
    Member
    Join Date
    Jan 2016
    Location
    USA
    Posts
    45
    Hi Brian,

    The may be more of an aesthetic issue, but i need a routine to wait for the Ublox to start emitting real data before continuing my program. I'm using the clock functions to name the files I'm recording on the microSD, such that a file started at 13:05.22 would be named 130522.csv . I'm constrained to 6 characters before the extension and since I dump the files to a computer for analysis every day, I can sort them by date by the datestamp the computer puts on them. This scheme was a shot at how to name files for a series of flights without having them write over each other.

    When I was using an RT clock, there was no problem because enough of the rest of the setup had run by the time the clock was read that it was sure to be sending out good data.

    But with the UBLOX that's not so certain.

    My solution is to read the year and continue when it reads 2019.

    Is there a more elegant way to do this? One that I won;t have to remember to change the year in the code nest January?

    John

    PS: This is what I did. Seems simple enough
    Code:
     if(gps.readSensor()) {
        int year=(gps.getYear());
        if(year==2019){
        Serial.print(gps.getYear());  
        etc, etc,
    Last edited by jferguson; 05-25-2019 at 02:59 PM.

  8. #108
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    522
    Quote Originally Posted by jferguson View Post
    Hi Brian,

    The may be more of an aesthetic issue, but i need a routine to wait for the Ublox to start emitting real data before continuing my program. I'm using the clock functions to name the files I'm recording on the microSD, such that a file started at 13:05.22 would be named 130522.csv . I'm constrained to 6 characters before the extension and since I dump the files to a computer for analysis every day, I can sort them by date by the datestamp the computer puts on them. This scheme was a shot at how to name files for a series of flights without having them write over each other.

    When I was using an RT clock, there was no problem because enough of the rest of the setup had run by the time the clock was read that it was sure to be sending out good data.

    But with the UBLOX that's not so certain.

    My solution is to read the year and continue when it reads 2019.

    Is there a more elegant way to do this? One that I won;t have to remember to change the year in the code nest January?

    John

    PS: This is what I did. Seems simple enough
    Code:
     if(gps.readSensor()) {
        int year=(gps.getYear());
        if(year==2019){
        Serial.print(gps.getYear());  
        etc, etc,
    A couple of ways I can think of at the moment:
    1. You could look at the fix type and ensure that you have a time fix or better (i.e. 2D or 3D).
    2. You could look at the isValidDate() flag and the isConfirmedDate. If both those are true, you should have valid a valid date available.

  9. #109
    Member
    Join Date
    Jan 2016
    Location
    USA
    Posts
    45
    Thanks again, Brian. I'll add these to the setup.

  10. #110
    Member
    Join Date
    Jan 2016
    Location
    USA
    Posts
    45
    Brian,
    I apologize for waltzing you through all of my difficulties, but they seem to continue. I'm now confronted by the possibility that two of my Ublox M8N's are counterfeit. Both have lost ability to talk completely with U-Center. I'm running U-Center 19.04 on Windows 10. It can modify setup on the M8N's but not poll them.

    The last time I used U-Center was three years ago and I had no problem with it. I don;t know what version it was, and it was probably running on Vista 7.

    I'm warming up to try UBX commands on them to see if at least I can reset them to default - the U-center command won't do it. I'm also going to buy a new module, probably from SparkFun.

    I can vaguely remember having to include gps commands in an autopilot routine that i wrote for one i cobbled up for our boat, but that was for another gps. It did work.

    So I guess the easiest question, is which version of U-Center are you using?

    I'm off on a 3 week trip, so won't be able to try anything until i get back.

    best regards,

    John

  11. #111
    Member
    Join Date
    Jan 2016
    Location
    USA
    Posts
    45
    I think I found my problem. i used to use an Ardhuino Uno with RST shorted to ground as a signal booster to connect the Ublox GPS module to the USB port on the computer. The Uno is a bit clumsy for this and I thought I'd do the same thing with a Nano. I made some very nice pcb boards about the size of nanos that had two ports, one an I2C port and the other a serial. I added a swtich to ground the RST for when I wanted a serial pass through.

    It appears that the USART on the Nano doesn't work the same way, and this connection wasn't really working. It looks like signals sent to the GPS weren't really getting through.

    One more surprise. I'm still on my trip so cannot confirm this until i get home in a couple of weeks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •