Azure/azure-sphere-samples

Use GPIO of unused ISU pins on Real-Time app.

Closed this issue · 1 comments

Hi,

We make use of all the pins available on the MT3620 Azure Sphere.

To be able to control RS485 communication we though we could use the RTS pin of the ISU1, since we don't use hardware flow control in this scenario. We want to control ourselves the RTS pin in the code. Unfortunately, there seems to have no way to tell the SDK "It's ok, we will use this as a GPIO since it's not used in the UART ISU".

The app manifest:

{
  "SchemaVersion": 1,
  "Name": "RTApp",
  "ComponentId": "(redacted)",
  "EntryPoint": "/bin/app",
  "CmdArgs": [],
  "Capabilities": {
    "Gpio": [32],
    "Uart": ["ISU1"]
  },
  "ApplicationType": "RealTimeCapable"
}

This generates a error: Could not deploy application to device. Application manifest requests a GPIO that is already in use by another application. I then thought, ok, I'll remove the GPIO capability from the app_manifest and just initialize it since it's already part of the UART ISU1 assignation, but to no luck.

The MT3620 AVNET module does not have a lot of pins and this is very limiting, I think being able to use the unused pins from ISUs might be a good way to pack more components around the Azure Sphere!

Any idea how to solve our issue?

Additional info:

  • Azure Sphere SDK: 21.10.2.52856
  • Low level lib/drivers from CodeThink (mt3620-m4-drivers)
  • Module: AES-MS-MT3620-M00-G

Hi @breaultjean,

the behavior you're observing is by design: as in many MCU implementations, multiplexed pins are switched by a hardware multiplexer for exclusive use to the desired function, as configured in its registers.

For example, if you (through the high-level app manifest) configure the GPIO/ISUx multiplexer block to switch to UART, then all the related pins switch to that function, and cannot be used for other functions, i.e. GPIOs. On the other side, pins not used by a specific function (e.g. I2C only requires two pins, leaving three free) can be used as additional GPIOs.
You cannot "split" pins belonging to a specific function, as they are part of a hard-wired multiplexed block in the silicon.

For further reference, you can check out the MT3620 datasheet, par. 5.2.

In case it may be of interest, here's also a reference to a full-duplex hybrid HL/RT RS485 driver, in the Azure Sphere gallery.

Hope this addresses your question.