Revision: 1153
Author: sebastien.lelong
Date: Mon Aug 3 08:55:41 2009
Log: howto update pinmap.json survivor guide
http://code.google.com/p/jallib/source/detail?r=1153
Added:
/wiki/UpdatingPinmap.wiki
=======================================
--- /dev/null
+++ /wiki/UpdatingPinmap.wiki Mon Aug 3 08:55:41 2009
@@ -0,0 +1,76 @@
+#summary howto update pinmap file & derivatives
+#labels Phase-Implementation,Phase-Design
+
+= What's pinmap ? =
+
+*pinmap.json* is a file containing all pin definitions & aliases. As you
know, given a PIC, each of its pins can have multiple functionality. For
instance, one pin can be involved in ADC conversion, serial comms, i2c,
etc... Depending on the functionality, its name can vary. The purpose of
this file is to describe, for each PIC, for each pin, what are the aliases.
+
+Format is JSON. It's a very simple format, human-readable.
+
+
+= Why ? What is it used for ? =
+
+Creating and maintaining this file is highly time-consuming. You may
ask "why are you doing this guys ? Can't you get this information from
somewhere at Microchip ?". No it seems not. (but if you aware of something,
please report...). At the beginning, this file was produced by parsing
datasheets (see ParsingDatasheets), but this was a one-shot approach,
highly fragile. By that times, gods were with us and it was working. Now
they have seem to have left us, with a cursed burden: update maintenance...
+
+This pinmap.json file is then used to produce many derivative files. All
aliases are also available from device files, and may be involved libraries
such as ADC for instance.
+
+
+= "I don't know what to do during my days, I want to help and feed
pinmap.json !" =
+
+OK, welcome to hell... hum... here !
+
+Say a new PIC just appeared, or you've just discovered there were some
errors for a give PIC. For instance, PIC 16f722 has wrong alias definition.
This can occur when parsing has failed to identified correct PICs in a
datasheet.
+
+Anyway, we're about lower energy of the Universe and slow down this
increasing entropy by fixing things for this PIC.
+
+Open pinmap.json file, with favorite editor. A PIC entry looks like:
+
+{{{
+ "10F200": {
+ "RA0": [
+ "GP0",
+ "ICSPDAT"
+ ],
+ "RA1": [
+ "GP1",
+ "ICSPCLK"
+ ],
+ "RA2": [
+ "GP2",
+ "T0CKI",
+ "FOSC4"
+ ],
+ "RA3": [
+ "GP3",
+ "MCLR",
+ "VPP"
+ ]
+ }
+}}}
+
+It looks like a python dictionary for those who know. It reads like: for
PIC named "10F200", there's a first pin named "RA0" for which there are two
aliases, "GP0" and "ICSPDAT". All this information is available by reading
pin diagram for the given PIC.
+
+Note "RA0" comes from the device file: there's no RA0 pin in datasheet,
but all pins are normalized to this naming convention.
+
+Now open 16F722 datasheet, read the pin diagram for it, and adjust things
in pinmap.json. Once you're done, save it, and check things are formatted
correctly. For this, you can open this JSON file using any parser. For
python, you can use "simplejson":
+
+{{{
+python> import simplejson
+python> pinmap = simplejson.load(file("pinmap.json"))
+python>
+}}}
+
+Any error ? Make sure you did not forget any double quotes, commas, etc...
If no error occured, you're not done yet, now you have to make
sure "adc_pcfg.json" file is also up-to-date. "Hey, I did not sign for thi
s !". Too late, you too are cursed, you need to get things done 'til the
end ! If the PIC has PCFG bits, you may have to fill "adc_pcfg.json". If
not, just jump to the last action.
+
+If you look at 16F877 datasheet and look for "PCFG", you'll find a big
table where PCFG bits combinations are listed to configure ADC pins. This
is what you have to transcribe here. In this file, things are listed by
datasheet references, not by PIC. Find your reference by looking at
PicGroups. you may just have nothing to do, but just make sure things are
ok for your PIC.
+
+Last action, generate all derivate files:
+
+{{{
+python extract_pininfo.py
+}}}
+
+You're done, you're brave.
+
+
+
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---