Programming Ublox GPS modules to use SPI

Thread Starter

camerart

Joined Feb 25, 2013
3,830
Hi S,
Here is the program as TXT, showing 'STRING_MAX_LENGTH' .
EDIT: I'm not allowed to post the CODE! This happens previously, and I can't recall what I had to do? I've set the 'STRING_MAX_LENGTH' to 40. (I don't think this will work for longer sentences I've seen?)

I should be sending BYTES, as this is what SSPBUF exchanges. I think the 'MidStr' selects the BYTE from the STRING, which is named 'S2M'

The BYTE ARRAY, I'm trying to send is RESET, and I'm hoping fro a response to this.

The [ "" ] and [ , ] are tests I'm trying to see what happens, I've also tried no gaps or [ , ] etc.

C.
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,830
Hi,
I think I may have found the problem?
The analyser image seems to show that the MOSI timing is shifted, so I think there's a timing issue?

I'm sending an "A" DEC 65 HEX 0x41 BIN 01000001
Analyser shows ƒ DEC 131 HEX 0x83 BIN 10000011
EDITED
C
 

Attachments

Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,830
hi,
I guess you are also trying the IDE scope when testing?

& the Watch variables
E
Hi E,
As I have a peripheral GPS connected to the PIC, so I have to use 'live'.
I use a logic analyser for testing.

I think I've found the problem! I have changed the CPOL from 1 to 0, and this appears to have corrected it, but to me it seems wrong, as the BITS WRITE from active to idle?
C.
CKE: SPI Clock Select bit(1)
1 = Output data changes on clock transition from active to idle
0 = Output data changes on clock transition from idle to active
 

ericgibbs

Joined Jan 29, 2010
21,445
hi,
IIRC, this point was raised some years ago, when we discussed it with other users.??
ie: ref the incorrect polarity of the CPOL Bit.

E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,830
hi,
IIRC, this point was raised some years ago, when we discussed it with other users.??
ie: ref the incorrect polarity of the CPOL Bit.

E
Hi E,
It is confusing!
I searched for incorrect CPOL, but didn't find it.
I'll see how I get on with it set incorrectly.
Here I'm SENDing a 'D' and it looks ok.
C
 

Attachments

Thread Starter

camerart

Joined Feb 25, 2013
3,830
Hi,
All efforts to get M8N to work with SPI failed!
Genuine modules cost 10's of £'s and I need app 5x for my project which is too much for me. The ones I bought are supposed to be genuine, but can't be guaranteed, so my guess is that they aren't genuine, and won't work with SPI.
Thanks.C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,830
Hi,
Just re-reading this thread, and since then I have tried genuine M8N modules, but there was no difference.
C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,830
Hi,
Update: It's not out of the question, that my genuine M8Ns so far, are not atually genuine, but do have genuine Ublox chips in them.

Finding genuine GPS modules, is not always easy, but I've just ordered M9N modules, again from a reliable source? so I'll check these in a similar way to above, and see if we can get them to work this time?
C
 
Top