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

Pi 3B+ Activity LED

Mon Mar 19, 2018 7:18 am

It seems odd that no one has even mentioned the 3B+ in the bare metal forum yet so I'll be the first.

Since the change that came with the Pi 3 to put the activity LED on a virtual GPIO accessible only by using a mailbox call caused so much consternation to those trying to get started with bare metal programming, you'll be very pleased to know that on the 3B+ it has returned to a plain old GPIO pin again.

For reference the activity LED on the 3B+ is now on GPIO 29 (Broadcom numbering).

Have some blinkin fun ;)

EDIT: FYI this also applies to the new 3A+
Last edited by Ultibo on Wed Dec 12, 2018 12:25 am, edited 1 time in total.
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!

AlfredJingle
Posts: 69
Joined: Thu Mar 03, 2016 10:43 pm

Re: Pi 3B+ Activity LED

Tue Mar 20, 2018 7:33 pm

Well, I had to wait till today to get my hands on one. I had no problems getting it to run at 1.5 Mhz and the boatloader of DWELCH works nicely. Things which I noticed as seemingly different are that I see a lot more noise created on the power-lines, and the colors created on the monitor (bare-metal) are different. Dark blue is now almost black and yellow is a bit washed out. So they seem to use a different range. I need to more testing before my final judgement, but my first impression is that it is an easy transition from 3b to 3b+

Hadn't noticed the led at GPIO 29 but I will play with it immediately!!

Have you any idea what the normal core-frequency is? (not the CPU frequency) I presently run with a core-frequency of 400, but that seems low compared to the cpu freq of 1.4 or 1.5
going from a 6502 on an Oric-1 to an ARMv8 is quite a big step...

jahboater
Posts: 4454
Joined: Wed Feb 04, 2015 6:38 pm

Re: Pi 3B+ Activity LED

Tue Mar 20, 2018 8:46 pm

AlfredJingle wrote:
Tue Mar 20, 2018 7:33 pm
Have you any idea what the normal core-frequency is? (not the CPU frequency) I presently run with a core-frequency of 400, but that seems low compared to the cpu freq of 1.4 or 1.5
Yes 400Mhz is the default core frequency (using Raspbian).

dwelch67
Posts: 954
Joined: Sat May 26, 2012 5:32 pm

Re: Pi 3B+ Activity LED

Fri Mar 30, 2018 7:29 pm

I wasnt going to buy one but seeing this thread and they put the led on a gpio, I went ahead. The pin(hole) next to the reset (run) does not appear to be ground. found a nice ground nearby, but with the prior ones was pretty easy to solder in a mini switch. (this is for my reset so I dont have to unplug before re-running the bootloader). led blinks just fine btw, thanks for the info!

jsimmonds
Posts: 3
Joined: Mon Apr 02, 2018 2:23 am
Location: Australia

Re: Pi 3B+ Activity LED

Tue Apr 03, 2018 10:57 pm

@Ultibo : My thanks, too, for declaring the Broadcom GPIO number of the ACT_LED

If you also know the Broadcom GPIO number of the PWR_LED , I'd *love* to know that too 8-)

It's a guessing game out here with only the Reduced RaspPi 3B+ Schematic to refer to.

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

Re: Pi 3B+ Activity LED

Thu Apr 05, 2018 12:02 am

jsimmonds wrote:
Tue Apr 03, 2018 10:57 pm
If you also know the Broadcom GPIO number of the PWR_LED , I'd *love* to know that too 8-)
No such luck with the PWD_LED, it is still connected to the GPIO expander that is only available using the mailbox interface.

We posted some info last year about the GPIO expander, that interface still works on the Pi 3B+ except the red LED has moved to pin 2 and is now active low instead.

Of course this isn't so bad, having the activity LED on a standard GPIO helps with getting started and most people soon realize that the mailbox interface is needed for lots of things (framebuffer, memory, clocks, power etc) so once you get that working the red LED becomes available as well.
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!

jsimmonds
Posts: 3
Joined: Mon Apr 02, 2018 2:23 am
Location: Australia

Re: Pi 3B+ Activity LED

Thu Apr 05, 2018 1:53 am

@Ultibo : Appreciate your helpful response . . ( enough to send a supporting donation to your org. !)

Am brand new to the Raspberry Pi world, having dabbled with Tessel 2, Intel Edison, Intel Joule and MinnowBoard Turbot !
Love the quality of Raspbian and the RPi hardware.

I probably shouldn't have posted here, as I wanted to control the Pi3B+ (RED) PWR_LED from Linux user-land.
Have found the code snippets I needed for C++ using the /dev/vcio device channel.

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

Re: Pi 3B+ Activity LED

Fri Apr 06, 2018 10:45 am

jsimmonds wrote:
Thu Apr 05, 2018 1:53 am
@Ultibo : Appreciate your helpful response . .
No problem, glad it was useful.

Good luck with whatever you are doing.
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!

ankushnag14
Posts: 10
Joined: Mon Apr 30, 2018 9:13 am

Re: Pi 3B+ Activity LED

Wed May 02, 2018 9:30 am

Is it possible to use GPIO 29 similarly in RPi 3B version 1.2?

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

Re: Pi 3B+ Activity LED

Wed May 02, 2018 11:41 am

ankushnag14 wrote:
Wed May 02, 2018 9:30 am
Is it possible to use GPIO 29 similarly in RPi 3B version 1.2?
No, access to the activity LED on the 3B is only available via the virtual gpio or gpio expander interface which uses the mailbox functions.
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!

User avatar
Arjan
Posts: 261
Joined: Sat Sep 08, 2012 1:59 pm

Re: Pi 3B+ Activity LED

Wed May 02, 2018 6:16 pm

Ultibo wrote:
Mon Mar 19, 2018 7:18 am
For reference the activity LED on the 3B+ is now on GPIO 29 (Broadcom numbering).
And the mailbox property is still working fine. So there is no need to detect if you are running on 3B or on 3B+.
http://www.raspberrypi-dmx.org/
Open Source DMX/RDM/MIDI/OSC/Art-Net/sACN solutions

ankushnag14
Posts: 10
Joined: Mon Apr 30, 2018 9:13 am

Re: Pi 3B+ Activity LED

Thu May 03, 2018 2:26 pm

I need to trigger an interrupt whenever there is low voltage and sd card access (which can be done using pin change interrupt on GPIO29 in RPI3 B+). Using mailbox service is polling operation and I have to keep running the command in loop and check the status.
Can you suggest how I can do the same thing in RPI3 B ?
I got to know that apx803 will be set to high whenever there is an under-voltage. Can I detect this change in pin change interrupt. Please suggest some options.

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

Re: Pi 3B+ Activity LED

Fri May 04, 2018 3:39 am

ankushnag14 wrote:
Thu May 03, 2018 2:26 pm
I need to trigger an interrupt whenever there is low voltage and sd card access (which can be done using pin change interrupt on GPIO29 in RPI3 B+). Using mailbox service is polling operation and I have to keep running the command in loop and check the status.
Can you suggest how I can do the same thing in RPI3 B ?
As far as I know the firmware uses the power LED (Red) to indicate low voltage, see this post for more discussion about it.

Looking at the device tree blob it shows the [email protected]_LOW as type = "external" for Pi 3B (which means attached to the GPIO Expander) and type = "absent" for the Pi 3B+. From that I don't see any way to trigger an interrupt when an under voltage occurs on either a 3B or 3B+.

The indication of SD card access on the activity LED (Green) is a function of the Linux drivers so that won't help much if you are doing bare metal.
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!

ankushnag14
Posts: 10
Joined: Mon Apr 30, 2018 9:13 am

Re: Pi 3B+ Activity LED

Fri May 04, 2018 7:11 am

Ultibo wrote:
Fri May 04, 2018 3:39 am
ankushnag14 wrote:
Thu May 03, 2018 2:26 pm
I need to trigger an interrupt whenever there is low voltage and sd card access (which can be done using pin change interrupt on GPIO29 in RPI3 B+). Using mailbox service is polling operation and I have to keep running the command in loop and check the status.
Can you suggest how I can do the same thing in RPI3 B ?
As far as I know the firmware uses the power LED (Red) to indicate low voltage, see this post for more discussion about it.

Looking at the device tree blob it shows the [email protected]_LOW as type = "external" for Pi 3B (which means attached to the GPIO Expander) and type = "absent" for the Pi 3B+. From that I don't see any way to trigger an interrupt when an under voltage occurs on either a 3B or 3B+.

The indication of SD card access on the activity LED (Green) is a function of the Linux drivers so that won't help much if you are doing bare metal.
If you were in my position. How would you deal with getting information from the kernel. Can you please suggest some ideas.

ankushnag14
Posts: 10
Joined: Mon Apr 30, 2018 9:13 am

Re: Pi 3B+ Activity LED

Fri May 04, 2018 9:40 am

ankushnag14 wrote:
Fri May 04, 2018 7:11 am
Ultibo wrote:
Fri May 04, 2018 3:39 am
ankushnag14 wrote:
Thu May 03, 2018 2:26 pm
I need to trigger an interrupt whenever there is low voltage and sd card access (which can be done using pin change interrupt on GPIO29 in RPI3 B+). Using mailbox service is polling operation and I have to keep running the command in loop and check the status.
Can you suggest how I can do the same thing in RPI3 B ?
As far as I know the firmware uses the power LED (Red) to indicate low voltage, see this post for more discussion about it.

Looking at the device tree blob it shows the [email protected]_LOW as type = "external" for Pi 3B (which means attached to the GPIO Expander) and type = "absent" for the Pi 3B+. From that I don't see any way to trigger an interrupt when an under voltage occurs on either a 3B or 3B+.

The indication of SD card access on the activity LED (Green) is a function of the Linux drivers so that won't help much if you are doing bare metal.
If you were in my position. How would you deal with getting information from the kernel. Can you please suggest some ideas.
Can I edit this file? so that I can redefine @POWER_LOW as internal and set it to any gpio

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

Re: Pi 3B+ Activity LED

Fri May 04, 2018 10:52 am

ankushnag14 wrote:
Fri May 04, 2018 7:11 am
If you were in my position. How would you deal with getting information from the kernel. Can you please suggest some ideas.
It's not quite clear from your question, are you doing this in bare metal or are you using Linux?

If you have a way to create a thread or a task then periodically requesting the information from the firmware and then alerting whatever needs to know is probably the most practical solution, this is similar to what the Raspbery Pi firmware driver does for under voltage alerts.
ankushnag14 wrote:
Fri May 04, 2018 7:11 am
Can I edit this file? so that I can redefine @POWER_LOW as internal and set it to any gpio
Modifying the file is documented but you would probably need to ask someone from Raspberry Pi if that would work.
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!

ankushnag14
Posts: 10
Joined: Mon Apr 30, 2018 9:13 am

Re: Pi 3B+ Activity LED

Fri May 04, 2018 11:21 am

Ultibo wrote:
Fri May 04, 2018 10:52 am
ankushnag14 wrote:
Fri May 04, 2018 7:11 am
If you were in my position. How would you deal with getting information from the kernel. Can you please suggest some ideas.
It's not quite clear from your question, are you doing this in bare metal or are you using Linux?

If you have a way to create a thread or a task then periodically requesting the information from the firmware and then alerting whatever needs to know is probably the most practical solution, this is similar to what the Raspbery Pi firmware driver does for under voltage alerts.
ankushnag14 wrote:
Fri May 04, 2018 7:11 am
Can I edit this file? so that I can redefine @POWER_LOW as internal and set it to any gpio
Modifying the file is documented but you would probably need to ask someone from Raspberry Pi if that would work.
My question was how do you catch the event in an interrupt when kernel detects the low voltage event.

zeoneo
Posts: 52
Joined: Sun Sep 30, 2018 6:54 am

Re: Pi 3B+ Activity LED

Tue Oct 30, 2018 7:47 am

Hi

I am trying to start with bare metal programming on RPI 3B+.

https://github.com/dwelch67/raspberrypi ... /blinker01

This is supposed to blink ACT led on 29th(Broadcom) GPIO pin, but it doesn't work. Anybody tried this?
Let there be some light .../\...

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

Re: Pi 3B+ Activity LED

Tue Oct 30, 2018 1:00 pm

Nope but it has a pretty obvious bug ... not 27 .. try 9 .. no idea where the 27's come from

Code: Select all

ra=GET32(GPFSEL2);
    ra&=~(7<<27);
    ra|=1<<27;
PUT32(GPFSEL2,ra);
Each GPFSEL covers 10 GPIO as they are 3 bits .. 10x3 = 30 bits of the 32 bit register .. look at datasheet

GPFSEL0 = GPIO0 .. 9
GPFSEL1 = GPIO10..19
GPFSEL2 = GPIO20..29

So 9 is the shift value you want to GPFSEL2

zeoneo
Posts: 52
Joined: Sun Sep 30, 2018 6:54 am

Re: Pi 3B+ Activity LED

Wed Nov 28, 2018 6:52 pm

Thanks,

It worked out well.
Let there be some light .../\...

User avatar
DavidS
Posts: 4247
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Pi 3B+ Activity LED

Thu Nov 29, 2018 12:29 am

Good information, thank you much.

Though I would love to know how you got the CPU down to 1.5MHz, I have never managed lower than 250MHz on any RPi. That is the absolute most impresive part of your post.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

macload1
Posts: 14
Joined: Mon Jul 07, 2014 6:50 am

Re: Pi 3B+ Activity LED

Thu Nov 29, 2018 11:04 am

I think he just made a typing error MHz => GHz

dwelch67
Posts: 954
Joined: Sat May 26, 2012 5:32 pm

Re: Pi 3B+ Activity LED

Tue Dec 11, 2018 10:54 pm

LdB wrote:
Tue Oct 30, 2018 1:00 pm
Nope but it has a pretty obvious bug ... not 27 .. try 9 .. no idea where the 27's come from

Code: Select all

ra=GET32(GPFSEL2);
    ra&=~(7<<27);
    ra|=1<<27;
PUT32(GPFSEL2,ra);
Each GPFSEL covers 10 GPIO as they are 3 bits .. 10x3 = 30 bits of the 32 bit register .. look at datasheet

GPFSEL0 = GPIO0 .. 9
GPFSEL1 = GPIO10..19
GPFSEL2 = GPIO20..29

So 9 is the shift value you want to GPFSEL2
From the first post in this thread:

"For reference the activity LED on the 3B+ is now on GPIO 29 (Broadcom numbering)."

From broadcoms documentation GPIO pin 29 control is GPFSEL2 bits 27,28,29.


ra=GET32(GPFSEL2);
ra&=~(7<<27);
ra|=1<<27;
PUT32(GPFSEL2,ra);

...

PUT32(GPSET0,1<<29);

...
PUT32(GPCLR0,1<<29);

Did they change it from pin 29 to something else? bits 9,10,11 are gpio 23 and my other code would need to change to 23 as well...

What am I not understanding?

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

Re: Pi 3B+ Activity LED

Wed Dec 12, 2018 12:24 am

dwelch67 wrote:
Tue Dec 11, 2018 10:54 pm
Did they change it from pin 29 to something else? bits 9,10,11 are gpio 23 and my other code would need to change to 23 as well...
No, there has been no change.

Even the new 3A+ is still pin 29 so your code is correct.
dwelch67 wrote:
Tue Dec 11, 2018 10:54 pm
What am I not understanding?
I think someone is confusing GPSET/GPCLR which are 1 bit per pin with GPFSEL which is 3 bits per pin.
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!

Return to “Bare metal, Assembly language”