Skip to content

analogRead on certain pins breaks u8g2 library in 3.0.0 alpha dev (mysterious) #9040

Closed
@ForrestFire0

Description

@ForrestFire0

Board

LOLIN S2 Mini (ESP32 S2)

Device Description

Hardware is esp32 lolin s2 mini board attached to a cheap typical joystick module and to a oled screen. The pinout is in the code. The individual components work separately (and worked together on previous versions of arduino-esp32 framework) to I don't think it's the wiring, happy to share.

Hardware Configuration

used for u8g2 SPI connection
#define SPI_CS 35
#define SPI_DC 37
#define SPI_RST 33

The joystick axis X (pin 5) and Y (pin 9) is hooked up to the ESP32 S2.

Version

3.0.0 alpha 3

IDE Name

Arduino IDE

Operating System

Windows 11 home

Flash frequency

40 MHz

PSRAM enabled

yes

Upload speed

921600

Description

I am trying to connect my joystick (analogRead single shot) to my u8g2 screen.

Both components work independently.

See the sketch. When pin 5 is read, all good, when pin 9 is read, nothing is printed to the screen.

Sketch

#include <Arduino.h>
#include <U8g2lib.h>

#include <SPI.h>

#define SPI_CS 35
#define SPI_DC 37
#define SPI_RST 33

// Green wire
#define X_PIN 5
// Orange Wire
#define Y_PIN 9

U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, SPI_CS, SPI_DC, SPI_RST); //ESP32S2 board with SPI

void setup(void) {
    u8g2.begin();
}

void loop(void) {
    u8g2.clearBuffer();					
    u8g2.setFont(u8g2_font_ncenB08_tr);
    char buff[100];
    int val = analogRead(5); //5 works, 9 DOES NOT WORK
    sprintf(buff, "val: %d\n", val);
    u8g2.drawStr(0, 10, buff);	
    u8g2.sendBuffer();
}

Debug Message

I set the core debug level to verbose and did not get any output on the serial monitor other than the prints in my sketch. I think I am doing the debug incorrectly or maybe there is an issue with the esp32s2s ports.

Other Steps to Reproduce

Was working on the stable version of arduino-esp32, however I need esp idf 5.1 functionality so need to use the dev version. I don't see any of my needed functionality as stuff that is being messed with.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Status: SolvedThe issue has been resolved and requires no further action.Type: QuestionOnly question

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions