SPI PIC 18F4620 and BMP280 (In Oshonsoft)

jjw

Joined Dec 24, 2013
823
Proc spi_wr_rd()'###################################################

altmtr = 0
WaitUs 10
While Not SSPSTAT.BF
Wend
t1.LB = SSPBUF < - - - - - remove this
WaitUs 2
altmtr = 1

End Proc

The calibration parameters are read in the for next loop
for i =0 to 23
adr= 0x88+i......
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
Proc spi_wr_rd()'###################################################

altmtr = 0
WaitUs 10
While Not SSPSTAT.BF
Wend
t1.LB = SSPBUF < - - - - - remove this
WaitUs 2
altmtr = 1

End Proc

The calibration parameters are read in the for next loop
for i =0 to 23
adr= 0x88+i......
Hi J,
Result: with line removed.
C
 

Attachments

jjw

Joined Dec 24, 2013
823
Have you made the setup for the BMP280?
Try to read the chip id.
It can be read after power up.
Address is 0xD0, id=0x58
 

jjw

Joined Dec 24, 2013
823
I mean the initialisation code by changing SPISend to hw spi.

Code:
INITIALISATION  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
    altmtr = 0  'CHIP SELECT BMP280 ON
    'SPISend 0x60  'WRITE 0xe0 RESET ADDR [Is this needed?]
    'SPISend 0xb6  '%10110110 RESET TO 0x00
    Write 0x60, 0xb6
    altmtr = 1  'CHIP SELECT BMP280 OFF
    altmtr = 0  'CHIP SELECT BMP280 ON
    'SPISend 0x74  'WRITE 0xF4 Control CTRL_MEAS reg addr
    'SPISend 0x5f  '%01011111 T/ON P/ON 't_x2 px16 Normal Mode
    Write 0x74, 0x5f
    altmtr = 1  'CHIP SELECT BMP280 OFF
    altmtr = 0  'CHIP SELECT BMP280 ON
    'SPISend 0x75  'WRITE 0xF5 Control CONFIG reg addr
    'SPISend 0x1c  '%00011100 osrs_t 0.5ms Table 11-11R filter x16 table 6
    Write 0x75, 0x1c
    altmtr = 1  'CHIP SELECT BMP280 OFF
What are the Write commands?
Do you mean hw spi to send the codes?
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
I mean the initialisation code by changing SPISend to hw spi.

Code:
INITIALISATION  IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
    altmtr = 0  'CHIP SELECT BMP280 ON
    'SPISend 0x60  'WRITE 0xe0 RESET ADDR [Is this needed?]
    'SPISend 0xb6  '%10110110 RESET TO 0x00
    Write 0x60, 0xb6
    altmtr = 1  'CHIP SELECT BMP280 OFF
    altmtr = 0  'CHIP SELECT BMP280 ON
    'SPISend 0x74  'WRITE 0xF4 Control CTRL_MEAS reg addr
    'SPISend 0x5f  '%01011111 T/ON P/ON 't_x2 px16 Normal Mode
    Write 0x74, 0x5f
    altmtr = 1  'CHIP SELECT BMP280 OFF
    altmtr = 0  'CHIP SELECT BMP280 ON
    'SPISend 0x75  'WRITE 0xF5 Control CONFIG reg addr
    'SPISend 0x1c  '%00011100 osrs_t 0.5ms Table 11-11R filter x16 table 6
    Write 0x75, 0x1c
    altmtr = 1  'CHIP SELECT BMP280 OFF
What are the Write commands?
Do you mean hw spi to send the codes?
Hi J,
The above CODE was probably from a failed test, before I had don't use WRITE explained.

I am hoping to change all of the SWSPI sections to HWSPI.

With the SWSPI the BMP280 'Compensation parameters' were READ before the INITIALISATION, see attached program section and RESULT. Getting this first READ working with HWSPI seems the easiest for me to try, especially if I first READ only one BYTE? or WORD?

EDIT: I'm going to start again, starting from 'E's' TEST1 programs, and adding in the BMP280, see if I get an improvement.
C.
 

Attachments

Last edited:

ericgibbs

Joined Jan 29, 2010
18,766
hi C,
Got this feedback from Vlad.
E

Hello Eric,
Thank you for reporting this.
I found errors in the cfg files for 18f2331 and 18f2431 devices
related to CONFIG3H configuration and I just fixed them for the
latest software builds.
Please download the updated software:
All the best,Vladimir
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
hi C,
Got this feedback from Vlad.
E

Hello Eric,
Thank you for reporting this.
I found errors in the cfg files for 18f2331 and 18f2431 devices
related to CONFIG3H configuration and I just fixed them for the
latest software builds.
Please download the updated software:
All the best,Vladimir
Hi E,
Good news that Vlad replied:)
I've updated to the latest 18.
I guess that the 18F4431 is also affected!
No change!
This program is on the MASTER 18F4620, no 18F4431 at present, and still not working.

There is a line [ ss = 1 ] just above the [ SSPCON ] section, is this relevant?
C.
 

ericgibbs

Joined Jan 29, 2010
18,766
Hi C,
I have the same problem as 'jjw' those prints are almost unreadable, this is why I prefer alphanumeric printouts ie : pref UART shots.
E
 
Top