Skip to main content
Rpala.1
Associate
February 19, 2020
Question

configure GPIOs at runtime; based on CAN message

  • February 19, 2020
  • 1 reply
  • 745 views

HI, I am using SPC560b54l5 discovery board,

I want to configure multiple GPIOs at runtime; based on the message received from CAN, when I configure particular pin as I/O by using pal_setgroupmode function but it not works, can anyone face this issue?

 

please help me.

with regards,

Ragu.

This topic has been closed for replies.

1 reply

Rpala.1
Rpala.1Author
Associate
February 29, 2020

Hi all, At-least I found one way to do configure GPIOs mode(input or output) at run time. I found that static const spc_siu_init_t spc_siu_init[] structure present in board.c file contains all our pins configuration but it is a constant structure; so, I made one copy of the same file and change the constant structure to ordinary structure and the I change input as output and vice-versa by doing on register level writing on SIU register like this SIU.PCR[spc_siu_run[PIN_GPIO0].pcr_index].R = (iomode_t)(PAL_MODE_OUTPUT_PUSHPULL); This will configure GPIO0 as output, initially I configure as input.

Thq

with Regards,

Ragu