PSAS/ capstone2009/ blogs/ capstone2009/ blogs/ jeremybooth/ notes

Back to my blog: jbooth's blog

  1. Task thoughts
  2. Debian notes:
  3. GIT info:
    1. To create a branch
    2. To revert to last commit:
    3. (untested) to revert to commit before last:
    4. to push a branch:
    5. to checkout a branch you haven't seen before:
    6. For commit notes:
    7. Branch info
    8. to be able to pull successfully, my .git/config file had to have a section inserted for "errorhandling" as shown below:
  4. Serial Port / UART notes
  5. Steps to put things on the board via JTAG
  6. My Eagle Notes:
  7. LPC 2378 OLIMEX Board Notes
    1. Buttons
    2. LEDs
  8. GPIO setup
    1. NOTE: WHY DOES GPIO 2 BOUNCE???
    2. SCS bit 0 (0xE01F C1A0) controls the GPIO "mode"
    3. Steps to set up the GPIO:
  9. ADC Setup
    1. To set up the ADC
    2. ADC pins
  10. I2C Jazz
    1. Asumptions

Task thoughts

First, get a button listening task to actuate/toggle a LED task on the board via inter-task semaphore. Then do the same thing with a queue.

Debian notes:

Things I tend to forget about LinuxLand:

How to use find, an example: (don't forget -name... because it isn't automatic. Not sure why...)

find /home -name Makefile

grep example:

grep -r DRDY_STATE ./

GIT info:

To create a branch

user@lappy486:~/freertos-5.1.2-lpc23xx$ git branch -all
* master
  origin/HEAD
  origin/master
user@lappy486:~/freertos-5.1.2-lpc23xx$ git branch test
user@lappy486:~/freertos-5.1.2-lpc23xx$ git branch -all
* master
  test
  origin/HEAD
  origin/master
user@lappy486:~/freertos-5.1.2-lpc23xx$   

To revert to last commit:

git reset --hard HEAD 

(untested) to revert to commit before last:

git reset --hard HEAD^

to push a branch:

git push origin <branchName>
//this creates a branch on the server if it has not been created.

to checkout a branch you haven't seen before:

git checkout -b test origin/test
//not entirely sure...

For commit notes:

subject line blank line description of change in text body

Branch info

http://www-cs-students.stanford.edu/~blynn/gitmagic/ch04.html

to be able to pull successfully, my .git/config file had to have a section inserted for "errorhandling" as shown below:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = git+ssh://jbooth@git.psas.pdx.edu/git/freertos.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[branch "test"]
        remote = origin
        merge = refs/heads/test
[branch "i2c"]
        remote = origin
        merge = refs/heads/i2c
[branch "errorhandling"]
        remote = origin
        merge = refs/heads/errorhandling

Serial Port / UART notes

//204104232009 So it would seem that "resp = xSerialGetChar(0, &theChar, 10);" inherently buffers input, to some length or another, and then dumps it out one char at a time... It also sets resp == true for each character...

//end 204104232009

//4/21/09 20:56 So errorhandling seems to hose if it doesn't have delays around the string outputs.

resp never seems to go false, so it never leaves the input loop, and never does anything with the string. //end 4/21/09 20:56

minicom doesn't seem to happily downgrade to the speed off the board.
Make sure speeds match.

//(theoretical binary read code follows:)
//(per http://tools.devshed.com/c/a/Web-Development/C-File-IO-and-Binary-File-IO/)
FILE *fp;
fp=fopen("c:\\test.bin", wb); //wb -> "w" = write, "b" = binary
char x[10]="ABCDEFGHIJ";
fwrite(x, sizeof(x[0]), sizeof(x)/sizeof(x[0]), fp);


//For binary File I/O you use fread and frwrite.
//The declarations for each are similar:
size_t fread(void *ptr, size_t size_of_elements, size_t number_of_elements, FILE *a_file);
size_t fwrite(const void *ptr, size_t size_of_elements, size_t number_of_elements, FILE *a_file);

usb serial is on: /dev/ttyUSB0

Steps to put things on the board via JTAG

My Eagle Notes:

EagleCad? cadsoft.de

This isn't nearly as cool as http://psas.pdx.edu/EagleCadWorkshopNotes/

command line placement vs. icon menu vs. dropdown menus.

importing command key set

psas wiki > eaglecad page > goodkeys.scr

running "script goodkeys.scr" from command line binds command keys (a standard set)

script alone will pop up a browser, otherwise file location must be defined or be in path. (is this general, or does Eagle have a path?)

1) schematic 2) library 3) layout 4) CAM 5) ?? 6) autorouter

eaglerc is where the bindings and other information is saved. don't edit this during runtime, or eagle will re-write over the file at close with whatever IT has currently loaded. there is a switch that can be set that keeps this from being edited...

help>editor commands has good stuff.

manual_en.pdf is the manual in english

Devices have a symbol AND a package footprint -have to actually pic a specific package, no "ideal generic" resistors... -euro and american diagram symbols -different types of packages with similar names... -build for schematic first, worry about footprint/layout later -still try to select the actual devices you may want... -sometimes you will design holes in the PCB rather than specifying the part (post BCB additions)

some parts have "no user definable value" but we can define them anyhow. (renaming holes and such)

LIBRARIES:

psas library psas.pdx.edu/EagleCad/ > attachments Library This needs to be wedged into eagle via either of: -control panel > (directories or libraries) can be colon separated -library > use dropdown

rcl has a lot of resistors caps and inductors...

can add to library... or use something close temporarily

cadsoft.de has additional libraries that are not installed by default can define your own libraries, or download build ones from the web...

Searches too slow? use -* removes all libraries, and then you can add just the ones you are using, so you speed up searches.

//end libraries

ground symbol for layout... supply > bar ground

show highlights connected pins dots are junctions... this shows connected nets.

warnings while wiring: "merge net segment 'N$5' into ... BAR GROUND"? Eagle expects that nets to be merged have the same name. this renames the merged net, then you can rename the net. This can be useful later if the net has been renamed more than once... (this tells you that something has likely been connected wrong) Eagle has some rules for naming merged nets, unclear... check the result, as the merge may not give you what you really wanted.

show ?$? will higlight all nets with autoassigned names !!all nets should have sensical names!! "name" command can rename nets.

label ?

ERC - electrical rule check -errors and warnings... -warnings can be approved, and no longer show as warnings, but show as "approved" -run this from the command line

right clicking while placing nets cycles through wire bend options ctrl right click selects the bend complement (if you are on right angle bend, it selects the opposite bend direction, and not the next bend)

ensuring that nets connect: -make sure you touch on or are close to the grid points -ctrl key can get you to the nearest net broken junction: -redraw net -type j for junction

you can edit the grid size!

esc will get you out of a move

has an undo...

origins and group moves. -origin is the red plus/cross in any schematic diagram symbol -make a group (grey drag window over schematic, or line polygon) that contains the origins of the objects you want -right click or ctrl right click to select group, then the group can be dragged and they all move (I think...)

panning is turned off by default can type something like 'set interface.useCtrlForPanning = "1" ', this is found in eaglerc

Naming conventions can be found at: psas.pdx.edu/RocketNames

if you have part of a package disconnected it will show as a warning "invoke" will allow you to view these as well.

making a package: library editor dropdown Library > open > file > new (or you could put it into an existing library) dropdown Library > symbol > pfet need to then copy (called "cut") and then paste into new symbol ctrl+I or info gives nifty stuff "direction" of a new part should generally be specified. The ERC uses this to apply the correct rules. typing pin will add a pin -direction is now specified in a menu above, -swaplevel (0 default) non zero swap level means that connecting to any one(with the same number) is the same as connecting all(with that same number). The number defines the swap group. -pin lables can be made visible or not... -pad numbers can be made visible (relates to pad on the "device") function can be set to dot, clock or none. -pins are the most important, the rest is pretty much art. -"change" from the command line lets you edit a whole bunch of things.

PART and other things like it help > editor commands > text (text variables) -multi gate components show >PART>GATE or the partname with the gatename appended.

(dropdown?) library > package -give it a name -give a description -pads are the most important here. the rest does matter very much though (silk screen etc.) -silkscreens should have pad areas trimmed by default -total dimensions of the package on the datasheet -good to put the total area down in the silkscreen -smd is for surfacemount -pads may be rounded and angled. -pad dimensions are on datasheet -can use command line to enter x,y coords for pad placement (probably works for other crap) -see psas.pdx.edu/EagleCad page for layer documentation -make device names on the Name layer -need to assign names to pins and such (different than device name) -everybody needs to have different names. can use name.x and names will be different, but will look identical on the schematic (multiple grounds or NCs)

creating a board "board" at the command line, or the board button this seems to just slap everythign down beside a dimension line -set the dimension line to meet your mechanical constraints -drag and place your components -start with the critical pieces (short length bits for HF) "disp -tnames" from the command line will hide the tnames. "disp" can be used to show and hide other things.. "rats" or ratsnest will recalculate 'airlines' that show connections -minimize overlapping 'airwires' -when moving, hit right button to rotate -ctrl when moving will snap to grid. -optimize routing as much as possible -start replacing airwires with actual routes -ripup removes the placed routing (delete will throw errors) -ripup can also remove the entire net, so be careful -layers can be used to run routes below each other -vias, generally use round vias

"poly" for polygon thermals reduce the connection to the ground plane, increased thermal resistance makes it easer to solder, and -isolate sets how small of voids the ground plane will fill? -restrict keeps traces out of an area. You get errors if you draw into this, but the polygon respects restricts, and will not draw in them.

'smashing' allows you to move names around

always load the schematic and board together. This preserves the forward/backward annotation.

layer 19 is "unrouted" and shows or hides the airwires

default design rules(default.dru) might not be what you want. edit or download from the manufacturer (*.dru files)

want to wire on mm.

prewritten programs for eagle (.ulp) "run statistic-sch" <- tells you lots of good stuff, like which libraries you used. "run bom" <- bill of materials

updating libraries will update design...

drc for design rule check

cam processor

gerbers - text file that has the layout for export to the manufacturer Use only this format: GERBER_RS274X -see psas names page (psas.pdx.edu/RocketNames ?) makes a bunch of Out. files use 3rd party app to view, like gerbv

excellon format doens't always get the decimal point right, so check where the holes wound up.

board runs cost a lot, so get the specs right!!

didn't conver solder masks...

//end Eagle notes

LPC 2378 OLIMEX Board Notes

Buttons

Button 1 (BUT1) - P0.30/U1D- (pin 43) NOTE: P0.30 is tied to P0.29 in odd ways, read user manual ch10 5.1!!!

Button 2 (BUT2) - P0.6/I2SRX_SDA/SSEL1/MAT2.0 (pin 113) pinned out on ext2-3

LEDs

STAT (STAT) - P1.19/CAP1.1 (pin 47) (wtf? seriously, what's this for???) whatever it is, it's active low, and not pinned out anywhere just yet.

The 2 green LEDs that have been added to the proto section of the board run at around 1.7 mA when powered straight from 3.3 V, and emit a dim luminosity. I'm assuming these are under voltage/under current and fine to run directly without a limiting resistor.

GPIO setup

NOTE: WHY DOES GPIO 2 BOUNCE???

SCS bit 0 (0xE01F C1A0) controls the GPIO "mode"

from the docs: 0 GPIO ports 0 and 1 are accessed via APB addresses in a fashion compatible with previous LPC2000 devices. 1 High speed GPIO is enabled on ports 0 and 1, accessed via addresses in the on-chip memory range. This mode includes the port masking feature described in the GPIO chapter.

Steps to set up the GPIO:

  1. ensure correct SCS if using GPIO 0 or 1
  2. consider masks (should this get masked before direction comes up???)
  3. set or clear the direction register FIOxDIR (1 should be output)

LPC2364/65/66/67/68

100 pin

Port 0: Port 0 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 0 pins depends upon the pin function selected via the pin connect block. Pins 12, 13, 14, and 31 of this port are not available.

Port 1: Port 1 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 1 pins depends upon the pin function selected via the pin connect block. Pins 2, 3, 5, 6, 7, 11, 12, and 13 of this port are not available.

Port 2: Port 2 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 2 pins depends upon the pin function selected via the pin connect block. Pins 14 through 31 of this port are not available.

Port 3: Port 3 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 3 pins depends upon the pin function selected via the pin connect block. Pins 0 through 24, and 27 through 31 of this port are not available.

Port 4: Port 4 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 4 pins depends upon the pin function selected via the pin connect block. Pins 0 through 27, 30, and 31 of this port are not available.


LPC2377/78

144 pin

Port 0: Port 0 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 0 pins depends upon the pin function selected via the pin connect block.

Port 1: Port 1 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 1 pins depends upon the pin function selected via the pin connect block. Pins 2, 3, 5, 6, 7, 11, 12, and 13 of this port are not available.

Port 2: Port 2 is a 32 bit I/O port with individual direction controls for each bit. The operation of port 2 pins depends upon the pin function selected via the pin connect block. Pins 14 through 31 of this port are not available.

Port 3: Port 3 is a 32 bit I/O port with individual direction controls for each bit. The operation of port 3 pins depends upon the pin function selected via the pin connect block. Pins 8 through 22, and 27 through 31 of this port are not available.

Port 4: Port 4 is a 32 bit I/O port with individual direction controls for each bit. The operation of port 4 pins depends upon the pin function selected via the pin connect block. Pins 16 through 23, 26, and 27 of this port are not available.


LPC2387

100 pin

Port 0: Port 0 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 0 pins depends upon the pin function selected via the Pin Connect block. Pins 12, 13, 14, and 31 of this port are not available.

Port 1: Port 1 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 1 pins depends upon the pin function selected via the Pin Connect block. Pins 2, 3, 5, 6, 7, 11, 12, and 13 of this port are not available.

Port 2: Port 2 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 2 pins depends upon the pin function selected via the Pin Connect block. Pins 14 through 31 of this port are not available.

Port 3: Port 3 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 3 pins depends upon the pin function selected via the Pin Connect block. Pins 0 through 24, and 27 through 31 of this port are not available.

Port 4: Port 4 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 4 pins depends upon the pin function selected via the Pin Connect block. Pins 0 through 27, 30, and 31 of this port are not available.


LPC2388

144 pin

Port 0: Port 0 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 0 pins depends upon the pin function selected via the Pin Connect block.

Port 1: Port 1 is a 32-bit I/O port with individual direction controls for each bit. The operation of port 1 pins depends upon the pin function selected via the Pin Connect block. Pins 2, 3, 5, 6, 7, 11, 12, and 13 of this port are not available.

Port 2: Port 2 is a 32 bit I/O port with individual direction controls for each bit. The operation of port 2 pins depends upon the pin function selected via the Pin Connect block. Pins 14 through 31 of this port are not available.

Port 3: Port 3 is a 32 bit I/O port with individual direction controls for each bit. The operation of port 3 pins depends upon the pin function selected via the Pin Connect block. Pins 8 through 22, and 27 through 31 of this port are not available.

Port 4: Port 4 is a 32 bit I/O port with individual direction controls for each bit. The operation of port 4 pins depends upon the pin function selected via the Pin Connect block. Pins 16 through 23, 26, and 27 of this port are not available.


100 pin packages

To enable GPIO

PORT.PIN    PINSELx BITS    SETTING
---- ---    ------- ----    -------
PORT 0.0    PINSEL0 1:0     00
PORT 0.1    PINSEL0 3:2     00
PORT 0.2    PINSEL0 5:4     00
PORT 0.3    PINSEL0 7:6     00
PORT 0.4    PINSEL0 9:8     00
PORT 0.5    PINSEL0 11:10   00
PORT 0.6    PINSEL0 13:12   00
PORT 0.7    PINSEL0 15:14   00
PORT 0.8    PINSEL0 17:16   00
PORT 0.9    PINSEL0 19:18   00
PORT 0.10   PINSEL0 21:20   00
PORT 0.11   PINSEL0 23:22   00
PORT 0.15   PINSEL0 31:30   00


PORT.PIN    PINSELx BITS    SETTING
---- ---    ------- ----    -------
PORT 0.16   PINSEL1 1:0     00
PORT 0.17   PINSEL1 3:2     00
PORT 0.18   PINSEL1 5:4     00
PORT 0.19   PINSEL1 7:6     00
PORT 0.20   PINSEL1 9:8     00
PORT 0.21   PINSEL1 11:10   00
PORT 0.22   PINSEL1 13:12   00
PORT 0.23   PINSEL1 15:14   00
PORT 0.24   PINSEL1 17:16   00
PORT 0.25   PINSEL1 19:18   00
PORT 0.26   PINSEL1 21:20   00
PORT 0.27   PINSEL1 23:22   00
PORT 0.28   PINSEL1 25:24   00
PORT 0.29   PINSEL1 27:26   00
PORT 0.30   PINSEL1 29:28   00


PORT.PIN    PINSELx BITS    SETTING
---- ---    ------- ----    -------
PORT 1.0    PINSEL2 1:0     00
PORT 1.1    PINSEL2 3:2     00
PORT 1.4    PINSEL2 9:8     00
PORT 1.8    PINSEL2 17:16   00
PORT 1.9    PINSEL2 19:18   00
PORT 1.10   PINSEL2 21:20   00
PORT 1.14   PINSEL2 29:28   00
PORT 1.15   PINSEL2 31:30   00


PORT.PIN    PINSELx BITS    SETTING
---- ---    ------- ----    -------
PORT 1.16   PINSEL3 1:0     00
PORT 1.17   PINSEL3 3:2     00
PORT 1.18   PINSEL3 5:4     00
PORT 1.19   PINSEL3 7:6     00
PORT 1.20   PINSEL3 9:8     00
PORT 1.21   PINSEL3 11:10   00
PORT 1.22   PINSEL3 13:12   00
PORT 1.23   PINSEL3 15:14   00
PORT 1.24   PINSEL3 17:16   00
PORT 1.25   PINSEL3 19:18   00
PORT 1.26   PINSEL3 21:20   00
PORT 1.27   PINSEL3 23:22   00
PORT 1.28   PINSEL3 25:24   00
PORT 1.29   PINSEL3 27:26   00
PORT 1.30   PINSEL3 29:28   00
PORT 1.31   PINSEL3 31:30   00


PORT.PIN    PINSELx BITS    SETTING
---- ---    ------- ----    -------
PORT 2.0    PINSEL4 1:0     00
PORT 2.1    PINSEL4 3:2     00
PORT 2.2    PINSEL4 5:4     00
PORT 2.3    PINSEL4 7:6     00
PORT 2.4    PINSEL4 9:8     00
PORT 2.5    PINSEL4 11:10   00
PORT 2.6    PINSEL4 13:12   00
PORT 2.7    PINSEL4 15:14   00
PORT 2.8    PINSEL4 17:16   00
PORT 2.9    PINSEL4 19:18   00
PORT 2.10   PINSEL4 21:20   00
PORT 2.11   PINSEL4 23:22   00
PORT 2.12   PINSEL4 25:24   00
PORT 2.13   PINSEL4 27:26   00


PORT.PIN    PINSELx BITS    SETTING
---- ---    ------- ----    -------
PORT 3.25   PINSEL7 19:18   00
PORT 3.26   PINSEL7 21:20   00


PORT.PIN    PINSELx BITS    SETTING
---- ---    ------- ----    -------
PORT 4.28   PINSEL9 25:24   00
PORT 4.29   PINSEL9 27:26   00

144 pin packages

To enable GPIO

ADC Setup

To set up the ADC

  1. On reset, the ADC is disabled.
  2. To enable the ADC, first set the PCADC bit (bit 12 in PCONP - address 0xE01F C0C4) and then enable the ADC (bit PDN in AD0CR - address 0xE003 4000)
  3. To disable the ADC, first clear the PDN bit, and then clear the PCADC bit.

ADC pins

I2C Jazz

Asumptions

  1. Will treat transmits and receives as sort of "atomic" A send will complete before a receive may begin and vice versa.
  2. The data counter may be a separate global for each I2C interface.