View previous topic :: View next topic |
Author |
Message |
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Tue Sep 12, 2023 12:02 pm |
|
|
did you change the speed?
What does the I2C scanner give you? _________________ Google and Forum Search are some of your best tools!!!! |
|
|
pekka1234
Joined: 28 May 2017 Posts: 83
|
BME280 error |
Posted: Tue Sep 12, 2023 12:16 pm |
|
|
OK I changer the CPU to PIC18F2620 and it workded
I2C Device found at address 0xec
I2C Device found at address 0xec
I2C Device found at address 0xec
I2C Device found at address 0xec
Pekka |
|
|
gaugeguy
Joined: 05 Apr 2011 Posts: 303
|
|
Posted: Tue Sep 12, 2023 12:22 pm |
|
|
reread what you have been told about your code.
1000000 does not equal 100000 does not equal 10000 |
|
|
pekka1234
Joined: 28 May 2017 Posts: 83
|
|
Posted: Tue Sep 12, 2023 12:29 pm |
|
|
OK. I took copy of library
#ifndef BME280_I2C_BAUD
//spec says max i2c clock is 3.4MHz, but I wasn't getting anywhere near that fast.
// #define BME280_I2C_BAUD 1000000
#define BME280_I2C_BAUD 100000
#endif
Then I took coy of my main program
#use delay(internal = 1MHz)
Can they be faults?
Pekka |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Tue Sep 12, 2023 12:41 pm |
|
|
Baud rate setting for I2C and the #use delay are different.
A line like this sets the I2C baud rate:
#use I2C(MASTER, I2C1, FAST = 10000) _________________ Google and Forum Search are some of your best tools!!!! |
|
|
pekka1234
Joined: 28 May 2017 Posts: 83
|
BME280 error |
Posted: Tue Sep 12, 2023 12:48 pm |
|
|
I thing that they can be different.
I2C is quite different than CPU speed.
#include <18F2620.h>
#DEVICE ADC=10
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES BROWNOUT //Reset when brownout detected
#FUSES PUT //Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT //Program memory not write protected
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES NOMCLR //Master Clear pin not enabled
#FUSES NOWRT
#use delay(internal = 1MHz)
#use rs232(baud=9600, parity=N, UART1, errors, bits=8, BRGH1OK) // RS232 settings
What I must change?
Pekka |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Tue Sep 12, 2023 12:55 pm |
|
|
Nothing it that code.
Way back in this thread TTelmah told you to do this:
Quote: | #define BME280_I2C_BAUD 100000
#include <BME280.c>
|
The Baud rate definition above is used in this line to set the baud rate:
#use i2c(MASTER, SCL=PIN_BME280_SCL, SDA=PIN_BME280_SDA, STREAM=STREAM_I2C_BME280, NOINIT, FORCE_HW, FAST=BME280_I2C_BAUD) _________________ Google and Forum Search are some of your best tools!!!! |
|
|
pekka1234
Joined: 28 May 2017 Posts: 83
|
BME280 error |
Posted: Tue Sep 12, 2023 1:02 pm |
|
|
OK
I changed this
#define BME280_I2C_BAUD 100000
#include "BMe280.c"
But it doesn't help.
Pekka |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Tue Sep 12, 2023 1:06 pm |
|
|
Change the quotes to brackets so it uses the original driver (if you haven't modified it)
<BMe280.c> _________________ Google and Forum Search are some of your best tools!!!! |
|
|
pekka1234
Joined: 28 May 2017 Posts: 83
|
BME280 error |
Posted: Tue Sep 12, 2023 1:14 pm |
|
|
OK
I changed it
#define BME280_I2C_BAUD 100000
#include <BMe280.c>
Here is the result
Vesion check 0
Error reading BME280 sensor!
Vesion check 0
Error reading BME280 sensor!
==
Do you have some other my error.s ?
This senor works normally, but do not give humidity value.
With BMP280 library
It work 8MHz and normal I2C
Pekka |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Tue Sep 12, 2023 1:19 pm |
|
|
Sounds like you modified the BME280 driver in the CCS Driver directory which
should never be done. Always make a copy and change the name if you want
to make changes to a CCS supplied driver. You need to restore the original. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
pekka1234
Joined: 28 May 2017 Posts: 83
|
BMe280 |
Posted: Tue Sep 12, 2023 1:32 pm |
|
|
OK, I took a new copy from CCS drovers and installed to to same place
I compiler it , and move to my sensor,
No change.
This was a result
Version check 0
Error reading BME280 sensor!
You have helped me much, but now I have to go sleep,
The clock is about 22:30 here
Pekka |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Wed Sep 13, 2023 7:38 am |
|
|
The obvious thing would be that you actually have the BMP280, rather than
the BME280. Can you look at the top of the chip with a magnifying glass?.
The part number on this would be what says it is the BME rather than the
BMP. Possibly the board you have was built with the wrong chip for
what is printed on the silk screen.....
You could also read the chip ID. This is 0x60 for the BME, and 0x58 for
the BMP.
The CCS driver does work. I have it reading these sensors. Use 400KHz,
which is the maximum that you should use without active pull-ups. |
|
|
pekka1234
Joined: 28 May 2017 Posts: 83
|
BME280 error |
Posted: Wed Sep 13, 2023 11:13 am |
|
|
Thelmah
It may be BMP280, although it says clearly BME280, because my program with BMP280.c works well, with SCO ground or without SCO ground.
The only problem is that can't measure humidity.
It now outside for measuring, but tomorrow I will try it with CCS BMP280.c library again.
Pekka |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Wed Sep 13, 2023 11:51 am |
|
|
I think you mean SDO.
This must never be allowed to float. It can be pulled up or down.
If it is pulled up and the code still works, then this implies the chip
is not a real BMx280. This would change the I2C address and the code
as has been posted will no longer work. |
|
|
|