DSPIO and GPIO

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

DSPIO and GPIO

跳至解决方案
1,814 次查看
t_k
Contributor II

Is there a simple way within MQX to toggle a pin from DSPIO mode to GPIO mode and back again,  or do I need to dig in and change the PAR_DSPIOWH directly?

The default nature of the SPI driver doesn't allow me to verify that the data on the a/d is ready, so I need to switch to gpio mode to wait for the a/d to assert the SIN line before I do my SPI read.

thanks,

Travis

0 项奖励
回复
1 解答
1,633 次查看
c0170
Senior Contributor III

Hello Travis,

if the documentation does not provide enough information, open the source of your interest (code files: lwgpio and lwgpio_mcf5441).

lwgpio_set_pin_output calls lwpgio_init, which sets only value and direction. There's lwgpio_set_functionality to set GPIO function (line 225).

Regards,

MartinK

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,635 次查看
c0170
Senior Contributor III

Hello,

you did not specify target MCU. I assume it is MCF5225 or MCF5441. You need to change it directly, I did not find any function which enables desired functionality, at least in lwgpio driver.

Regards,

MartinK

0 项奖励
回复
1,635 次查看
t_k
Contributor II

Hi Martin,

Yes, we're using the MCF54418.

I was wondering, does using lwgpio_set_pin_output and lwgpio_get_pin_input change the pin from spi to gpio?  I was having a hard time understanding all the lwgpio documentation and the purpose behind it.

thanks,

Travis

0 项奖励
回复
1,634 次查看
c0170
Senior Contributor III

Hello Travis,

if the documentation does not provide enough information, open the source of your interest (code files: lwgpio and lwgpio_mcf5441).

lwgpio_set_pin_output calls lwpgio_init, which sets only value and direction. There's lwgpio_set_functionality to set GPIO function (line 225).

Regards,

MartinK

0 项奖励
回复
1,635 次查看
t_k
Contributor II

Thanks,

I ended up using standard GPIO calls along with toggling the PAR_DSPIOWH register.

Once I got digging through the source files it was fairly straightforward.

-Travis

0 项奖励
回复