AnsweredAssumed Answered

How to read gpio value in s32v234 uboot

Question asked by zhao cuiqin on Nov 7, 2019
Latest reply on Nov 8, 2019 by Kushal Shah

hi NXP,

          s32v234 uboot  stage, we want to use Port PB5 and PB6 as GPIO function, we want to simulate i2c. Now we can set PB5 and PB6 to output high and low, set as below:

writel(config , SIUL2_MSCRn(19));
writel(value_off, SIUL2_GPDOn(SIUL2_GPDO_for_GPIO(19)));

writel(config , SIUL2_MSCRn(20));
writel(value_off, SIUL2_GPDOn(SIUL2_GPDO_for_GPIO(20)));

through the wavelet, we can get high and low. 

Also we need to read the data input, I set below codes, but still can not read  correct value.

u32 config1 = (0<<0 | 1<<19);

writel(config1 , SIUL2_IMCRn(273));
get_value = readl(SIUL2_IMCRn(273));
printf("Board: test_gpio_i2c get_value=%x\n",get_value);

Could you tell me how to set the input and read the input value? Thanks in advances!