Go to advanced search

by Chris_W
Mon Apr 07, 2014 8:44 am
Forum: Bare metal, Assembly language
Topic: GPIO pin always low?
Replies: 4
Views: 1792

Re: GPIO pin always low?

Now I understand. I was not aware about the significance of the brackets when using the LDR instruction. It's like dereferencing a pointer in C.

After modifying the code as instructed, the RPI_PIN_LEVEL() function works as expected.

Thanks.
by Chris_W
Thu Apr 03, 2014 5:31 am
Forum: Bare metal, Assembly language
Topic: GPIO pin always low?
Replies: 4
Views: 1792

Re: GPIO pin always low?

I have modified the function a little as I could not find the assembler reference used when writing the function, and with the new reference more arguments had to be used. However, the GPIO pin is still always high as before. .globl RPI_PIN_LEVEL RPI_PIN_LEVEL: ldr r0,=0x20200034 @ Load address of G...
by Chris_W
Thu Apr 03, 2014 12:31 am
Forum: Bare metal, Assembly language
Topic: GPIO pin always low?
Replies: 4
Views: 1792

GPIO pin always low?

I'm learning bare metal programming on the Raspberry Pi and try to read the pin level of a GPIO pin. These are my assembly functions: @----------------------------------------- @ Configure GPIO16 as output @----------------------------------------- .globl RPI_LED_INIT RPI_LED_INIT: ldr r0,=0x2020000...
by Chris_W
Fri Mar 28, 2014 1:36 am
Forum: Bare metal, Assembly language
Topic: Error in asm function?
Replies: 8
Views: 2286

Re: Error in asm function?

You're reading something wrong, as has been pointed out. Which bit(s) would you expect to be set in r1 if you were to set bit 0 and then issue 49 single left shifts, instead of trying to do it all "in one hit"? Hint: the registers on the Pi are 32 bits wide. I would expect bit 17 to be se...
by Chris_W
Fri Mar 28, 2014 1:34 am
Forum: Bare metal, Assembly language
Topic: Error in asm function?
Replies: 8
Views: 2286

Re: Error in asm function?

Actually there are separate CLEAR registers for each lot of 32 gpios, so to clear GPIO49 you would need to set bit 49 - 32 = 17 of GPCLR1. Not to be confused with the mode registers where there are 3 bits per GPIO. GPCLR0 clears GPIOs 0 to 31, and GPCLR1 clears GPIOs 31 to 53. This is what I'm doin...
by Chris_W
Fri Mar 28, 2014 1:33 am
Forum: Bare metal, Assembly language
Topic: Error in asm function?
Replies: 8
Views: 2286

Re: Error in asm function?

joan wrote:There are separate mode registers for each group of 10 gpios.

What documentation are you using?
I am using the document "BCM2835 ARM Peripherals" page 89 to 104.
by Chris_W
Thu Mar 27, 2014 12:54 pm
Forum: Bare metal, Assembly language
Topic: Error in asm function?
Replies: 8
Views: 2286

Error in asm function?

I have created two simple functions for controlling a specific GPIO of the Raspberry Pi: @----------------------------------------- @ Configure port for GPIO49 as output @----------------------------------------- .globl RPI_DI_INIT RPI_DI_INIT: ldr r0,=0x20200010 @ GPIO Function Select 4 mov r1,#1 l...

Go to advanced search