DSPIO and GPIO

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,848件の閲覧回数
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,667件の閲覧回数
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,669件の閲覧回数
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,669件の閲覧回数
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,668件の閲覧回数
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,669件の閲覧回数
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 件の賞賛
返信