-->
Page 4 of 7

Re: Direct Pin access (set/clear/direction)

PostPosted: Mon Oct 06, 2014 10:12 am
by Squonk
mamalala wrote:'Doh. Now i feel stupid :P

Greetings,

Chris

No problem, just pinch me the next time I write something stupid :lol:

Re: Direct Pin access (set/clear/direction)

PostPosted: Thu Oct 30, 2014 12:38 pm
by nicoverduin
mamalala wrote:Hello all,


There are several registers that allow setting/clearing a pin that is as output, making a pin an input or output, and reading an input pin. First i added these PROVIDE's to the main linker script, eagle.app.v6.ld, to make those registers available:

Code: Select allPROVIDE(PIN_OUT = 0x60000300);
PROVIDE(PIN_OUT_SET = 0x60000304);
PROVIDE(PIN_OUT_CLEAR = 0x60000308);

PROVIDE(PIN_DIR = 0x6000030C);
PROVIDE(PIN_DIR_OUTPUT = 0x60000310);
PROVIDE(PIN_DIR_INPUT = 0x60000314);

PROVIDE(PIN_IN = 0x60000318);

PROVIDE(PIN_0 = 0x60000328);
PROVIDE(PIN_2 = 0x60000330);



I takte then that I have to download the SDK again? or just add these lines in the LD file?

Re: Direct Pin access (set/clear/direction)

PostPosted: Thu Oct 30, 2014 6:33 pm
by mcsa
I dont Inderstand how to write in registers. For example in PIN_OUT
WRITE_PERI_REG(PIN_OUT,0x05) set gpio0 and gpio2 high. Right or no?

Re: Direct Pin access (set/clear/direction)

PostPosted: Mon Nov 03, 2014 9:08 am
by mamalala
mcsa wrote:I dont Inderstand how to write in registers. For example in PIN_OUT
WRITE_PERI_REG(PIN_OUT,0x05) set gpio0 and gpio2 high. Right or no?


No. The purpose of defining tzhe registers directly is to allow direct access to them, instead of going through the WRITE_PERI_REG stuff. For example:

PIN_OUT = 0x00000005;

should do what you want. Of course the pin has to be set up as an output first.

Greetings,

Chris