Project

General

Profile

Problems writing to MCU_GPIO0_19 and MCU_GPIO0_20

Added by Paul Strutt about 15 hours ago

I have created an MCU application that uses the MCSPI to communicate with multiple SPI devices.
We need to talk to up to eight SPI devices so are using the MCSPI with a single chip select (MCU_SPI0_CS0), and then are using 3 GPIO lines to create an address (MCU_GPIO0_1, MCU_GPIO0_19 and MCU_GPIO0_20).
MCU_SPI0_CS0, MCU_GPIO0_1, MCU_GPIO0_19 and MCU_GPIO0_20 are passed to a 3 to 8 line decoder chip so that one of the 8 lines is low when MCU_SPI0_CS0 is low (SPI active) and all the lines are high when MCU_SPI0_CS0 is high (SPI inactive).

I can successfully communicate to SPI devices on the addresses 0 and 1, but not to devices on addresses 2 to 7.
When we looked at the board with a scope we found that the state of MCU_GPIO0_1 was changing but MCU_GPIO0_19 and MCU_GPIO0_20 remained low. I have checked the code and run simple tests to toggle the state of the pins but in all cases MCU_GPIO0_19 and MCU_GPIO0_20 remain low.

I have attached my pinmux and sysconfig files for reference.

Is there anything else that needs to be changed in the system to allow these pins to operate as MCU GPIO lines? On the schematics these pins are also labelled as WKUP_I2C0_SCL and WKUP_I2C0_SDA so I am wondering if this I2C0 subsystem could be interfering with these pins.

SeriesX.pinmux (40.5 KB) SeriesX.pinmux PinMux file
MCU.syscfg (6.02 KB) MCU.syscfg Config file for MCU I/O

Replies (5)

RE: Problems writing to MCU_GPIO0_19 and MCU_GPIO0_20 - Added by Michael Williamson about 14 hours ago

Hi Paul,

By default, the MCU_GPIO peripheral is controlled in the linux kernel for the devkit. (see the arch/arm64/boot/dts/k3-am62x-mitysom-devkit.dts file which enables it).

I am wondering if perhaps there is a conflict between the Cortex-A53 cluster and the MCU because they are both trying to control the gpio peripheral.

For sanity, can you not load the MCU and just use the sysfs gpio (let me know if you need commands) to poke the pins in question and see if the pins toggle? I am pretty sure we test this at some point in our production cycle.

You may need to disable the mcu_gpio0 device in the device tree for the linux ARM cluster to get it to work. I think most of those go to the expansion header expect for one pin that is used for the touch / LVDS screen interface.

I think the wkup_i2c0 device should also be disabled on the linux side by default.

-Mike

RE: Problems writing to MCU_GPIO0_19 and MCU_GPIO0_20 - Added by Paul Strutt about 10 hours ago

Thanks Mike

I think I have set up the GPIO lines correctly. I followed the steps described in the following wiki
https://support.criticallink.com/redmine/projects/mitysom_am62x/wiki/Example_-_User_level_GPIO_Access
I came up with gpio531 and gpio532

With the MCU not being loaded I ran the following commands
echo 531 >/sys/class/gpio/export
echo 532 >/sys/class/gpio/export
echo out >/sys/class/gpio/gpio531/direction
echo out >/sys/class/gpio/gpio532/direction
echo 1 >/sys/class/gpio/gpio531/value
echo 1 >/sys/class/gpio/gpio532/value
But there was no change of state on either line

I couldn’t see anything in the dts file that suggested that GPIO0_19 or GPIO0_20 were mapped to the Arm, but there are entries under the mcu_gpio_p3_pins_default section

mcu_gpio_p3_pins_default: mcu-p3-default-pins {
pinctrl-single,pins = <
/* P3 Connector /
AM62X_MCU_IOPAD(0x0000, PIN_INPUT, 0) /
(E8) MCU_SPI0_CS0 /
AM62X_MCU_IOPAD(0x0004, PIN_INPUT_PULLDOWN, 7) /
(B8) MCU_SPI0_CS1.MCU_GPIO0_1 /
AM62X_MCU_IOPAD(0x0008, PIN_INPUT, 0) /
(A7) MCU_SPI0_CLK /
AM62X_MCU_IOPAD(0x000c, PIN_INPUT, 0) /
(D9) MCU_SPI0_D0 /
AM62X_MCU_IOPAD(0x0010, PIN_INPUT, 0) /
(C9) MCU_SPI0_D1 /
AM62X_MCU_IOPAD(0x0044, PIN_INPUT, 7) /
(A8) MCU_I2C0_SCL.MCU_GPIO0_17 /
AM62X_MCU_IOPAD(0x0048, PIN_INPUT, 7) /
(D10) MCU_I2C0_SDA.MCU_GPIO0_18 /
AM62X_MCU_IOPAD(0x004c, PIN_INPUT, 7) /
(B9) WKUP_I2C0_SCL.MCU_GPIO0_19 /
AM62X_MCU_IOPAD(0x0050, PIN_INPUT, 7) /
(A9) WKUP_I2C0_SDA.MCU_GPIO0_20 */

;

};

I have highlighted GPIO0_19 and GPIO0_20 above. GPIO0_1 is also highlighted and I am able to change the state of this pin.

Paul

RE: Problems writing to MCU_GPIO0_19 and MCU_GPIO0_20 - Added by Michael Williamson about 7 hours ago

Hi Paul,

To confirm, you are using a standard AM62x SOM, correct (not an AM62Ax or AM62Px)?

Thanks,
Mike

RE: Problems writing to MCU_GPIO0_19 and MCU_GPIO0_20 - Added by Jonathan Cormier about 7 hours ago

Also are you testing this on our devkit or on a custom design? If a custom design, would you be willing to email it to us for review?

RE: Problems writing to MCU_GPIO0_19 and MCU_GPIO0_20 - Added by Jake Pregitzer about 6 hours ago

Hello Paul,

We have replicated this issue on our end. I am using a 62x with our latest SDK (11.01) and found that MCU_GPIO0_17 through MCU_GPIO0_20 were not changing after a gpio set. We also noticed MCU_GPIO0_0 through MCU_GPIO0_4 were changing appropriately, similar to what you reported initially.

root@mitysom-am62x:~# for i in $(seq 0 23); do echo $i; gpio MCU_GPIO0_$i set 0; done
...
root@mitysom-am62x:~# cat /sys/kernel/debug/gpio | grep MCU            
 gpio-512 (MCU_GPIO0_0         |sysfs               ) out lo 
 gpio-513 (MCU_GPIO0_1         |sysfs               ) out lo 
 gpio-514 (MCU_GPIO0_2         |sysfs               ) out lo 
 gpio-515 (MCU_GPIO0_3         |sysfs               ) out lo 
 gpio-516 (MCU_GPIO0_4         |sysfs               ) out lo 
 gpio-529 (MCU_GPIO0_17        |sysfs               ) out lo 
 gpio-530 (MCU_GPIO0_18        |sysfs               ) out lo 
 gpio-531 (MCU_GPIO0_19        |sysfs               ) out lo 
 gpio-532 (MCU_GPIO0_20        |sysfs               ) out lo 

root@mitysom-am62x:~# for i in $(seq 0 23); do echo $i; gpio MCU_GPIO0_$i set 1; done
...
root@mitysom-am62x:~# cat /sys/kernel/debug/gpio | grep MCU
 gpio-512 (MCU_GPIO0_0         |sysfs               ) out hi 
 gpio-513 (MCU_GPIO0_1         |sysfs               ) out hi 
 gpio-514 (MCU_GPIO0_2         |sysfs               ) out hi 
 gpio-515 (MCU_GPIO0_3         |sysfs               ) out hi 
 gpio-516 (MCU_GPIO0_4         |sysfs               ) out hi 
 gpio-529 (MCU_GPIO0_17        |sysfs               ) out lo 
 gpio-530 (MCU_GPIO0_18        |sysfs               ) out lo 
 gpio-531 (MCU_GPIO0_19        |sysfs               ) out lo 
 gpio-532 (MCU_GPIO0_20        |sysfs               ) out lo 

The other GPIO's are not pinmuxxed as GPIO's, so we are ignoring them as we would not expect them to change.
MCU_GPIO0_17 through MCU_GPIO0_20 are WKUP pins so this could be related to the issue in some way? We will look into this.

    (1-5/5)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)