Hi E,The image in #14 clearly shows the Clock is inverted to the sense that the Compass is expecting
Data should be Read/Written on the Rising edge of the Clock
Look at Figure 7.2 of the compass d/s
Do you still have the old working version of the compass program?Hi J,
1/ I think J2 has answered this.
2/The analyser shows what's arriving at the MISO PIN, mostly without error, the PIC hasn't been READing the DATA.
These tests are the whole program. You may recall in my other threads, that this COMP module has had a lot of testing, including MAGMASTER the clever calibrating programs, and has given good results, with maybe some errors.
The GPS uses an INTERRUPT, which is ON. This was asked previously, and I tried switching the INTERRUPT of with the same results.
The 18F4620 D/S gives alternatives for the CLK, the AK8953C COMP only has one MODE.
3/ I carried out the i=0 to 7 test, but it gives the same confusing results, as we are looking at.
All of the other peripherals are working, but only the C/S from the COMP is being READ, if I changed the C/S to one of the other modules, then it would be working OK.
C
Hi E,If you are using SW SPI in the program for the MASTER, change the sense of the clock, INVERT, as @jjw pointed out.
Hi J,Do you still have the old working version of the compass program?
Try it without anything in the main program and if it works, use it. You have tried lately HW Spi etc. Maybe something is wrong in the compass setup or somewhere else.
Hi E,For SW SPI, Oshonsoft uses SPICSON/OFF as CS , so how are you sending a /CS to the Compass.?
Hi E,
For the BMP280 ALTITUDE C/S
[ Symbol altmtr = LATD.1 'BMP280 BAROMETER/TEMP ]
-------------------------------------------------
SPICSOn
For i = 0 To 23
altmtr = 0 'CHIP SELECT BMP280 ON
adr = 0x88 + i
SPISend adr
SPIReceive data
b(i) = data
altmtr = 1 'CHIP SELECT BMP280 OFF
Next i
SPICSOff
--------------------------------------------------
In an earlier post 'J' asked if the SPICSON/OFF was necessary, so we tried commenting it out, resulted in no change, as if it wasn't needed.
I'm now wondering if some of the replies are at cross purpose, and SW/HW could refer to UART not SPI, as it wasn't shown at the time. Perhaps I'll add SPICSON/OFF back in.
The above form of CODE works for all other peripherals.
C.
HW/SW was never about UART.Hi,
I just tried to change SSPSTAT and SPCON1 to the best of my abilities, but it still errors
I'm happy to test any other settings
C
Hi J,HW/SW was never about UART.
In #34 you said you have tried out different settings in HW SPI. Have you already disabled HW SPI?
This has been said a few times before:Hi J,
Ok, it's only me that got it mixed up then.
Am I correct that when this is used
--------------------------------------------
Define SPI_SCK_REG = PORTC
Define SPI_SCK_BIT = 3
Define SPI_SDI_REG = PORTC
Define SPI_SDI_BIT = 4
Define SPI_SDO_REG = PORTC
Define SPI_SDO_BIT = 5
SPIPrepare
--------------------------------------
We're using HWSPI?
If so then that's all I'm using.
Can you give me an example of SWSPI please?
EDIT: It's just coming to me!! Am I correct that when we transferred DATA between MASTER and SLAVE PICs, we uses SWSPI and SSPFUF etc? If so then that's switched off, and we're using SEROUT/SERIN for that DATA transfer.
C
Hi J,This has been said a few times before:
Oshonsoft Basic uses SW SPI. It can be used in all PICs. It does not use SPI hardware unit.
Defines for SPI pins, SPI_Send, SPI_Receive are for SW SPI.
SSBUF, SSPCON, SSPSTAT are registers in SPI hardware unit.
Morning E,hi,
There is no need to look online for Oshonsoft SPI, it is all in the Manual.
Extracts:
Hi J2,I can appreciate your uncertainty about SW and HW SPI. Also note, I know very little about Oshonsoft.
However, if whatever I was doing was using a Special Function Register (SPF), I would consider the communication to be hardware or at least a bastard mix of the two.
Examples:
View attachment 189375
View attachment 189376
Hi J,1) I don't know
2) Do you see in the analyzer is the MISO stuck at low or high when faulty results are coming or is some but faulty data seen ?
Are these tests of the whole program or just the compass?
Are the interrupts enabled?
Is the clock polarity specified in D/S ?
Try a test with reading only registers 0x80 -0x87
For i=0 to 7
addr=0x80+i
......
etc.
Data from 0x80 is device I'd=0x48
Is the analyzer picture a screen capture from a PC?Hi,
Hi J,
I have edited the image in #43 to show the RECEIVED BYTE from 0x80 SEND. It shows [ 0x48 ] the CHIP ID.
NOTE: The top analysis is when the COMP is working, and the bottom one is from a none working analysis. To me they look the same
So the DATA is arriving at the PIC MISO PIN. Which means that the COMP is working.
This doesn't alter what still looks like a possible Clock phase problem.
C.
Hi J,Is it po
Is the analyzer picture a screen capture from a PC?
Is it possible to have it with a better resolution and some other format than jpg, for example png or gif
The picture is now mostly unreadable.
by Duane Benson
by Aaron Carman
by Duane Benson