Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using modem on one core, and another I2C device on another #66

Open
Bfreak opened this issue May 6, 2024 · 4 comments
Open

using modem on one core, and another I2C device on another #66

Bfreak opened this issue May 6, 2024 · 4 comments

Comments

@Bfreak
Copy link

Bfreak commented May 6, 2024

Hi. I am trying to run an MQTT script on one core, and read data from another i2c device on the other core, using freertos to do so.

When I try to do this, I get 'failed to initialize power' from the modem.

The MQTT tasks has default code:

void MQTT_task_setup(void *pvParameters) {

    Serial.begin(115200);

    //Start while waiting for Serial monitoring
    while (!Serial);

    vTaskDelay(3000);

    Serial.println();

    if (!PMU.begin(Wire, AXP2101_SLAVE_ADDRESS, I2C_SDA, I2C_SCL)) {
        Serial.println("Failed to initialize power.....");
        while (1) {
            vTaskDelay(5000);
        }
    }

and the other i2c has code

void hall_task_setup(void *Parameter) {
  Serial.println("Starting Hall_get setup");

  Wire.begin(13, 21); 

  if (! sensor.begin_I2C()) {    
  //if (! sensor.begin_SPI(MLX90393_CS)) {  // hardware SPI mode
    Serial.println("No sensor found ... check your wiring?");
    while (1) { vTaskDelay(10); }
  }
  Serial.println("Found a MLX90393 sensor");

Both can run independantly using freertos. Any suggestions? Thanks.

@lewisxhe
Copy link
Contributor

lewisxhe commented May 7, 2024

There is only one Wire. You initialized it twice. Of course it cannot run. You need to change one to Wire1.

@lewisxhe
Copy link
Contributor

lewisxhe commented May 7, 2024

According to the question you raised, #65, you directly pass the PMU initialization to Wire1, so that your sensors will not conflict

@Bfreak
Copy link
Author

Bfreak commented May 7, 2024

thanks @lewisxhe but I have a new problem: I currently can only upload script when I connect via usb holding boot button , but get nothing in terminal. When I try and connect without boot I get either *** [upload] Error 1 or error 13: could not open port when I try and open any connection. Any suggestion?

@lewisxhe
Copy link
Contributor

lewisxhe commented May 8, 2024

README Tips 15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants