C# setting pins for CAN on Colibri imx7d

I’m experimenting with the Colibri on an Aster carrier board and trying to use pins 92 and 169 for CAN1 Tx and Rx.

ret &= can_imx7.Imx7Can_SetConfigInt(canHandle, "ioTx", 92, TdxCommon.ParamStorageType.StoreVolatile);
ret &= can_imx7.Imx7Can_SetConfigInt(canHandle, "ioRx", 169, TdxCommon.ParamStorageType.StoreVolatile);

The first line setting the Tx pin returns true, the second line setting Rx always returns false.

I’ve tried all of the possible Rx pins, for this module 63, 90 and 169 with the same result.

Why?

Dear @dnicholls

The Imx7Can_SetConfigInt() expects pin / gpio numbers in form of uIo types. uIo is not just a pin number, but also defines how the integer part (the number) is interpreted.
There’s various demos in our Toradex CE libraries which demonstrate how to use this uIo type.

Best Regards, Andy

Ah, I found a PWM demo that seems to explain it better so I’ve change to

gpio.uIo io = new gpio.uIo();
io.type = (ushort)gpio.tIoType.ioColibriPin;                    
io.number = 92;
ret &= can_imx7.Imx7Can_SetConfigInt(canHandle, "ioTx", io.GenericDefinition, TdxCommon.ParamStorageType.StoreVolatile);    
io.number = 169;
ret &= can_imx7.Imx7Can_SetConfigInt(canHandle, "ioRx", io.GenericDefinition, TdxCommon.ParamStorageType.StoreVolatile);

which now seems to work ok.

Dear @dnicholls
I just noticed after I wrote my answer, that you found the solution yourself :slight_smile: .
Regards
Andy