dynamically configure power source for pin output?

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
nigelyang
Offline
Last seen:1 month 6 days ago
加入:2018-03-20 08:24
dynamically configure power source for pin output?

Hi Dialog,

There are two devices connecting with DA14681 by one SPI interface in my project, but the voltage levels of the two interfaces are different, 1.8v and 3.3v respectively.
So I want to configure the corresponding power source(1.8 or 3.3v) in the SPI interface when I choose to communicate with one of the two( share one SPI interface of DA14681). Is it possible to change the power source after periph_init() is done? If yes, how to implement this ?

I tried to configure as 1.8v before communicating with 1.8v device, but the pin outputs are still 3.3v.(initial power source is 3.3v) thanks for your help.

Device:
PM_Dialog
Offline
Last seen:2 days 5 hours ago
工作人员
加入:2018-02-08 11:03
Hi nigelyang,

Hi nigelyang,

For this kind of functionality there is an available API, which called hw_gpio_configure_pin_power() and it is included into the hw_gpio.h library. So, when you would like to switch the power rail of the GPIOs you should call this API.

Thanks, PM_Dialog

nigelyang
Offline
Last seen:1 month 6 days ago
加入:2018-03-20 08:24
hi Dialog,

hi Dialog,

I did configuration by hw_gpio_configure_pin_power()! If I did it outside periph_init(), the result is failed, and if done in periph_init(), the result is successful. What setting do I miss during power source configuration so that I can change the pin voltage level in a task? thanks for your answer.

PM_Dialog
Offline
Last seen:2 days 5 hours ago
工作人员
加入:2018-02-08 11:03
Hi nigelyang,

Hi nigelyang,

Could you please call the periph_init every time that you change the voltage levels?

Thanks, PM_Dialog