PDA

View Full Version : GPIO Pin number


vijayaraj
08-26-2009, 02:21 PM
I am Using PAN4555 module.I have loaded this 2.2 BETA version.

GPIO pin number for PTC5 pin is 5 in the datasheet.

But while on testing i found that GPIO pin number for PTC5 pin is 6 NOT 5.

The whole project stuck up since required o/p did not come even though i initialized the correct pin.while on testing i found this.

i feel error should be in either number in data sheet or it should be the bug in the firmware version.

i hope all other GPIO initialisation should be correct.

Regards,
Vijayaraj

kbanks
08-26-2009, 04:28 PM
In order to be able to run on more, different hardware, SNAP 2.2 introduces an additional layer of pin numbering.

IO numbering is chip-centric, and runs from 0 to n-1. This numbering has been chosen to be the most sensible for designers putting SNAP directly down on boards. These are the numbers used in readPin(), writePin(), etc.

GPIO numbering (this used to be the ONLY kind of numbering) now specifically refers to the GPIO positions on the "RFE form factor" modules. Since the actual GPIO to IO mappings vary between platforms, these are now symbolic constants defined in platform specific import files.

Look in the synapse subdirectory for PAN4555.py for example.


"""GPIO Assignment for the PAN 4555 module
This module utilizes the MC1321x

This file is typically included by using the generic 'platforms.py'
However, this file can be included directly
"""


# GPIO Enum to be used in scripts = GPIO from the SNAP core firmware
GPIO_0 = 24
GPIO_1 = 19
GPIO_2 = 18
GPIO_3 = 30
GPIO_4 = 29
GPIO_5 = 21
GPIO_6 = 5
GPIO_7 = 17
GPIO_8 = 16
GPIO_9 = 6
GPIO_10 = 7
GPIO_11 = 15
GPIO_12 = 31
GPIO_13 = 32
GPIO_14 = 27
GPIO_15 = 25
GPIO_16 = 10
GPIO_17 = 9
GPIO_18 = 8


# List of pin assignments that can be iterated over in GPIO-order (i.e. GPIO_0 is 24, GPIO1 is 19, etc...)
GPIO_TO_IO_LIST = (24,19,18,30,29,21,5,17,16,6,7,15,31,32,27,25,10,9 ,8)

# List of pin assignments that can be iterated over in pin/IO-order (i.e. IO 0 is GPIO_19)
IO_TO_GPIO_LIST = (-1,-1,-1,-1,-1,6,9,10,18,17,16,-1,-1,-1,-1,11,8,7,2,1,-1,5,-1,-1,0,15,-1,14,-1,4,3,12,13)


You will notice (as you pointed out) that GPIO_6 is not "6" (and GPIO_5 is not 5).

Using the symbolic constants instead of hardcoded numbers will fix you up.

Note that since Synapse RFEs only come in an "RFE form factor", the GPIO numbers coincidentally match the IO numbers. Everyone should still start using GPIO_ constants instead of hardcoded numbers.

If you are writing scripts to run on "RFE form factor" modules (RFE, PAN4555, PAN4561) you should work in terms of GPIO.

If you are writing a script to run on bare hardware, you can just use the IO numbers.

vijayaraj
08-27-2009, 04:16 AM
Hello Kbanks,
I am sorry for the confusion .i confused with the other pin.Here is the correct form.

I am Using PAN4555 module.I have loaded this 2.2 BETA version utilizing MC1321x

GPIO pin number for PTA7 pin is 7 in the datasheet.

But while on testing i found that GPIO pin number for PTA7 pin is 6 NOT 7.


Regards,
Vijayaraj

Jheath
08-27-2009, 01:26 PM
GPIO pin number for PTA7 pin is 7 in the datasheet. But while on testing i found that GPIO pin number for PTA7 pin is 6 NOT 7.


I verified this morning that SNAP GPIO_10 (Raw IO 7) is connected to PTA7 (Pin 7) on the PAN4555 module.

Do you have the correct platform specified for this particular module?
Check that the 'platform' field listed under the device tab of the Configuration Parameters is set to "PAN4555".

vijayaraj
08-28-2009, 05:05 AM
Hello Jheath,
I have attached my code with this post.I have bought PAN4555 module and integrated in to my application circuit.I have connected the switch to the Keyboard Interrupt pin PTA7/KBD7 which is GPIO_10 which in turn GPIO number 7(RAW IO) for PAN4555 module.Since the specified GPIO pin number according to spec is not working,i made sure that hardware is working fine.Once i made sure hardware is fine, i have written the code to make all GPIO pins in the module to be input and monitored all the pins.When ever there is change in the pin,it is returned to the UART which i capture and read in the hyperterminal.
I received change in the GPIO pin as 6 when ever i press the button which is corrected to PTA7.Can you please examine the code and let me know also i compiled in the PAN4555 platform only.


Regards,
Vijayaraj.S

Jheath
08-28-2009, 02:56 PM
I received change in the GPIO pin as 6 when ever i press the button which is corrected to PTA7.Can you please examine the code and let me know also i compiled in the PAN4555 platform only.

It looks like you are still using raw IO numbers and not the SNAP GPIO assignments required for the PAN4555 module in ver. 2.2. I have attached a copy of your script with modifications to use SNAP GPIO as well as to use the internal pull-ups of the processor to help monitor for a pin transition (This might not be needed for you custom hardware).

From my testing with your script, it still appears as though SNAP GPIO_10 (IO 7) is connected to PTA7 of the processor.

I have attached another script that accomplishes a similar task, but in a condensed form.

vijayaraj
09-07-2009, 01:41 PM
Hello All,
I have got one more issue.The PAN4555 module which is connected to the portal via the serial port,shows the link quality as 0%.I guess this should be the reason for not detecting any other nodes in the network.I replaced with other PAN4555 module based PCB,every single piece shows it has 0% as link quality in the Portal software.Can you suggest me what i have to do or check?

kbanks
09-08-2009, 01:01 AM
The PAN4555 module which is connected to the portal via the serial port,shows the link quality as 0%

The bridge node (any bridge node) will show a LQ of 0% as long as it is only "talked to" serially (from Portal).

The LQ value is only updated by radio activity. Until your bridge node receives at least one radio packet from at least one other node, it will show 0%.