Remote control by location (PIC in Oshonsoft)

Thread Starter

camerart

Joined Feb 25, 2013
3,838
Hi J,
I think the problem is something to do with read timings.
Reading the ID and showing the result, before the 'read altmtr' function, results in error. Could it be that I'm setting the registers ok in 'initialisation' but these can't be checked till after the read altimeter section?
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,838
Difficult to guess.
I don't have the read altmtr code.
Hi J,
This is before reading your next comments!

The read_altmtr code has changed since:
Code:
C.
[CODE]altmtr_cs = 0
id = periph_rd(0xd0)
p_msb = periph_rd(0xf7)
p_lsb = periph_rd(0xf8)
p_xlsb = periph_rd(0xf9)
t_msb = periph_rd(0xfa)
t_lsb = periph_rd(0xfb)
t_xlsb = periph_rd(0xfc)
'Call periph_rd()  '(0xd0)
 

Attachments

Thread Starter

camerart

Joined Feb 25, 2013
3,838
Hi,
Up to yesterday, I haven't proved that I can WRITE as well as READ, either with OSH or SSPBUF.

I'm trying a test with an OSH program that READs the compass and altimeter ok.
Can I add SSPBUF into this program along side the OSH SPI and try an SSPBUF WRITE and READ?
C.
 

jjw

Joined Dec 24, 2013
823
Is the SPI setup ( clock polarity etc ) and the BMP280 setup ( measuring, filtering etc ) the same in both programs, OSH/ HW SPI
You could read the ID before, so reading should work?
 

Thread Starter

camerart

Joined Feb 25, 2013
3,838
Is the SPI setup ( clock polarity etc ) and the BMP280 setup ( measuring, filtering etc ) the same in both programs, OSH/ HW SPI
You could read the ID before, so reading should work?
Hi J,
I think the problem is with WRITE.
As the ID is fixed, I am able to READ it ok. When I WRITE to the e,g, CTRL_MEAS reg, then READ it, then it's 0 or 255.
I'll try parallel, thanks.
C.
 

jjw

Joined Dec 24, 2013
823
I don't think it is good idea to use OSH SPI and HW SPI parallel.
It may mess the chip selects etc.
Show the periph_wr() procedure, not the periph_wr() function, which may have a problem.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,838
I don't think it is good idea to use OSH SPI and HW SPI parallel.
It may mess the chip selects etc.
Show the periph_wr() procedure, not the periph_wr() function, which may have a problem.
Hi J,
I've been trying using SSPBUF independantly, for months, and not proved WRITE READ, this is out of despoaration.
I'll give it a try, for a while, and see. Hopefully, I'll find the formulae.

EDIT: Those functions are for examples for me to use. I won't use functions or procedures for this these tests, as they are confusing.
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,838
What is the clock speed of the PIC and the SPI?
Hi J,
When in SSPBUF programs, I use 64MHz at the moment, I'm using an OSH program set to 8MHz

I think this is what you ask regarding SPI clock [ SSPCON1.SSPM3 = 0 '0010 = SPI Master mode, clock = FOSC/64 ]
C
 

Thread Starter

camerart

Joined Feb 25, 2013
3,838
I don't think it is good idea to use OSH SPI and HW SPI parallel.
It may mess the chip selects etc.
Show the periph_wr() procedure, not the periph_wr() function, which may have a problem.
Hi J,
I think you're correct, that there can't be two SPI setups.
In the test I could see the CS going low 2x times, but nothing inside them.
So back to SSPBUF only programs.
C.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,838
What was wrong?
Hi J,
If I compare my proof reading with safe cracking, eventually it's likely to open :)

Hi J in t,
There's going to come a day, when I have to convert my CODE into your program format, gulp! Actually, it may not be that difficult?
C
 
Last edited:
Top