Code: Select all
adc1_config_width(ADC_WIDTH_12Bit);// use the max 12 bit ADC precision
adc1_config_channel_atten(ADC1_GPIO33_CHANNEL,ADC_ATTEN_0db);//strap ADC1 to GPI 33
cx_in[i] = adc1_get_raw(ADC1_GPIO33_CHANNEL);//read a sample
It clearly shows the pattern table which contains the attenuation for up to 16 measurement rules per controller. More detailed:
and description of contents per register:
So my idea was to write to this address and use a mask to set the attanuation to 0dB. However, I'm a noob and haven't approached registers on the ESP32 before so I'm quite unsure about what to do. After a lot of googling I think I have to do it like this:
Code: Select all
uint32_t mask = 0xFCFCFCFC;
*((volatile uint32_t *) (0x0600261C)) &= mask;
I was also looking around to find the header files which should contain the register addresses for APB_SARADC_SAR1_PATT_TAB1_REG etc, but I couldn't find this one exactly. I did find APB_CTRL_APB_SARADC_SAR1_PATT_TAB1_REG in <soc/apb_ctrl_reg.h> which points to a different address than the one given in the documentation.
Modifying the address from this header doesn't cause me bootloops but also doesn't seem to affect my attenuation .
Sorry about the long story, but I would really appreciate it if someone can help me find the right register and tell me how to address it properly.