motters
Posts: 5
Joined: Wed May 09, 2018 1:47 pm

[SOLVED] dt-blob changing pin presets

Thu May 10, 2018 9:36 am

Hi,

We're currently starting to use the CM3 in our hardware designs and slowly increase our knowledge around the bcm2837 and embedded computing in general. We've started a github project where we'll be uploading all docs, tools and hardware we create github.com/QutiPi if anyone is interested.

A side note to the below is we're using a custom distro generated via yocto (in above repo). This uses the Raspberry Pi kernel and bootloaders so should not play any effect in the issue we're having (as its a boot stage issue) :) .

We are using the CM3 atm to control a vacuum reservoir system which consists of a range of valves among other things. Hence we need to ensure that certain ports are held low or high impedance at boot up.

From reading around, broadcom, uses a dt-blob.bin file to allow the bootloader to configure ports at startup before the linux kernel runs. The dt-blob file is wrote to the device tree standard and is compiled using the device tree compiler, however it is not a device tree. The dt-blob file is loaded before the bootloader configures the peripherals, hence allowing it to customise the default states. Please correct me if i'm wrong?

We have used the dt-blob to setup the Raspberry Pi official 7" LCD, hence we know that the bootload is loading the dt-blob.bin file from the boot partition. We have also decompiled the dt-blob.bin file created and it does correctly represent the initial dts file.

The issue
However the additional configuration we have added in the dt-blob file to set gpio 35 low does not seem to take effect for up to 3 seconds (see attached).

I don't quite understand why gpio 35 is place high in the first place if my understanding of the boot process is correct?

Can anyone let me know if this seems legit or way off haha? I've also attached the dt-blob files, config.txt and cmdline.txt.

Cheers everyone,

Sam
Attachments
dt-blob.zip
dt-blob and config.tx, cmdline.txt and bcm2710-rpi-cm3.dtb
(120.34 KiB) Downloaded 10 times
GPIO_35 Bootup.png
GPIO_35 on boot
GPIO_35 Bootup.png (141.24 KiB) Viewed 372 times
Last edited by motters on Thu May 10, 2018 2:12 pm, edited 1 time in total.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1814
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: dt-blob changing pin presets

Thu May 10, 2018 11:00 am

As the BCM2835 ARM Peripherals datasheet shows on page 102, GPIOs have a default pull state; for GPIO35 that default pull is high. The only way to ensure that the required pin level is achieved in less than a few seconds is to arrange that the required pin level is the default.

motters
Posts: 5
Joined: Wed May 09, 2018 1:47 pm

Re: dt-blob changing pin presets

Thu May 10, 2018 1:07 pm

@PhilE Cheers for the quick reply.

Yes we saw the default states, but i wrongly assumed that the dt-blob would "re-configure" the defaults before the peripherals were initialised. We're stepping up from uC atm which pretty much all come as high impedance on boot up.

If i get chance this week i'll make a pull request to your Github documentation repo, stating that there will always be a delay even when using a dt-blob.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1814
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: dt-blob changing pin presets

Thu May 10, 2018 1:16 pm

i wrongly assumed that the dt-blob would "re-configure" the defaults before the peripherals were initialised.
Although this sounds great I don't see how it could work. The pins have to be in some state at all time, and if the state before it is configured is not the same as the state afterwards, and if an attached device is monitoring the state from before the configuration occurs, then there will be an observed change. You have to either change the expected state, change the way the state is observed such that uninitialised appears the same as initialised, or delay the first observation until it is known that configuration has completed.

motters
Posts: 5
Joined: Wed May 09, 2018 1:47 pm

Re: dt-blob changing pin presets

Thu May 10, 2018 1:51 pm

Just talked to the guys in the office, and is there any reason the defaults where chosen as they are?

There's no problem as we have a tri-state level translator on the board with an enable pin on all gpio being used. Just general questions for our knowledge and the future :).

Personally for us, if all ports were all high impedance (or settable[low/high/no pulling]) by default then it would allow us to pull low or high with hardware on the board, meaning other hardware will see no change on boot.

I understand that the gpio's have weak pull up/downs and hence we could over come with say a 10k pull up/down, but we're not too keen on that idea.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1814
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: dt-blob changing pin presets

Thu May 10, 2018 2:02 pm

You would have to ask the designers of the BCM2835 GPIO map because they are hardware defaults - how the chip is when it comes out of power-on reset - but they were probably chosen to suit one of the alternate functions (SPI perhaps) and to give the designers of attached hardware a choice.

motters
Posts: 5
Joined: Wed May 09, 2018 1:47 pm

Re: dt-blob changing pin presets

Thu May 10, 2018 2:11 pm

Arh, i see, mystical Broadcom :lol:

Well cheers for the help Phil, you've saved me a lot of time. I'll mark the thread as solved.

Return to “Compute Module”

Who is online

Users browsing this forum: No registered users and 1 guest