• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

problem in TCA9548A I2C Multiplexer program

Q&A Forum › Category: ESP32 › problem in TCA9548A I2C Multiplexer program
0 Vote Up Vote Down
jacques asked 1 year ago

Hello All, 
I have reproduce  your code from the 
Read Multiple BME280 Sensors —TCA9548A I2C Multiplexer
example. 
I did it with a PCA9546, ( 4 channels)., with two bme280. 
 

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

Adafruit_BME280 bme2; // I2C
Adafruit_BME280 bme3; // I2C

// Select I2C BUS
void TCA9548A(uint8_t bus){
Wire.beginTransmission(0x70); // TCA9548A address
Wire.write(1 << bus); // send byte to select bus
Wire.endTransmission();
}

void printValues(Adafruit_BME280 bme, int bus) {
TCA9548A (bus);
Serial.print(“Sensor number on bus”);
Serial.println(bus);
Serial.print(“Temperature = “);
Serial.print(bme.readTemperature());
Serial.println(” *C”);
 
Serial.print(“Pressure = “);
Serial.print(bme.readPressure() / 100.0F);
Serial.println(” hPa”);

Serial.print(“Humidity = “);
Serial.print(bme.readHumidity());
Serial.println(” %”);

Serial.println();
}

void setup() {
Serial.begin(115200);
 
// Start I2C communication with the Multiplexer
Wire.begin();

Serial.println(); // Init sensor on bus number 2
TCA9548A(2);
if (!bme2.begin(0x76)) {
Serial.println(“Could not find a valid BME280 sensor on bus 2, check wiring!”);
}
Serial.println();
 
// Init sensor on bus number 3
TCA9548A(3);
if (!bme3.begin(0x76)) {
Serial.println(“Could not find a valid BME280 sensor on bus 3, check wiring!”);
}
Serial.println();
 
}

void loop() {
//Print values for sensors
printValues(bme2, 2);
delay(1000);
printValues(bme3, 3);
delay(5000);
Serial.println(” end of loop”);
}

 
It starts to work, but reboots  on the second loop (see below). I tied with a ESP32 Nodemcu board, and
with a ESP8266 Nocemcu board, with the same results. 
 
Any help will be appreciated. 
 
 

Sensor number on bus2
Temperature = 22.43 *C
Pressure = 1023.82 hPa
Humidity = 49.03 %
Sensor number on bus3
Temperature = 21.88 *C
Pressure = 1023.67 hPa
Humidity = 49.75 %
end of loop
Sensor number on bus2
Temperature = 183.89 *C
Pressure = -116.22 hPa
Humidity = 100.00 %

————— CUT HERE FOR EXCEPTION DECODER —————
Exception (3):
epc1=0x4010084d epc2=0x00000000 epc3=0x00000000 excvaddr=0x4003bff9 depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffffdb0 end: 3fffffd0 offset: 0150
3fffff00: 00000568 000000ad 3ffe85e4 40100906
3fffff10: 40202c44 3ffe889b 3ffee7b8 3ffee838
3fffff20: 3fffdad0 00000020 3ffef71c 40100c54
3fffff30: 40202c44 00000000 3fffff50 40201532
3fffff40: 3fffdad0 00000000 00000054 40201242
3fffff50: 3ffef71c 00000000 00000000 00000000
3fffff60: 00000000 00000000 00000060 000e5dc7
3fffff70: 00000000 68006d3a 93160032 0bd0d628
3fffff80: fff71835 26acfff9 10bdd80a 0171004b
3fffff90: 012f0000 001e0032 00000000 000000ed
3fffffa0: 000000a0 00000000 3ffee80c 3ffee838
3fffffb0: 00000000 00000000 3ffee80c 402035e0
3fffffc0: feefeffe feefeffe 3fffdab0 40101001
<<<stack<<<
————— CUT HERE FOR EXCEPTION DECODER —————
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v00044bc0
~ld
Ñ„.Ï.√’‰í{√Ûn<‰.$.Ñ.d`..c€…û|.sõ.dúg‡.√g„..d`.ƒ„;õ$åd.å…˛
 

Question Tags: bme280, TCA9548A
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi.
I’m not sure about that module, as I haven’t tested the PCA9546 module.
How are you powering the module? I think that needs 5V to work properly, but I’m not sure if that’s what’s causing the issue.
Regards,
Sara

0 Vote Up Vote Down
jacques answered 1 year ago

Thanks Sara for your rapid answer. 
The PCA9546 is the same as the PCA9548, but with 4 channels instead of 8. It works on 2.3V to 5.5V as the PCA9548.
I power it from the 3.3V of the NodeMcu. 
I have made some progress, as I did the same  experiment,  with HD3020 sensors instead of Bme280, and with these sensors it works properly. 
In both cases, the experiment is made with a soldered breadboard like  PCB. 
Do you think the problem could come from the calling of the bme280 ? 
Jacques 

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi again.
I don’t think so.
It seems to be like some sort of power issue. But, it’s very difficult to tell. Additionally, I don’t have any of those modules to experiment with. So, I don’t think I can help much in this subject.
 
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.