cancel
Showing results for 
Search instead for 
Did you mean: 

digital potentiometer set via i2c with stm32f303ze

MSchm.6
Associate

I am currently working on controlling a digital potentiometer using i2c with the STM32f303Ze. According to the datasheet of the DigiPot you can send different bits to make adjustments. after a lot of trial and error the voltage still didn't change.

could someone help me look at the code briefly and give me tips

Thanks a lot

1 REPLY 1

Hello

in fuction HAL_I2C_Master_Transmit(&hi2c2, PROTECT << 1, u8_NVMSettings, sizeof(u8_NVMSettings),1000); // General Configurations

second argument is the device address not the register's address

PROTECT register or any other register must contained in fist byte of three bytes array u8_NVMSettings.

u8_NVMSettings[0]=PROTECT;

u8_NVMSettings[1]=value1;

u8_NVMSettings[2]=value2;

device's address is 0x8E (allready shifted broadcast ) or 0x9x (allready shifted ). x is depending from A0 pin connection.

eg HAL_I2C_Master_Transmit(&hi2c2, 0x8E, u8_NVMSettings, 3,1000); // General Configurations

0693W000007DDsyQAG.jpg