f_ changed the topic of ##raspberrypi-internals to: The inner workings of the Raspberry Pi (Low level VPU/HW) -- for general queries please visit #raspberrypi -- open firmware: https://librerpi.github.io/ -- VC4 VPU Programmers Manual: https://github.com/hermanhermitage/videocoreiv/wiki -- chat logs: https://libera.irclog.whitequark.org/~h~raspberrypi-internals -- bridged to matrix and discord
<clever> ah, ACMD41 switches to 1.8v mode
<clever> and i think that should be followed by CMD11?
<clever> and then it defaults to SDR12, a 25mhz 1.8v mode
<clever> and CMD6? is involved in raising the clock further?
<clever> whacked an SD sniffer and scope onto my rpi1
<clever> with no SD card present, it repeats some command several times at 125khz, then gives up
<clever> with a build of little-kernel on the card, it does a quick burst at some higher frequency, and i cant measure it easily
<clever> that would be the 125khz command the rom repeats during a failed boot
<clever> and with some more probing, ive confirmed that the other controller (sdhost) seems to run from PLLC_CORE0 or VPU, it was clocked at 250mhz in my test case
<clever> and the source assumed a 41mhz input clock, so it setup the divisors wrong for the initial 125khz mode
<clever> but even at 125khz, i just get a timeout error, and cant read the card in the sniffer
any1 has quit [Ping timeout: 255 seconds]
any1 has joined ##raspberrypi-internals
jcea has quit [Ping timeout: 268 seconds]
wael has quit [Ping timeout: 264 seconds]
wael has joined ##raspberrypi-internals
ungeskriptet has joined ##raspberrypi-internals
Stromeko has quit [Quit: Going… gone.]
Stromeko has joined ##raspberrypi-internals
user_user has quit [Read error: Connection reset by peer]
wael has quit [Ping timeout: 255 seconds]
ungeskriptet has quit [Quit: Contact links: https://david-w.eu]
ungeskriptet has joined ##raspberrypi-internals
ungeskriptet1 has joined ##raspberrypi-internals
ungeskriptet has quit [Ping timeout: 264 seconds]
ungeskriptet1 is now known as ungeskriptet
ungeskriptet has quit [Quit: Contact links: https://david-w.eu]
ungeskriptet has joined ##raspberrypi-internals
wael has joined ##raspberrypi-internals
f_ is now known as f_`
f_` is now known as f_
wael has quit [Ping timeout: 240 seconds]
user_user has joined ##raspberrypi-internals
jcea has joined ##raspberrypi-internals
user_user has quit [Quit: leaving]
user_user has joined ##raspberrypi-internals
<user_user> Hi all
<user_user> So, clever, as I wanted to test for EMMC clock divider in the Control register - putting 2 to divisor, which according to datasheet means divide EMMC base clock by 4 - does not work, because the very next command to SDcard comes with error intterupt (CRC error)
<user_user> No, actually divisor value 2 is ok, it was just a bug
<clever> user_user: i did some of my own tests on the sdhost controller, and confirmed that its clocked at 250mhz, and my "safe" divisor gave 700khz, not 125khz!
<clever> but i cant get my sd card to identify with the sniffer in place, and only with my own driver
<clever> its weird
<user_user> Yes, I've read, but I did not understand)
<clever> i used one of these to connect a full size SD card to my pi1
<clever> and then i hooked my scope up to CLK and CMD
<user_user> So, I've found a huge bug in my code. I used control1 = read_reg32(EMMC_CONTROL1); control1 |= div << 8 code. Without clearing previous value
<clever> ah yeah, that will cause issues
<clever> many
<user_user> and then after I've started clearing it I had all kinds of problems when trying to access SD card - it has turned out I had a value 0x40 and then added 2 or 4 to that.
<clever> the clock divisor is in bits 8-15
<user_user> so my sd card worked on value 0x42
<clever> ah but you have the <<8, thats good
<user_user> yes, I was doing OR to previous 0x40
<clever> yeah, you need to do the usual &0xffff00ff dance
<user_user> the speed has not changed drastically
<clever> thats part of why the official headers have all of those bit patterns
<clever> the CLR pattern lets you clear FREQ8 and nothing else
<user_user> Without this bug divisor starting from 8 work fine
<user_user> I mean register value 8
<clever> 200mhz/8 is 25mhz i believe
<user_user> i think 200mhz / 16
<user_user> if looking at the datasheet
<clever> ah yes, 8 means /16
<clever> so 12.5mhz
<clever> the part i'm still confused on, is which speeds need special commands
<user_user> yep.
<clever> in my case, i have a pi1 booting a custom bootcode.bin, via the SD sniffer i linked from sparkfun
<user_user> Ok, at least some progress... Anyways I am going to test sd card perf without distraction from the videocore ISP stuff
<clever> my custom bootcode.bin then tries to mount the SD card, and it immediately fails
<user_user> Ok.
<user_user> Maybe put retries?
<clever> i could try, that would also help with probing it via the scope
<clever> but developing on the pi1 is anoying, because you have to swap the SD card on every test
<user_user> By the way, I've stopped trusting my time measuring function. Because it's based on scheduler time slices and system clock peripheral.
<user_user> Maybe I should use some other clock.
<clever> if you want to measure time, just read ST_CLO before and after
<user_user> On 3b+ is the same, no?
<clever> and the difference, is how many uSec it took
<user_user> I can not because ST_CLO is used for scheduling
<clever> the ST_CLO register is readable on every pi model, even the pi5
<clever> but ST_C0, the compare/irq stuff, cant generate core-local IRQ's
<clever> so its not scheduler friendly on a multi-core arm
<user_user> I set a certain amount of milliseconds into ST_CLO everytime - or count up to that number and then reset and collect ticks
<clever> ST_CLO should be read-only
<user_user> I need to have a look
<clever> basically, ST_CLO and ST_CHI form a 64bit counter, it starts at 0 when the pi is reset, and it just counts at 1mhz
<clever> ST_C0 thru ST_C3 form 4 compare channels, that can each generate a different irq, when ST_CLO matches
<user_user> ok, yes
<clever> but the firmware is using one, and they cant interrupt a specific arm core, so they are useless on the pi2 and above
<user_user> I can use raw ST_CLO, thanks)
<clever> yep