2017-01-17 06:55 PM
Posted on January 18, 2017 at 03:55
I am using stm32cubeMx to generate initialization C code for programming STM32L476RGTx MCU using Keil IDE. Recently, I need to interface an AD5262 digital potentiometer to control the gain of an amplifier automatically. The AD5262 requires 9 bit spi data to be configured perfectly (1 bit for resistor selection, 8 bit for wiper position selection). I have tried HAL_SPI_Transmit_IT(&hspi,&data,1) // data is 8 bit. //
to transmit twice (so I did some bit manipulation so it becomes A0 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0, please check AD5262.jpg). I considered last 7 zeros' to be ignored by AD5262. Seems like my process is not working. There one other way I can think of which is 1st bit (A0) to be transferred manually programming the spi by using the gpio pins (CS, SCLK and SDA) and transmitting the rest 8 bit using the function I mentioned. But I will do it if I can not find any other convenient way to transmit 9 bit directly using HAL. Can you people help with other ideas? since I noticed there data size of 8, 9, 10, 12, ....... 16 bits while configuring MCU's spi using STM32CubeMx(other two png files).
Thanks in advance.
Solved! Go to Solution.
2017-02-11 12:12 AM
Solved the problem. I transfered (uint8_t)1 using 8 bit spi transmission and then I transfered (uint8_t)wiperposition
2017-02-11 12:12 AM
Solved the problem. I transfered (uint8_t)1 using 8 bit spi transmission and then I transfered (uint8_t)wiperposition
2018-08-09 02:47 AM
can please say how you solved the problem