Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· OpenAIAi2 WildChat-4.8M (AI2)

hi, the following code has this error, load:0x40078000,len:13964…

  1. User

    hi, the following code has this error, load:0x40078000,len:13964 load:0x40080400,len:3600 entry 0x400805f0 Setup complete Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

    Core 1 register dump: PC : 0x4008b62b PS : 0x00060031 A0 : 0x800813ce A1 : 0x3ffbf33c
    A2 : 0xb06c4cac A3 : 0x3ffbf364 A4 : 0x00000014 A5 : 0x00000004
    A6 : 0x3ffbce48 A7 : 0x80000001 A8 : 0x8008b20c A9 : 0x3ffbcc50
    A10 : 0x00000003 A11 : 0x00060023 A12 : 0x00060023 A13 : 0x80000000
    A14 : 0x007bf3b8 A15 : 0x003fffff SAR : 0x00000000 EXCCAUSE: 0x0000001c
    EXCVADDR: 0xb06c4cac LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000

    Backtrace: 0x4008b628:0x3ffbf33c |<-CORRUPTED can you help me fix the error and show me the new code?: #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h>

    #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 #define SCREEN_I2C_ADDRESS 0x3C #define BUFFER_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT / 8)

    Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

    void setup() { Serial.begin(115200);

    // Initialize I2C for communication with RP2040 Wire.begin();

    // Initialize display display.begin(SSD1306_SWITCHCAPVCC, SCREEN_I2C_ADDRESS); display.clearDisplay();

    Serial.println("Setup complete"); }

    void loop() { uint8_t screenData[BUFFER_SIZE]; size_t dataSize = 0;

    // Read screen data from RP2040 through I2C Wire.beginTransmission(SCREEN_I2C_ADDRESS); Wire.write(0x00); // Data start address Wire.endTransmission();

    Wire.requestFrom(SCREEN_I2C_ADDRESS, BUFFER_SIZE); dataSize = Wire.readBytes(screenData, BUFFER_SIZE);

    // Print screen data for debugging for (size_t i = 0; i < dataSize; i++) { Serial.print(screenData[i], HEX); Serial.print(" "); } Serial.println();

    // Display screen data on the OLED display.clearDisplay(); display.drawBitmap(0, 0, screenData, SCREEN_WIDTH, SCREEN_HEIGHT, WHITE); display.display();

    delay(1000); // Adjust delay as needed }

  2. Assistant

    The error "Guru Meditation Error: Core 1 panic'ed (LoadProhibited)" typically occurs when there is an issue with reading or accessing memory. In your case, it seems like the error is caused by reading or writing to an invalid memory address.

    To fix this error, you can try the following steps:

    1. Make sure that you have correctly connected the OLED display to the correct I2C pins on the RP2040. Check the wiring and ensure that the I2C address is correct (0x3C).

    2. Verify that you have installed the required libraries (Adafruit_GFX and Adafruit_SSD1306) correctly. You can install these libraries from the Arduino Library Manager.

    3. Try using a different I2C address for the display. Some displays have configurable I2C addresses, so you can try changing the address in the SCREEN_I2C_ADDRESS constant to see if it resolves the issue.

    4. Check if there are any other conflicting libraries or code that could be causing the issue. Try commenting out or removing any other code or libraries that might interfere with the display.

    Here's the updated code with some additional error checking:

    #include <Wire.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_SSD1306.h>
    
    #define SCREEN_WIDTH 128
    #define SCREEN_HEIGHT 64
    #define SCREEN_I2C_ADDRESS 0x3C
    #define BUFFER_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT / 8)
    
    Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire);
    
    void setup() {
      Serial.begin(115200);
    
      // Initialize I2C for communication with RP2040
      Wire.begin();
    
      // Check if the display is connected and initialized
      if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_I2C_ADDRESS)) {
        Serial.println("Display initialization failed!");
        while (1); // Stop the program
      }
    
      display.clearDisplay();
      display.display();
    
      Serial.println("Setup complete");
    }
    
    void loop() {
      uint8_t screenData[BUFFER_SIZE];
      size_t dataSize = 0;
    
      // Read screen data from RP2040 through I2C
      Wire.beginTransmission(SCREEN_I2C_ADDRESS);
      Wire.write(0x00); // Data start address
      Wire.endTransmission();
    
      Wire.requestFrom(SCREEN_I2C_ADDRESS, BUFFER_SIZE);
      dataSize = Wire.readBytes(screenData, BUFFER_SIZE);
    
      // Check if there was an error reading the data
      if (dataSize != BUFFER_SIZE) {
        Serial.println("Error reading screen data!");
        return;
      }
    
      // Print screen data for debugging
      for (size_t i = 0; i < dataSize; i++) {
        Serial.print(screenData[i], HEX);
        Serial.print(" ");
      }
      Serial.println();
    
      // Display screen data on the OLED
      display.clearDisplay();
      display.drawBitmap(0, 0, screenData, SCREEN_WIDTH, SCREEN_HEIGHT, WHITE);
      display.display();
    
      delay(1000); // Adjust delay as needed
    }
    

    Make sure to check the wiring, library installation, and any conflicting code that may cause issues.