Problem With CMPS14 Compass

John Todd

Member
New Thread Re CMPS14 Compass
Compass was working very well into terminal
This compass is highly accurate
Now getting Timedout in terminal
Tried several 08M2 and 2 Compass Modules
Checked Terminal and Downloads OK
Code:
;Latest Iteration of CMPS14 compass test
;with Great Help from "Hippy'
#Picaxe 08M2
#Terminal 4800
#No_Data
;Dated 25-12-2019
;--------------Compass PORT
Symbol TX_PIN = C.1 ;CMPS14 TX PIN 9600"Green"
Symbol RX_PIN = C.2 ;CMPS14 RX PIN 9600"Yellow"
;----------------
Symbol direction = w1 ; b3:b2
Symbol dir.lsb = b2
Symbol dir.msb = b3
;--------------------------------------------
;Power On Reset:
Pause 2000
SerTxd( "Started", CR, LF )
;---------------------Cut----------------------------
MainLoop:
;----------------------------------------------
Do
High TX_PIN
SetFreq M32
Pause 100
SerOut TX_PIN, T9600_32, ( $13 ); Get Bearing CMPS Code 0x13
SerIn [16000,TimedOut], RX_PIN,T9600_32, dir.msb, dir.lsb
SetFreq MDEFAULT
Pause 100
SerTxd("Degrees = ",#direction,CR,LF);Output to Terminal
Pause 5000;5 Second Pause
    Loop
Timedout:
SetFreq MDEFAULT
Pause 100
SerTxd( "Timed out", CR, LF )
Goto MainLoop
 
Last edited by a moderator:

hippy

Technical Support
Staff member
Given that multiple 08M2's and CMPS14's are not working I would guess it's something to do with the hardware. Perhaps the CMP14's are configured for I2C rather than serial, are using a different baud rate to 9600. It could be wiring disconnected, crossed-over, or supply voltage too low.
 

John Todd

Member
Given that multiple 08M2's and CMPS14's are not working I would guess it's something to do with the hardware. Perhaps the CMP14's are configured for I2C rather than serial, are using a different baud rate to 9600. It could be wiring disconnected, crossed-over, or supply voltage too low.
 

John Todd

Member
I have tried all the items as posted. The mode Pin is connected to 0V and selects Serial Out. Vcc is 5 Volts
What I can't understand is the fact that the code as supplied by"hippy" was working without any problems
and giving excellent results over a period of 2 days, before getting timed out messages.
I have checked the AXE 027 serial port on Com.5 and the latency is 16 milliseconds and as programmed at 9600
Grateful ,for any further help.
I will post any further attempts
Thank You
John
 

hippy

Technical Support
Staff member
What I can't understand is the fact that the code as supplied by"hippy" was working without any problems and giving excellent results over a period of 2 days, before getting timed out messages.
It is odd because what was working should keep on working. And, if something has blown-up, swapping it for something new should have everything working again.

The "Timed out" messages suggests it's the CMPS14 not responding to the PICAXE or not receiving the command to respond. This would almost definitely class it as a PICAXE-side problem rather than an issue with PE6 or the AXE027.

You could take PE6 and AXE027 out of the equation by adding a HIGH:PAUSE:LOW sequence for a pin immediately after the SERIN:SETFREQ commands. You could use a multi-meter to watch voltage on that pin or use a LED plus R to flash when activated. If the voltage goes to near V+, or the LED flashes, the PICAXE is receiving data from the CMPS14.

If that does trigger when the AXE027 is unplugged, doesn't when it's plugged in, that would be a surprise, but perhaps worth checking as I can see few explanations otherwise.

The only other thing to check is the PICAXE to CMPS14 wiring and breadboard if used. It is possible that wires can break, headers come loose or lose contact, even breadboard tracking can go open circuit.
 

mikeyBoo

Senior Member
hi John,
I played with a CMPS11 a few years back (auto-steering for my yak project) & it appears the CMPS14 is an improved version. I remember talking to it with a USB to TTL serial adapter (as used with Arduino) & it worked fine. Of course, DO NOT hook up a standard RS232 (+/- 12v levels) as it would damage the device. The Picaxe USB to serial inverts the TTL levels so that won’t work with a PC terminal program.

If you have an Arduino-style USB to TTL serial adapter, you should be able to talk to the CMPS14 direct from your PC using a terminal program (e.g. TeraTerm). This will let you know if the problem is in the CMPS14 or the Picaxe connections.
If my memory is correct, sending hex 0x11 (Control-Q) makes it reply with the version number.
Good luck with your project.
 

Flenser

Senior Member
John,

You've tried several 08M2 and 2 Compass Modules and that has not help identify where the problem lies.

My suggestion is that you first test the Compass Module(s) in isolaton by connecting the module to your PC with a USB-to-serial adaptor and communicate with them using a serial terminal.
e.g. setup the PE terminal to communcate @4800 baud on the COM port your USB-to-serial adaptor creates, send the value $13 and see whether you get a response.

If you can confirm that the Compass Modules are replying to the $13 then they can be eliminated as the cause of your probllem.
If they are not working then there is no point spending time testing different PICAXE chips or changes to the code.
 

John Todd

Member
hippy,
Sorry if I posted incorrectly
My Setup:-
I use one of those development sockets
with the Clamp Lever,Mounted on Strip-Board
definitely NO S/C or O/C
I have it setup on a Test Bed with Hand/Held Compass
attached.
Power Supply = 5.0V
AXE 027 Attached
I use Logic Probe & CRO connected to C.1
Logic Probe indicates Negative going Pulses On C.1
CRO indicates approx. 4 bunched negative going pulses
within 1ms time period at a level of approx.-4.0v
Output NO response on C.2
I have 2 x CMPS14 & both have same problem.
Both initially worked OK.
Like you said it indicates a faulty acquisition problem.
Like you I find it hard to understand, seeing that I could run
over 2 days On/Off with excellent Results
My thoughts are now leaning towards an I2C method using a
014M2.
Thanks to all forum helpers
I have posted separately on this, forum thoughts are
most welcome
Regards,John
 

lbenson

Senior Member
It makes it easier to follow what your problems are and what you have tried if you keep it all in single thread.
 

hippy

Technical Support
Staff member
I merged the above two posts to this thread - It does, as lbenson notes, make sense to keep all related posts in one thread, not least that one can better appreciate what C.1, C.2 etc mentioned relate to.

There's no problem with discussion of using I2C for the CMPS14 being in its own separate thread because that is distinct to using RS232-style serial.

In fact it's probably best to keep serial and I2C discussions separate or it will likely quickly get confusing.
 

hippy

Technical Support
Staff member
I use Logic Probe & CRO connected to C.1
Logic Probe indicates Negative going Pulses On C.1
CRO indicates approx. 4 bunched negative going pulses
within 1ms time period
That sounds roughly right. Sending $13 out on C.1 using T9600 should show -
Code:
___   ___     _       ____
   |_|   |___| |_____|
      1 1 0 0 1 0 0 0

   |<--------------->|
   |      ~940us     |
If it's not close to that there could be something else going on. It could be that the module is in I2C mode while the PICAXE is using serial.

at a level of approx.-4.0v
You might have clarify that because the voltage should never go negative. Perhaps the scope probe's 0V is not connected to 0V.

If the low is dropping to 4V from 5V that suggests a wiring issue somewhere, perhaps a missing 0V connection.

If it's dropping to 1V, from 5V, hence (-4V), that is better but one would normally expect the low to be more closer to 0V.

Perhaps disconnect the CMPS14 from the circuit and the PICAXE and measure it without the CMPS14 load.

Output NO response on C.2
What voltage level is being seen on C.2 ?

For T9600 serial the voltage should about 5V. If it's not, is closer to 0V, that may also be an indicator that the CMPS14 is in I2C mode.
 
Top