ESP32 write to registers

bssmith237
Posts: 2
Joined: Wed Sep 22, 2021 7:34 am

ESP32 write to registers

Postby bssmith237 » Wed Sep 22, 2021 7:37 am

Hello everyone,

I have an ESP32 board connected with an IMU. I want to make few alterations on the IMU like hardcoding the calibration offsets values in order to use them every time the board powers on. My main concern is how can I write directly to the registers from the Arduino IDE platform. I imagine that this has to do mainly with C# programming and specifically with ESP32 but any help will be useful.

Thank you

StridingDragon
Posts: 46
Joined: Fri Aug 02, 2019 11:59 pm

Re: ESP32 write to registers

Postby StridingDragon » Thu Sep 23, 2021 1:48 am

You essentially have to select the SPI device you want to address and then execute a SPI transaction using something like `spi_device_transmit()` etc. Don't forget to unselect the SPI device afterwards to make it available to other processes.

filo_gr
Posts: 109
Joined: Wed Jul 28, 2021 12:25 pm
Location: Italy

Re: ESP32 write to registers

Postby filo_gr » Thu Sep 23, 2021 10:04 am

bssmith237 wrote:
Wed Sep 22, 2021 7:37 am
My main concern is how can I write directly to the registers from the Arduino IDE platform.
Which protocol do you need? ESP-IDF gives you a lot of libraries you can use for communication.
If you use Arduino IDE I think you installed the esp32 pack of libraries in the IDE.
Filippo

bssmith237
Posts: 2
Joined: Wed Sep 22, 2021 7:34 am

Re: ESP32 write to registers

Postby bssmith237 » Thu Sep 23, 2021 11:32 am

filo_gr wrote:
Thu Sep 23, 2021 10:04 am
bssmith237 wrote:
Wed Sep 22, 2021 7:37 am
My main concern is how can I write directly to the registers from the Arduino IDE platform.
Which protocol do you need? ESP-IDF gives you a lot of libraries you can use for communication.
If you use Arduino IDE I think you installed the esp32 pack of libraries in the IDE.
Thank you for your answer,

Yes I have installed the esp32 pack. So I should look for ESP-IDF package. I will try and inform you upon my outcome.

chegewara
Posts: 2207
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 write to registers

Postby chegewara » Fri Sep 24, 2021 9:44 pm

Code: Select all

    Wire.beginTransmission((uint8_t)ADDRESS);  	// I2C address
    Wire.write((uint8_t)0x1);					// register address
    Wire.write((uint8_t)136);					// write byte/bytes
    Wire.endTransmission();					// end 
    

Who is online

Users browsing this forum: No registered users and 103 guests