Chiggleniggle
Posts: 4
Joined: Sun Jun 10, 2018 11:16 am

Baking Pi issues

Sun Jun 10, 2018 11:23 am

I just got a Raspberry Pi 3 B+ and wanted to do the Baking Pi tutorial http://www.cl.cam.ac.uk/projects/raspbe ... /ok01.html

After having some issues i discovered this thread viewtopic.php?t=82871 and did exactly the same but it doesnt work for me.

The RPI works just fine with Raspbain and the Code compiles without problems aswell.

When i start the RPI the ACT LED blinks once and thats it.

User avatar
Ultibo
Posts: 131
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: Baking Pi issues

Sun Jun 10, 2018 11:48 pm

Chiggleniggle wrote:
Sun Jun 10, 2018 11:23 am
I just got a Raspberry Pi 3 B+ and wanted to do the Baking Pi tutorial http://www.cl.cam.ac.uk/projects/raspbe ... /ok01.html

After having some issues i discovered this thread viewtopic.php?t=82871 and did exactly the same but it doesnt work for me.
If you are using a Pi 3B+ have you modified your code to account for the fact the ACT LED is now on GPIO 29 instead?
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

Chiggleniggle
Posts: 4
Joined: Sun Jun 10, 2018 11:16 am

Re: Baking Pi issues

Mon Jun 11, 2018 6:57 am

Thank you very much for your reply Ultibo.

I could not find it anywhere that the ACT LED is is GPIO 29 for the Pi 3B+ but i tried again now and it still doesnt work for me.
Maybe it is my code this time since i am not quite sure how to determine the value when writing the 2nd time to the GPIO Controller.

Code: Select all

.section .init
.globl _start

_start:
    // GPIO Controller Address
    ldr r0,=0x20200000

    // ACT LED is Pin 29
    mov r1,#1       // 29:
    lsl r1,#27      // 9 * 3 = 27
    str r1,[r0,#8]  // 2 * 4 = 8

    mov r1,#1
    lsl r1,#29      // Pin 29
    str r1,[r0,#32] // 32 is GPSET1


// Endless Loop
loop:
    b loop

LdB
Posts: 782
Joined: Wed Dec 07, 2016 2:29 pm

Re: Baking Pi issues

Mon Jun 11, 2018 2:41 pm

The GPIO address is not 0x20200000 it is 0x3F200000 on the raspberry Pi3B+

I think setting the port set to 1 may be off, you may need to set the port to 0 to turn it on depends if the LED is from +3v3 rail or down to ground.
If your code doesn't work try hitting the GPCLR register rather than GPSET.

Chiggleniggle
Posts: 4
Joined: Sun Jun 10, 2018 11:16 am

Re: Baking Pi issues

Mon Jun 11, 2018 4:12 pm

Thank you very much :D

It is working now with 0x3F200000 and GPSET0.

But where did you read that 0x3F200000 is the address?
I cannot find that anywhere..

LdB
Posts: 782
Joined: Wed Dec 07, 2016 2:29 pm

Re: Baking Pi issues

Mon Jun 11, 2018 5:51 pm

We got it from the Raspbian linux driver the source for most inner working details like that as Raspbian is the official O/S :-)

It was also in that link you first gave where they were discussing the baking Pi sample
viewtopic.php?t=82871
Look at the second last post

Pi1 is 0x20000000 + some Offset for all peripherals
Pi 2 and Pi3 are 0x3F000000 + some Offset for all peripherals

Or if you want it from a linux source
https://elinux.org/RPi_GPIO_Code_Samples
Note: For Raspberry Pi 2 and Pi 3, change BCM2708_PERI_BASE to 0x3F000000 for the code to work

Also be aware if you are trying to follow the baking tutorials they are problematic on the Pi3 as you will hit a couple more issues
1.) The PI3 CPU will be given to you in EL2 hypervisor mode you will need to get it into EL1 mode for the final parts of the tutorial
2.) The Floating Point Unit (FPU) starts disabled you use any routines that use it like printf and it will crash.

Chiggleniggle
Posts: 4
Joined: Sun Jun 10, 2018 11:16 am

Re: Baking Pi issues

Fri Jun 15, 2018 12:31 pm

Thank you very much for your answer :D

pmoore
Posts: 2
Joined: Thu Jun 28, 2018 9:53 am

Re: Baking Pi issues

Thu Jun 28, 2018 9:59 am

Chiggleniggle wrote:
Mon Jun 11, 2018 4:12 pm
Thank you very much :D

It is working now with 0x3F200000 and GPSET0.

But where did you read that 0x3F200000 is the address?
I cannot find that anywhere..
Hi Chiggleniggle,

This is great news! I was stuck on the same issue - see https://github.com/Chadderz121/bakingpi ... -309672454

Can you post the complete assembly for your solution? Many thanks!

pmoore
Posts: 2
Joined: Thu Jun 28, 2018 9:53 am

Re: Baking Pi issues

Thu Jun 28, 2018 11:28 am

Yay, it looks like Mauri has converted the Baking Pi code samples to run on the Raspberry Pi 3B!
Hope this helps others too!

Return to “Bare metal, Assembly language”

Who is online

Users browsing this forum: No registered users and 2 guests