How to control an external digital potentiometer with the STM32F3DISCOVERY via SPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-24 1:32 AM
Posted on July 24, 2017 at 10:32
Hi guys,
I need to control an external digital potentiometer (setting the variable resistance wiper position) with a STM32F3DISCOVERY MCU, via SPI interface.
The digital potentiometer is an AD5293.
I just need to change the variable resistor wiper position. I don't need to read values from the external digital potentiometer, I just have to set the wiper position to a desired one and nothing more.
After setting up the SPI interface (using the MCU as the master), I need to fisically link the STM32F3 to the AD5293 to send the data input.
My question is:
which pin (or pins) of the STM32F3 should I use to insert the wire to connect the two devices?
Thank you in advance for your answers!
- Labels:
-
GPIO-EXTI
-
SPI
-
STM32F3 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-24 3:19 AM
No worries, it's much easier than the RS232 RX/TX Murphy's law: Just connect MOSI, SCK and NSS together.
You can use any GPIO for NSS. MOSI = Master Output, Slave Input data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-24 6:44 AM
Thank you very much.
So, suppose I want to use SPI1 to communicate. I only have to trasfer, so I just need MOSI, SCK and NSS pins.
I would use PA5 as SCK, PA7 as MOSI and PA4 as NSS (channel select), selecting their alternate function modes.
So, I would have to wire PA5 to SCLK pin of the external digital potentiometer, PA7 to MOSI pin of the external digital potentiometer and PA5 to NSS pin of the external digital potentiometer.Is it correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-24 7:47 AM
Yes, correct.
For NSS, it will be used without alternate function, it will be toggled by SW.
If layter you need to read back from the device (for example to detect if slave is present), then MISO will be needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-24 7:53 AM
Thanks! You are very useful.
Another little question:
the external digital potentiometer must be powered; can I use the pins labelled as '5V' and '3V' onto the STM32F3 to supply power towards the external device?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-07-24 8:02 AM
Yes, you can.
But be aware that you can't just run your dig. potentiometer on +5V. Else you will get trouble with logic levels, and probably internal protective diodes on the GPIO pins.
