Wiring GPIO0 on the rapidM2M PoC Shield

Hello community,

i have a question regarding the interfaces on the rapidM2M M220 in combination with the rapidM2M PoC Shield.

In my specification of the interfaces from the PCB board to the rapidM2M module I defined that GPIO0 is the input and GPIO1 is the output.
However, in the circuit specification of the board it is reversed to mine (i.e. GPIO0 --> output and GPIO1 --> input)

What is the best way to proceed here?
Should I adapt the interface description and my implementation or is there a possibility to redefine this using the PAWN script?

Thanks for the answer in advance!

Hello @se181007,

I am not sure that I understand your question correctly. A GPIO can be both input and output. How it is to be configured depends, of course, on the external circuit (i.e. the circuit on the PCB board). So if you want to read the state at the pin (input), you need to use the “digitalRead” function. If you want to output a signal (output), you need to use the “digitalWrite” function. Both functions configure the signal direction of the GPIO appropriately beforehand. As the first transfer parameter, both require the number of the GPIO to be used starting with 0 for the first GPIO of the rapidM2M M22x module.
image

It is recommended to define a constant or define with a speaking name for each GPIO used at the beginning of the code, and then use it each time you call “digitalWrite” or “digitalRead”. This makes the code easier to read and if the hardware in which the rapidM2M M22x module is installed changes, the code can be quickly adapted by a single change at the beginning of the code.

/* Pin configuration */
const
{
	PIN_LED1_R = 1,                           // RGB LED 1: Red   (GPIO1 is used)
	PIN_LED1_G = 2,                           // RGB LED 1: Green (GPIO2 is used)
	PIN_LED1_B = 3,                           // RGB LED 1: Blue  (GPIO3 is used)
	PIN_LED2   = 0,                           // LED 2: Green     (GPIO0 is used)
	PIN_LED3   = 4,                           // LED 3: Green     (GPIO4 is used)

	LED_ENABLE  = RM2M_GPIO_HIGH,             // By setting the GPIO to "high" the LED is turned on
	LED_DISABLE = RM2M_GPIO_LOW,              // By setting the GPIO to "low" the LED is turned off
}; 

You can find examples of this in the “M2 BASE STARTER BASIC EXAMPLES COLLECTION” in the Samples area of ​​the rapidM2M Studio


Kind regards
Josef