#general-chat

1 messages ยท Page 58 of 1

gritty galleon
#

and those blobs don't have anything to do with secure boot (other than the first stage bootloader)

glacial wigeon
#
[clever@amd-nixos:~/apps/rpi/roms]$ ls -lh *.bin
-rw-r--r-- 1 clever users 32K May 29  2022 pi400-0xdaaa69e8.bin
-rw-r--r-- 1 clever users 64K May  3  2020 pi4-maskrom.bin
-rw-r--r-- 1 clever users 20K Oct 28  2020 rpi1-230aad04.bin
-rw-r--r-- 1 clever users 20K Oct 28  2020 rpi1-55a4377c.bin
-rw-r--r-- 1 clever users 20K Oct 28  2020 rpi2-1077df95.bin
-rw-r--r-- 1 clever users 32K Oct 28  2020 rpi3-9080d9b6.bin
#

i also have a boot rom for each model, but not all of the revisions within one

#

another potential DMCA case, which is why i havent shared it

#

] db 0x60000000 0x5000
if you want a rom, just boot up little-kernel, and run this hexdump command in the prompt

#

and the whole rom will just spill out

gritty galleon
#

Get hundreds of people to each publish a fraction of it ๐Ÿ˜‰

raw jasper
#

Espressif are good on the customer experience and supply to individuals side. They don't seem to boast about being open or anything

glacial wigeon
#

the only real protection ive found, is that the official start.elf binary somehow turns the ROM off

#

so if you try to dump things from arm, after booting fully, the rom isnt on the bus

raw jasper
#

The more I hear about the pi, the more it reminds me of a game console

glacial wigeon
#

but a custom start.elf intercepts that, and can just dump it

glacial wigeon
#

so the entire OS ran on the VPU core

raw jasper
#

I mean, if it's Turing-complete.... :P

glacial wigeon
#

and at some point in the SoC's life, an engineer said, "why not throw an arm in there, we might need it later"

#

and thus, the bcm2835 was born

#

the arm is very much a slave/co-processor within the soc

raw jasper
#

Please tell me the ARM is an AXI/AHB peripheral to the videocore :P

glacial wigeon
# raw jasper I mean, if it's Turing-complete.... :P

the VPU is a dual-core RISC-like design

32 registers, int or float in the same register, 32bits each
some of the upper registers are special purpose, like arm (stack/status/pc)
all memory access is via dedicated load/store opcodes, none of that mov insanity x86 has
each core has a 64x64x8bit vector register bank

raw jasper
#

:P

glacial wigeon
# raw jasper Please tell me the ARM is an AXI/AHB peripheral to the videocore :P

at 0x7E00B000 in the address space, is the arm control registers

thru that, you can:

  • turn the arm on/off
  • allow jtag on the arm, and route it to either the gpio header, or an internal bitbang unit
  • access some FIFO's that bridge the arm/vpu boundary
  • control what parts of memory the arm is allowed to touch
  • even block userland access to MMIO!
raw jasper
#

It's like a reverse of ship of Theseus, with multiple jet engines and a carbon fiber shell retrofitted onto a Phoenician merchant ship core

glacial wigeon
#

there is a dedicated broadcom custom MMU, that splits the "1gig physical" view of the arm, into 64 pages of 16mb

for each page, you can point it anywhere in the VPU's bus space

#

so, you can partition the arm off in its own 64mb pocket of ram, where it can just never touch the DRM keys or VPU firmware

gritty galleon
river inlet
#

Hello, Iโ€™m new and wondering where I can ask a troubleshooting question about a raspberry pi lcd screen. Thanks!

glacial wigeon
#

you can just not map MMIO to the arm, so the arm has no way of escaping its jail

#
for (int i=0; i<16; i++) { int temp = a[i] * b[i]; if (store) c[i] = temp; if (accumulate) accumulator[i] += temp; }

with the vector extensions on the VPU, you can perform this entire line of code in 2 clock cycles
and it can run back2back, with nearly 100% uptime, at the full 500mhz

#

the question then, is what fun can you do with this?

raw jasper
#

cursed_cuda

#

:P

glacial wigeon
#

for most operations, it supports 8/16/32bit int
but for mult, the inputs are 16bit max, but output can be 32bit

#

sadly, no floats in vector mode

raw jasper
#

Ah, so it's fixed-point only at best

#

Meh. Boring

glacial wigeon
#

yep

gritty galleon
glacial wigeon
#

it does have vectorized bit shifting and masking

raw jasper
#

You can make a very fast FIR filter or something with it

#

:P

glacial wigeon
#

so you can shift your fixed-point stuf around

gritty galleon
glacial wigeon
gritty galleon
# river inlet Ok ty

just please don't cross-post unless someone sends you to another channel ๐Ÿ™‚

glacial wigeon
#

first, load 2 arrays, both are uint16_t[r0*16] in size

#

then multiply each element, and add the sums to the uint48_t accumulator[16]

river inlet
glacial wigeon
#

then sum all 16 accumulators, >>15 the sum, and shove it into r0

gritty galleon
glacial wigeon
#

and boom, you can now apply a FIR filter with between 1 and 1024 coefficients

#

the coefficients array must be a multiple of 16, but you can just pad it with 0
anything*0 == 0 of course!

glacial wigeon
#

@raw jasper but, there is a trick you can pull off, for FIR filters

lets say the table is 64 elements long

if i load 64+16 elements into the vector array
then i can run part of the FIR loop twice
and produces samples N and N+16

#

boom, for the cost of loading an extra 16 elements, i avoided loading 64 elements in the future

#

dram bandwidth down massively, at the cost of having a 16 sample latency

#

arm vector extensions cant do this, because you cant store the whole bloody uint16_t[64] in registers at once

raw jasper
#

that's cool

glacial wigeon
#

you can also just omit loading the coefficients array, halving your dram bandwidth

#

its constant, so why load it each time?

#

but, that assumes you have exclusive use of the vector registers

#

and now your back to the same problem as x86/arm, when do you context-switch the fpu

raw jasper
glacial wigeon
#

yeah

#

the official rpi firmware, protects the vector state with a mutex, and threads cant migrate to another core

#

so you grab the mutex, do your thing, then release it

#

but, you can be pre-empted mid computation

#

and the vector state will wait for you to resume execution

raw jasper
#

is your state stored somewhere?

glacial wigeon
#

nope, other threads are just banned from touching the vector core

#

they would block on the mutex

#

and wait until its their turn

raw jasper
#

But you just said applications can be preempted

#

Unless I'm missing something, which, you know, it's late over here :P

glacial wigeon
#

you can lose control of the cpu, and the scalar registers (32x4byte) get context-switched out

#

but the vector registers dont get context-switched

#

anything else that wants to use the vector, must grab a mutex, where it will then block, until your done

raw jasper
#

Ah, so the other app tries to use the vector registers, and gets blocked by the mutex

glacial wigeon
#

yep

#

with this, you give the firmware the addr of a function, and 6 args to pass to it

#

the firmware will grab the vector mutex for you, and execute whatever you pointed it at

#

and when that function returns, the mailbox tells you what was left in r0 (the return value)

raw jasper
#

Is there a public programming manual for the videocore somewhere?

glacial wigeon
#

that was made by the guys RE'ing the core

raw jasper
#

ah, I was thinking official broadcom stuff :P

glacial wigeon
#

the official compiler is behind NDA

raw jasper
#

ah

glacial wigeon
#

binutils supports the vector opcodes

#

but gcc only supports the scalar opcodes

#

so any vector fun you do, must be entirely hand-written asm

raw jasper
#

I wonder whether there are any SoCs with publicly documented vector accelerator cores

rapid geode
glacial wigeon
#

the VPU is very arm-like, mainly scalar, with vector extensions

raw jasper
#

Ah, so there's the videocore, which is for 2d, and the.... 3D core, which is something different? (Mali GPU?)

glacial wigeon
#

while the QPU is vector only, every opcode runs 16 times, with 16 banks of registers and 16 inputs

glacial wigeon
#

the HVS is a sprite-only gpu
for each sprite, you define:

  • its XY on screen
  • its source WH
  • if scaling is in effect, the WH on screen
  • the addr/stride of each plane in ram
  • the pixel format
  • hflip/vflip flags
  • alpha control flags
#

this demo has 13 sprites, all using the same image data

#

and uses basically 0 cpu power

#

@raw jasper that all make sense so far?

glacial wigeon
#

the pixel format for the sprite can be anything in this list

#

so youve got rgb332 all the way to rgba8888

#

and you have several planar variants of yuv

#

the HVS automatically converts that to rgba8888 and automates alpha blending of the sprites

#

and supports both pre-multiplied alpha, and non

#

the HVS takes a max of 3 sprite lists, and generates 3 FIFO's of pixels

#

for the pi0-pi3 family, there are then 3 pixel valves

#

the PV stores all of the video timing parameters (like a crtc in x86 land)

#

and the PV will throttle the flow of pixels to a defined pixel clock, generate hsync/vsync, and turn flow off during blanking

#

the PV then feeds the pixels and control data to an encoder

#

which turns it into various video formats

#

only 1 encoder can be active, for each PV

#

dsi0 isnt exposed on the main rpi boards, only the compute modules
so you have no choice with PV0

#

smi isnt documented, so you have no choice with PV1

raw jasper
#

Back to vector acceleration on the rpi

glacial wigeon
#

so your only real choice, is vec(ntsc/pal) or hdmi
and if you want to enable dpi and/or dsi1

raw jasper
#

You have arm neon

#

the videocore

#

and the 3D core

glacial wigeon
#

there are at least 5 cpu clusters in the "video core"
1: arm
2: vpu
3: v3d
4: isp
5: vce

#

the ISP is heavily involved in pixel format conversions, scaling, bayer->yuv, and camera correction

#

the VCE is involved in vc1/mpeg2/h264 encode/decode

#

the VPU mostly just doing non-integer samplerate conversion on audio, for the analog audio port
and runs the firmware that coordinates everything

#

v3d runs all of the shaders for 3d jobs

#

VCE has shown signs of being turing complete

#

v3d is turing complete, but your conditional opcodes have an extra flag, "any lane" or "all lanes"

#

ISP is mostly a black-box still

#

@raw jasper this would be a mandelbrot somebody else wrote, using floats (i forget if its hw or sw float) in scalar mode, on the VPU

#

it takes ~10 seconds to render 1 frame

#

i found a guy in another discord, that wrote mandelbrot in VPU asm, with vector opcodes

#

it does a frame in ~90ms

#

10s->90ms is a pretty big speed leap

glacial wigeon
#

there is an official QPU fft example

#

and with mesa, you can just run your own shaders, but i dont think compute shaders work yet

#

i also have baremetal QPU examples

raw jasper
#

Why is it not often used for accel, since it does float?

glacial wigeon
#

the mesa stack doesnt support compute shaders

#

so you have to bodge something into the rendering stack

raw jasper
#

(presuming you are hitting the bare metal -- don't worry, I'm reading what you write :P)

glacial wigeon
#

ive also not figured out how to do compute jobs in baremetal

#

this is the official QPU FFT example, it relies on the broadcom GL stack

#

and uses a mailbox call to fire the job off

#

back when broadcom first opened the v3d/qpu docs, somebody made a project called "hackdriver", that rendered a single static triangle

raw jasper
#

the broadcom GL stack sits somewhere in linux land, right?

glacial wigeon
glacial wigeon
raw jasper
#

......ok o.o

glacial wigeon
#

in theory, that broadcom GL stack supports DRM and secure video playback

#

you could send some encrypted h264 to the VPU, and decrypt+decode it into a protected frame

you can then use that frame as a texture in the broadcom GL

and now the render is "tainted" and can only be played over hdmi hdcp

#

and even if you compromise the linux side, you can never get the raw video frames

#

but all of the DRM support logic is missing, and the rpi firmware doesnt setup the security

#

the hw is capable, but the firmware has been lobotomized

#

the mesa stack runs the entire 3d system from linux

raw jasper
#

...by RPCing an oracle binary living in the firmware

glacial wigeon
#

mesa doesnt do that

#

mesa/linux have proper drivers, that directly control the v3d core

raw jasper
#

Ah, OK

tardy badger
raw jasper
#

So, default raspbian talks to the blackbox oracle

glacial wigeon
#

pi0-pi3 have low ram, and the broadcom GL is better at managing that

glacial wigeon
#

pi4 v3d isnt compatible with broadcom GL, so mesa must drive the show

#

but pi0-pi3 can be switched to mesa GL, at the cost of more ram usage

raw jasper
glacial wigeon
#

the VPU firmware and palmos on the treo650, both use a thing called a relocatable heap

#

any time you alllocate an object, you get a handle to it, not a pointer

raw jasper
glacial wigeon
#

so they skipped it, and just gave linux full control from day 1

raw jasper
#

that's actually pretty cool, that they actually mainlined oss drivers

glacial wigeon
#

they are moving towards linux managing everything, piece by piece

#

when contracts allow

#

hw h264 doesnt

#

hw h265 does

raw jasper
#

interesting

glacial wigeon
#

if you want to operate on the object in the relocatable heap, you call lock() on the handle, and get the current phys addr

#

when your done operating on it, you call unlock() and must forget about its addr

#

the firmware is then free to defrag the heap, and consolidate free space, by moving any unlocked object around

#

palmos on the treo650 does this, because it lacks an MMU, and every running app has to share the ram, and as it fragments, you must defrag

#

and the VPU firmware, for basically the same reasons

#

mesa uses the CMA heap on linux, but linux CMA isnt capable of defrag

#

so the more you fragment it, the harder it is to find a 4mb chunk for a buffer

#

so you need more ram allocated to CMA

#

for the pi0-pi3 family, the v3d has unrestricted DMA access to all of system ram, and maybe even MMIO

#

for the pi4, v3d was put behind a custom MMU, that maps its 4gig/32bit view, onto the 8gig of system ram

glacial wigeon
#

ah, you found one!

raw jasper
glacial wigeon
#

it might use DMA to do the actual moves

#

but its the same basic problem even userland linux has

#

the malloc() heap in glibc gets fragmented over time

#

and while you may have 20mb free in the heap, you dont have a 1mb hole

#

so you have to ask the kernel for another 1mb

#

heap defrag lets you move things around and fix that

raw jasper
#

Yup!

raw jasper
# tardy badger

I actually found this one, but I wanted to find an original capture from the game :)

glacial wigeon
#

with the mailbox interface, you can access the relocatable heap

#

and alloc/lock/unlock/free any object

#

there is also an undocumented unlock flag, to say you dont care about the buffer contents

#

so, if your done with a buffer, you can use that flag when you unlock it

#

the system will move the reservation around, but not preserve the contents

#

which can be a performance improvement

#

the v3d is a tile based 3d core

#

i think 64x64 pixel tiles

#

to render a frame, you first have to write a binner control list

#

this tells the 3d core various things
the w/h of the 2d output
the addr of the vertex attributes
the coordinate shader

#

the coordinate shader will turn each set of attributes, into an XY on the screen

#

the binner then figures out which 64x64 tile(s) a polygon covers
and add the polygon to a per-tile list

raw jasper
#

It seems you really like thinking about graphics rendering

glacial wigeon
#

ive had to memorize all of this, to write usable drivers

#

the render control list, will then go over the trimmed list of polygons, for each tile

#

and render 1 tile at a time

raw jasper
#

you need to write a book one day

glacial wigeon
#

and that involves running the vertex shader, to turn attributes into XY+vary[]

#

and then it runs the fragment shader on every pixel within the rasterized polygon

#

on the surface, the coordinate/vertex/fragment shaders are just functions running on a scalar core

#

but behind the scenes, the v3d will batch 16 jobs for the same shader, and run them on a vector-only core

#

all running in lock-step, 1 opcode, 16 register banks, doing the same thing 16 times

raw jasper
#

I mean, the shader had to filter multiple pixels, so it only makes sense

glacial wigeon
#

yep

#

but there are a lot of fun shortcuts there

raw jasper
#

(I am not really a graphics person, so if my terminology or understanding are off.... you've got what to blame :P)

glacial wigeon
#

i think its technically a 4 lane vector-only core

#

but, due to the pipeline, it takes 4 clock cycles to execute an opcode

#

to hide that, it interleaves things

#

so, on the 1st clock, stage0 of the pipeline is running threads 1/2/3/4

raw jasper
#

Does it do one instruction per cycle with a depth of 4, or is it part sequential?

glacial wigeon
#

on the 2nd clock, stage0 is running threads 5/6/7/8
stage1 is doing 1/2/3/4

#

and so on...

#

so, after 4 clocks, you have done 16 lanes worth of work

#

but its actually just 4 lanes in hw

#

and each thread, is only starting an opcode every 4 clocks

raw jasper
#

4 lanes / 16 threads?

glacial wigeon
#

so the latency doesnt show up, when you try to read a register right away

#

yeah, you could describe it like that

#

kind of hyperthreading

#

and because of this, it only has to decode an opcode once every 4 clocks

raw jasper
#

hyperthreading would imply logic duplication though

glacial wigeon
#

4 of these, then shader an opcode decoder

#

a lot of weirdness, so it can cut down on gate-count

#

some math ive done, says its effectively a 192 core cpu

#

but when i later learned more, i'm now doubting that, and i need to go back and confirm things

raw jasper
glacial wigeon
#

yeah, lol

raw jasper
#

It's really admirable how much they've managed to cobble together on that chip

glacial wigeon
#

this is running baremetal on the VPU

#

the triangle is a single polygon, with only a fragment shader

#

its rendering into a double-buffered image

#

and page-flips on vsync

#

but i made a slight mistake in the logic

it schedules the pageflip to happen on the next vsync
then it immediately begins rendering into the "old" buffer, that is still on-screen

#

so the top tip of the triangle tears

raw jasper
#

(if you were doing a consumer demo you'd have to have a rotating prism to "prove" it's 3D :P)

raw jasper
glacial wigeon
#

at the time, i never got vertex shaders working

#

so its doing the coords in software

#

i did get texture based rendering working, in another codebase

#

each character is made up of 4 polygons
2 triangles for the black version
2 for the white version, creating a shadow effect

#

i wrote my own opengl stack from scratch, and piped wowmapviewer into it, lol

#

back before the mesa stack was a thing

glacial wigeon
#

the 3d core, has its own vector memory, similar to the VPU

#

and the hardware will load the vertex attributes into that

#

the vertex shader must then read it, compute XY, and write XY back to the vector memory

rapid geode
#

now this is what i need as an escape key.

#

ha

glacial wigeon
#

lol

rapid geode
#

ha

glacial wigeon
#

@raw jasper where compute shaders come into play, is that you can just do arbitrary read/write of anywhere in ram
so a properly crafted shader could fetch data, and then compute things for you, and then just write back to ram, and ignore the entire image layer

#

there is also priority stuff, to balance all 4 types of shaders, coordinate/vertex/fragment/compute

#

the other fancy thing, is the opcodes themselves

#

0x819e7540, 0x114248a3, /* fadd r2, r2, r5; mov r3.8a, r0 */

#

left is the fully assembled opcode

#

fadd r2, r2, r5; mov r3.8a, r0 is a single 64bit opcode

#

the left column, is entirely add based opcodes only
the right column is entirely mult based opcodes

both run in parallel

#

some DSP's have a thing called "fused multiply add"

QPU instead just lets you do non-dependant mult and add

so the 1st opcode can mult things
the 2nd opcode can do the add, and mult other things

#

mesa includes a compiler that can generate QPU assembly

#

@raw jasper most recently, ive been working on usb-host support in #tinyusb
that will allow the open firmware to boot from usb (both MSD and network), and also give keyboard access

raw jasper
glacial wigeon
#

FMA would have probably made the pipeline longer

#

this method gives you the same performance, for bulk FMA operations

but a slight bit of overhead at the start/end

#

and enables other trickery when your not doing FMA

#
mov r0, vary; mov r3.8d, 1.0
fadd r0, r0, r5; mov r1, vary
fadd r1, r1, r5; mov r2, vary
fadd r2, r2, r5; mov r3.8a, r0
nop; mov r3.8b, r1
nop; mov r3.8c, r2
mov tlbc, r3; nop; thrend
nop; nop; nop
nop; nop; sbdone
raw jasper
#

Yeah, you could in theory be doing preprocessing for another step while doing an accumulate in parallel

glacial wigeon
#

vary in this case, is a FIFO

#

the 1st line will pop the FIFO, and load a 1.0 into the alpha

#

the 2nd line will add the popped value with r5, and pop another

#

then repeat that a few times

raw jasper
#

What is r3.8d? Fixed-point format?

glacial wigeon
#

the fancy packing/unpacking thing

#

r3 is a 32bit register

#

r3.8d says to treat the d byte as an 8bit float

#

so it bi-directionally casts 0-255 into 0.0 to 1.0

raw jasper
#

oh

glacial wigeon
#

on reads, 0-255 -> 0.0-1.0

#

on writes, the reverse, 0.0-1.0 -> 0-255

raw jasper
#

It looks fairly flexible

glacial wigeon
#

so it can cheaply turn a RGBA8888 pixel into 4 floats

raw jasper
#

I wonder why they haven't made a beefier version

sick apex
#

do you guys buy stuff from ali express?

raw jasper
#

Depends on the seller?

sick apex
#

fair

#

just ordered a few things from there

#

figured if they arrive then sick

raw jasper
#

You're in Europe, right? You'll have to wait a few months

sick apex
#

15 day delivery

#

i've ordered other things from there before

#

they're not too bad

#

its usually a day or 2 before or after then it says it will come

raw jasper
sick apex
#

all of them are around august 12th

raw jasper
#

Hah. July's almost done

#

Didn't even realize

sick apex
#

yeah its weird

raw jasper
#

woo.

glacial wigeon
sick apex
#

it felt like new years last week

glacial wigeon
#

the RE team does everything in an arm style, so arm devs can easily pick it up

sick apex
#

this whole year has been wake up, eat, teach lessons, eat, code, shower, sleep

#

every day

raw jasper
#

Do you have a link to the mesa assembler thing?

sick apex
#

it's been the same thing

#

i ordered 3 x CC1101

raw jasper
#

Make sure to leave some time for yourself sometime

sick apex
#

i do

#

that's the coding part

glacial wigeon
sick apex
#

i love coding CatVibe

raw jasper
#

Nah, I meant besides coding

glacial wigeon
#

it seems to support both 8bit and 16bit unpacking

sick apex
#

but i like coding

#

its fun

raw jasper
#

You're young, and you'll have to keep doing this for decades

#

It's a marathon

#

Not a race

glacial wigeon
#

so r3.16a and r3.16b are 16bit int<->float conversions

sick apex
#

i've already been coding for about 10 years

#

give or take

raw jasper
#

Yeah, just make sure not to burn out

#

It doesn't hurt to go outside and touch grass for an hour or so ;P

#

(Seriously)

sick apex
#

i do

#

i go out every weekend

raw jasper
#

Oh that is not alright

sick apex
#

i just find it cool that i can have an idea and then i can make that idea a reality

#

and then upload it to github

#

and move on

raw jasper
#

Your body is not designed to take that

#

Try to go out for an hour or so every day

#

If you don't do it not, you'll have to do it later

sick apex
#

then give me the human equivalent of an EOBD reader and i'll reprogram myself

#

kekwarp hopefully my brain doesn't have a core panic

raw jasper
#

It's not a brain thing

#

It's a body thing

sick apex
#

it is a brain think, when you go outside and get excercise your brain releases endorphins because of caveman things

#

i cant spell

raw jasper
#

Nah, the body's circulatory, musculoskeletal and GI systems have not been designed (evolved) for a sedentary life

#

One (or more!) of those will getcha if you don't start taking care of yourself now

sick apex
#

good point

#

welp anyways imma sleep CatVibe

raw jasper
#

That's a good idea

sick apex
#

yes

#

CatVibe i'll be back tomorrow when i break my code again

#

gn

raw jasper
#

Just remember you have a body beyond your head too! :P

sick apex
#

As an AI language model, I don't have a body or a head.

raw jasper
#

heh

tardy badger
#

Just cold hard processing power

sick apex
raw jasper
#

ha

tardy badger
#

Pentium 3 for me

raw jasper
sick apex
#

literally me

#

youtube keeps auto turning subtitles on for me

#

and jeff geerling has broken subtitles

glacial wigeon
#

it does that for me too

#

turn it off and back on, with the CC button

#

then its fixed

raw jasper
#

Or use the c key

glacial wigeon
#

@raw jasper do you know much about usb?

raw jasper
glacial wigeon
#

ah

#

i now know more then i ever wanted to know, lol

raw jasper
glacial wigeon
#

ive just been reading the official usb2 specs

#

but its kind of dry and not clear in parts

raw jasper
#

Well, I guess that book would make things at least a bit clearer :P

glacial wigeon
#

and is more of "how it should work", and doesnt mention all of the quirks from devices not following the spec

raw jasper
glacial wigeon
#

luckily, ive got the stack already, tinyusb

#

but the dwc hardware is rather lacking, and i need to do a lot to make it work

raw jasper
#

dwc?

glacial wigeon
#

the usb controller in all pi models

#

interrupt endpoints are mis-named, and used for things like keyboard/mouse, and also a hub to say when things are plugged in

#

the usb host must send an IN token, which includes an addr and endpoint#

#

the device can then respond with a DATA0 or DATA1 packet, and some data, the host then answers with ACK

#

but, if nothing has happened, the device answers with NAK instead of DATAn

#

and the host just tries the IN again later

#

for any proper usb controller, it will retry the IN automatically

raw jasper
glacial wigeon
#

and only tell the host when it found a reply

#

for the dwc controller, it stops at the NAK, and fires an interrupt

#

you must then manually retry it

raw jasper
#

(the usb2 spec is 650 pages. I am not surprised, but... yeah. Good luck)

glacial wigeon
#

the other major limitation of the dwc, is that there is only 8 channels

#

so, if you have more then 8 devices, in the hub/keyboard/mouse category, the dwc is incapable of querying them all at once

#

and the driver must manually switch them out

#

and give each a turn

raw jasper
#

I can't imagine plugging >8 devices into a pi anyway... but isn't the ethernet one of the 8 devices?

#

Or am I misremembering?

glacial wigeon
#

ethernet is usb, but i'm not sure its using an interrupt endpoint

#

id need to double-check

#

i also have a usb dongle for a wireless keyboard&mouse, that uses 2 interrupt endpoints!

#

also, the internal hub uses up one int endpoint

raw jasper
#

heh, usb "interrupts" are weird

glacial wigeon
#

so with just that dongle, ive already used up 3 of the 8 channels

#

yeah

raw jasper
#

Even I, who hasn't worked with USB anything, know about the interrupt polling

glacial wigeon
#

my usb headset is also using ...

raw jasper
#

It's kind of infamous at this point :P

glacial wigeon
#

3 endpoints

#

2 for audio, 1 interrupt for the buttons

#

and audio is always moving data, so that eats up channels

#

so, with just the headset and keyboard dongle
thats 3+2+1 channels used

#

there goes 6 of 8

#

a usb drive also needs 2

#

and now youve run out, and the ethernet has none to spare when it needs to send a packet

#

so the driver has to decide what gets a turn next, and alternate

raw jasper
glacial wigeon
#

yep

#

but commands are also on the "write" channel

raw jasper
#

As a point of comparison, how many concurrent interrupt channels could a PC controller serve?

glacial wigeon
#

i dont think xhci has a limit

#

each endpoint has its own buffer in ram, and the controller will hit them all up

#

for the pi0-pi3 family, the dwc2 is the only usb controller

#

you have a single 480mbit high-speed port, that can run in host or device mode

#

but the model-b's have a hub in the way, forcing host-only

#

the zero's expose the dwc bare on the micro-b port, with OTG_ID wired up properly
so it can function as both host and device, and detect when you use an OTG adapter cable

#

and the model-a's expose it bare on a host usb-a port
a mis-wired cable can use it in device mode, but auto-detection wont know, so you have to force it in config.txt

#

pi4(00) changes things around

#

the dwc, and an xhci controller, share the same D+/D- pins, and you can only select one at a time
both come out via the usb-c port

#

a second xhci controller lives on the pcie bus, and gives you 4 usb ports, 2 at usb3 speeds

raw jasper
#

the raspi.... has a pcie bus

#

o.o

glacial wigeon
#

so the pi400 can operate in both host and device at the same time

#

yeah, the bcm2711 has a single pcie x1 lane

#

and the vl805 pcie<->usb3 controller is on the board, so you dont have access to pcie

raw jasper
#

Aaah

#

:(

glacial wigeon
#

if you replace the vl805 with this PCB, the pcie lane will be exposed over one of the usb3 ports

#

then you can just hook it up like this

raw jasper
glacial wigeon
#

this should scare them more ๐Ÿ˜›

raw jasper
#

bad bot

glacial wigeon
#

shal i try again?

raw jasper
#

wait for some time and post it

glacial wigeon
#

i can also just spam them in PM

#

or not, youve got that disabled, lol

raw jasper
#

Yeah, you have to send a friend request

glacial wigeon
#

does this give you nightmares?

#

this is why the 1st one said "easier"

raw jasper
#

Next step is to plug in an ancient GPU

glacial wigeon
#

the CM4 also just gives you proper access to it, and jeff geerling has been working on getting GPU's working

raw jasper
#

I'm surprised there aren't any breakout boards for the CMs...

late fulcrum
#

I thought there were

raw jasper
#

There are? In that case, I am not well-informed ;P

#

Not that it matters anyway

#

The things are backordered to death

glacial wigeon
#

there are many

raw jasper
#

LOL, there's one, right from the horse's mouth

glacial wigeon
#

the idea, is that you make your own breakout board, to suit your needs

raw jasper
#

Unless you're me and can't design PCBs :P

gritty galleon
#

it's still way easier to get the carrier boards than the CM4's ๐Ÿ˜‰ though I have one of each and should really put some time in on it

raw jasper
gritty galleon
raw jasper
gritty galleon
glacial wigeon
#

nvme wont really get around that

raw jasper
glacial wigeon
#

the cm4 has an extra trick up its sleeve, for emmc

#

on the pi0-pi3, its a 4bit 50mhz SDR interface

#

so it can move 4*50mil bits/sec, or 200mbit

#

the pi4, has a 4bit 50mhz DDR interface, so double that, 400mbit!

#

the CM4 with emmc, has an 8bit 50mhz DDR interface, double it again, 800mbit!

#

but thats just the interface, if the flash can keep up is an entirely different question

raw jasper
#

til emmc supports double data rate access

glacial wigeon
#
[root@system76:~]# find /sys -name ios
/sys/kernel/debug/mmc0/ios

[root@system76:~]# cat /sys/kernel/debug/mmc0/ios
clock:          50000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    2 (sd high-speed)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)
#

the SD reader in my laptop, is running at 50mhz, 4bit, SDR i think

#
root@pi400:~# cat /sys/kernel/debug/mmc0/ios
clock:          50000000 Hz
actual clock:   50000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    7 (sd uhs DDR50)
signal voltage: 1 (1.80 V)
driver type:    0 (driver type B)
#

but on my pi4 (ignore the hostname), its DDR 50mhz

#

youll also notice, the pi4 is using 1.8v

#

the bits can wiggle faster, if they dont have to wiggle as much!

#

but the pi4 wifi, is 50mhz 4bit SDR, so back to 200mbit

#
root@pi400:~# cat /sys/kernel/debug/mmc1/ios
clock:          50000000 Hz
actual clock:   41666667 Hz
#

correction, 41.6mhz

#

166mbit

raw jasper
rapid geode
#

just thinking of all the emotions i feel when i press escape...

#

ha

#

๐Ÿ˜›

glacial wigeon
#

๐Ÿ˜„

fossil dawn
fossil dawn
#

exactly! ๐Ÿ˜†

rapid geode
#

no

solar kindle
#

So, I've been playing with a 3D-printed crosspoint matrix keypad, and ali1234 has been working on OpenSCAD code to generate keyboard layouts. I'm now thinking about combining the two ideas, adding a Feather to decode the matrix and act as an HID device to make it into a custom keyboard.

limpid sedge
#

how do i find which size screws i need to mount a board adafruit boardd?

rapid geode
#

the drawing should tell you the hole diam

#

which usually matches (close) the M metric screw thread

limpid sedge
#

where can i find drawings for

limpid sedge
#

i need them for other parts

urban arrow
#

My goodness from over 1800 to 407. Methinks I gotta make my move for my first PI...

tranquil swallow
#

Too expensive for me, maybe when my pi3 dies

urban arrow
#

Do we think PI3 will ever be stocked?

glacial wigeon
#

yes

tardy badger
#

3B+ and 3A+ get stocked semi regularly

urban arrow
#

Thanks.

limpid sedge
tardy badger
#

not as much, but improving

raw jasper
#

PowerUP boards were dual-processor accelerator boards designed by Phase5 Digital Products for Amiga computers. They had two different processors, a Motorola 68000 series (68k) and a PowerPC, working in parallel, sharing the complete address space of the Amiga computer system.

glacial wigeon
#

heh, the pistorm/emu68 stuff is more crazy

#

they use a JIT to translate m68k into aarch64 asm

#

then just run it naked (not even a vm) on the pi, in kernel mode

raw jasper
#

That's... as if apple had transitioned to ARM from PowerPC

glacial wigeon
#

it has access to the rpi peripherals and all 1gig of ram

#

they then created a virtual expansion rom, that talks to the sd card, and advertises a disk to the amiga kernel

#

as-in, they wrote drivers for the rpi sd card, compiled it to m68k asm

#

then JIT'd it back to aarch64, lol

#

and the whole thing runs in big-endian mode

#

so it has to byte-swap every time it touches rpi peripherals

raw jasper
#

The amiga will do those kinds of things to your mind ;P

glacial wigeon
#

with my help, they added drivers for the rpi's 2d core

#

that allows changing the "guest" resolution instantly, and adjusting the up-scaling parameters as seen in this demo

raw jasper
#

wow!

glacial wigeon
#

internally, the 2d core on the rpi is just a sprite-only gpu

#

for each sprite, you define its XY on screen, its source WH, and the dest WH

#

you can change the "guest" resolution by just changing the definition of the amiga framebuffer, and telling the rpi to up-scale it to fit

raw jasper
glacial wigeon
#

exactly

raw jasper
#

And it's even JIT

glacial wigeon
#

the rpi memory is treated as "fastram" which is a concept that amiga accelerators already had

#

fastram is tied to the cpu, and cant be accessed by legacy DMA

#

but can then run at a faster clock, with the cpu

#

"slowram" and legacy MMIO is a mmu trap i think, that will use SMI to wiggle pins on the m68k cpu socket

#

so the amiga software just seamlessly works

late fulcrum
#

I understood some of those words!

glacial wigeon
#

its also using the existing RTG (retargetable graphics) framework, which is what original amiga GPU's used, to extend the system

#

the emu68 RTG driver, routes to the hdmi port, and can run at 4k

raw jasper
#

All they now need is a HiDPI mod for amigaos :P

#

I love how they have IRC in the background :D

tardy badger
#

Same

glacial wigeon
#

and here, its doing bloody raytracing, while playing an mp3

mild lark
#

dat WinAMP skin... oh how I miss win amp

glacial wigeon
#

the amiga people are nuts

raw jasper
#

I admire their spirit in keeping the machine alive for so long

glacial wigeon
#

they ported(or found a port?) duke nukem 3d

raw jasper
#

Ah yes, computing speed -> Off the chart >:P

glacial wigeon
#

yeah, lol

#

the other crazy thing

#

the JIT cache, and JIT hit/miss counters, are exposed as m68k co-processor registers

raw jasper
#

I would not want to play that duke nukem port for too long though :(

glacial wigeon
#

so "native" m68k programs, can query those counters, and adjust the JIT cache size

#

and provide stats

#

and a lesser known fact, the arm core in every rpi, is capable of running in both LE and BE mode

#

for 32bit arm, there is just the setend opcode, and it has caused issues in the past, userland can flip it!

#

for 64bit arm, the kernel has to co-operate, and linux doesnt support BE userland with LE kernel

but linux does support BE everything

#

emu68 is barematal aarch64, so it can just go BE and stay BE

raw jasper
#

Is this an aarch64 thing, or a broadcom extension thing?

glacial wigeon
crisp lantern
#

I'm inspired by Northridgefix to quit DJing in a strip club for $50/hr and dive into electronics repair but I didn't study any electrical engineering

late fulcrum
#

I didn't either, you don't need a degree to understand how to fix stuff

tardy badger
#

Or how to design around high powered lasers

#

Or work for some massive companies like IBM ๐Ÿ˜›

#

Madbodger is my hero in that regard. Showing that a piece of paper doesnโ€™t mean you actually get to do cool things; but actually being ambitious and curious can get you there.

glacial wigeon
tardy badger
#

There ya go!

#

Thatโ€™s awesome ๐Ÿ™‚

glacial wigeon
#

school might have gotten me there faster, but i still got there in the end

tardy badger
#

Itโ€™s not how fast you get there, itโ€™s the journey

#

Your journey seems to have taken you where you want to be and thatโ€™s amazing

glacial wigeon
#

it was a long and complex chain of events, heh

#

back when i was in school, i already knew c64 basic/qbasic/visualbasic, and some c/perl

tardy badger
#

I graduated high school in 2011, tried my hand at engineering 2013-2014, didnโ€™t make it. Floundered for 3 more years. Finally went back to school, got an associates, then another, and another. And finally December 2020 I got my Bachelorโ€™s in Computer Engineering

glacial wigeon
#

around when i got kicked out of school, i was playing a webgame, and used mirc to chat with others
and somebody linked some http txt files for scraping data from the game

#

and mirc scripting is where i first figured out how to do socket programming

tardy badger
#

Hehe mIRC was so fun

glacial wigeon
#

and that project slowly evolved over time, eventually growing to a mix of mirc/php/mysql

#

which got me into linux

#

years of bouncing between distros eventually led to gentoo, but then somebody i was sharing memes with on teamspeak mentioned that he cant view them easily

tardy badger
#

I made a Texas hold โ€˜em game in mIRC scripting. I discovered years later how algorithmically complex Texas hold โ€˜em is to code and that I did it for fun without realizing that.

glacial wigeon
#

clicking the links didnt do anything

#

and i installed his distro, to try and debug the problem, lol

#

at first i couldnt reproduce it, but did eventually figure it out and fix it

tardy badger
#

Nice!

glacial wigeon
#

then a few more years of using that distro, and helping users out, and i caught the eye of somebody who then offered me a job, after seeing how i could diagnose issues with nix

tardy badger
#

Iโ€™m not that accomplished, Iโ€™ve made a few small things but nothing significant. Not that I can publicly share anyway

#

Iโ€™ve accomplished plenty at my day job but it isnโ€™t exactly public facing work so the world will never know ๐Ÿ™‚

glacial wigeon
#

ive also picked up the rpi-open-firmware project on the side, and have been working on improving it

tardy badger
#

I enjoyed reading your conversations about Linux/raspbian and stuff.

#

Anyway, great chat! Gotta get some sleep. 5am comes too quickly these days

glacial wigeon
#

laters

rapid geode
#

sleep is for the weak

bleak fox
#

For powering an Arduino Nano with a battery pack through USB. Would a 5V/3.4A capacity of 12000 mAh or 5.1v/2.1A capacity of 3300 mAh be sufficient? The official site says operating voltage is at 5V and input voltage is 7-12V. I'm assuming the operating voltage means through USB/5V and input voltage is unregulated?

bleak fox
vagrant wolf
#

If you have one of those 3.7v LiPo batteries around, they will work aswell

half plank
#

How can I read an analog voltage higher than 5v on an arduino uno

glacial wigeon
slim shard
lunar trench
#

how thick is this part of a male USB-A part?

#

im guessing it's 0.2mm but it seems a bit too thick

ebon dew
#

It depends, not all of them are 100% precisely identical. If you just need a rough estimate then a set of calipers would work for a quick measurement.

#

or you could look up usb connector schematics on digikey

#

a quick measurement with my calipers says 0.30mm

#

4.5mm x 12mm for the housing

karmic dawn
#

ummm where can i get help for basic py and maybe how to use vs code?

rain cradle
#

if it is circuitPY, there's a channel for it, but i guess this channel may work too (along with VSCode questions)

ebon dew
#

for python and vscode honestly i would say look up some youtube videos. plenty of good video tutorials out there and plenty of websites that will teach you the basics of syntax and setup.

#

if you have specific questions those are easier to answer than a general walkthrough via text chat.

marble flax
#

Stayed here last week, great place close to Gatwick Airport if you are traveling. The home of Lady Ada and her family in adult years.

raw jasper
#

I wonder how many peripherals exist which use the full AXI enchilada...

glacial wigeon
raw jasper
#

AXI is also used beyond ARM, in FPGA and ASIC designs to interconnect peripherals

glacial wigeon
#

yeah

raw jasper
#

Like all bus protocols, it is something

#

:P

glad ruin
raw jasper
#

...at least for AXI5 ๐Ÿ˜…

sick apex
#

what you guys think, i take out that screen

#

and install a fuel sensor

#

and program a screen to display everything

#

because for some reason, lexmoto in their infinite wisdom didn't add a fuel gauge or meter

glacial wigeon
#

wut?!

sick apex
glacial wigeon
#

the wut, was for not adding any fuel meter!

sick apex
#

ohhhhhhh

#

yeah

#

there is no fuel gauge

glacial wigeon
#

how is that a good idea?? lol

raw jasper
#

How are you even supposed to drive that? Just refuel regularly and pray?

sick apex
#

to my knowledge

raw jasper
#

:P

sick apex
#

i only got it yesterday

raw jasper
#

(Check the manual, it might be an additional "mode")

sick apex
#

because i was bored so i decided to buiy it

sick apex
#

it's only 2 years old

#

because the guy thought the engine was broken

#

it was sat for 6 months

#

i went up in my friends car

#

with a battery jump starter

#

i jumped the battery after paying for it

#

and it started

#

the guy was mad

raw jasper
#

Find the manual somewhere on the 'net or fiddle around with the buttons -- My guess is that the fuel level display is an additional option/mode/whatever and you have to switch to it

sick apex
#

i haven't played with it much

#

i took the battery out

#

it's charging

raw jasper
#

hopefully in an open or well-ventilated space ๐Ÿ˜…

sick apex
#

it's charging with the proper equipment

#

in the correct place

#

and it has full power cutoff

#

or whatever its called

olive dome
#

Hi @glacial wigeon, A quick question about USB 3.0 and USB2.0:
If I have a USB 2.0 device streaming data (like RTL-SDR and FT2232H), the total bandwidth is within 480Mbits spec but given the USB2.0 shared bus nature it is not that stable, Do you think it will help if I use VL671 to turn those in to USB 3.0 devices?

glacial wigeon
#

so yeah, that would have to share with the other ports

#

i would assume that a VL671, or any usb3 hub with TT, would be able to fix things

#

the usb-c is a second entirely seperate 480mbit usb2 interface

olive dome
#

yeah the USB-C is connected directly to the SoC, and you can actually see they are trying to do something with the USB-PD but messed up

#

VL671 specifically is a translator from USB 2 to USB 3

#

which is not allowed in usb spec but they do that anyways

glacial wigeon
#

ahhh

#

usb1/usb2 has the same problem, usb2 hubs have a "transaction translator" and the host has to send special "split transactions"

glacial wigeon
olive dome
#

Correct, but that means the USB 2 device is still under USB 2 hub arch

glacial wigeon
#

and on something like a pi4, every usb2 device shares a single root port, even when using a usb3 hub!

#

i can see how that would just suck

olive dome
#

I think VL671 specifically was designed for VR, NVIDIA's VirtualLink uses the USB 2.0 pair on USB-C connector for additional lanes for USB 3.0, so the VR headset doesn't have USB 2 connection and you still need that for things like audio.

#

But I think that is also useful for things like Analog discovery or RTL-SDR and Logic16, that you don't have to worried about USB2 bus dropping the packages

#

But again, I'm not 100% sure that will help so that is why I asked

glacial wigeon
#

it sounds like it would help, but i dont know enough about the usb3 protocol to be sure

#

in the usb2/usb1 case, the big difference is where the host has to send half a transaction as usb2 speeds

#

then go off and do other usb2 things, on other devices

#

and once the thing finishes, send a usb2 packet to the hub again, to ask for success/failure

#

hence, it being called a "split transaction"

sick apex
#

i need to make a global pointer to an object, if i construct it inline then it core panics, if i construct it in the source file it core dumps, if i construct it inside the member that calls for its creation it goes out of scope

#

any ideas, im really lost

glacial wigeon
fossil dawn
#

construct pointer globally as nullptr and then somewhere (maybe in the member that calls for its creation) change it to the actual location ๐Ÿค”

sick apex
glacial wigeon
#

what about source?

sick apex
#

like do you need the menu aswell

glacial wigeon
#

where you think its segfaulting

sick apex
#

i know it's happening here

#
#include "SSID_Scanner.h"
#include "Wifi.h"
#include "../../../OLED/OLED.h"
#include "../../../Menu/Menu.h"


Menu SSID_List_Cache("SSID List", true);

// Menu* SSID_List = new Menu("SSID List", true);
namespace Wifi::SSID_Scanner {
    // Define the pointer to Menu and initialize it with a new Menu object
    void Run() {
      SSID_List_Cache = Menu("SSID List", true);
      CurrentMenu = & SSID_List_Cache;
      display.clearDisplay();
    }
}```
#

that's the CPP file

#
#pragma once
#include "../../Application.h"

namespace Wifi::SSID_Scanner {
    constexpr auto Type{EApplicationTypes::Wifi};
    void Run();
}```
#

header file

#

the line that breaks it is

#
Menu SSID_List_Cache("SSID List", true);

// Menu* SSID_List = new Menu("SSID List", true);```
#

either of these

#

i cant create an empty menu object because it tells me off

glacial wigeon
#

what is the constructor for Menu()?

sick apex
glacial wigeon
#

can you paste its source?

sick apex
#

the const char* is the display name

#

yes

#
class Menu {
  public:
      Menu(const char* HeaderText, bool displayMenuHeader = true, Menu* ParentMenu = nullptr) : Header(new MenuHeader(HeaderText, displayMenuHeader)), ParentMenu(ParentMenu) {};
      MenuHeader* Header; // Header For the Current Menu
      LinkedList Items;   // Linked List of All the Menu's Items

      static uint8_t ItemsToDisplay; // How Many Items Should be Displayed
      static uint8_t SelectedID;     // The Selected Item ID
      static uint8_t ItemsOffset;    // Display Offset for the Menu Being Drawn to the Screen
      Menu* ParentMenu;

      void AddItem(MenuItem Item); // Add an Item to the Menu
      void NavUp();                // Navigate Up the Menu
      void NavDown();              // Navigate Down the Menu
      void Display();              // Show put the Menu on the screen
      void RunSelected();          // Run the selected Item
      void Back();                 // Go to the Previous Menu Item if One Exists
};```
#

that's the header

#
Menu* CurrentMenu; 

uint8_t Menu::ItemsToDisplay = 4;
uint8_t Menu::SelectedID = 0;
uint8_t Menu::ItemsOffset = 0;

void Menu::AddItem(MenuItem Item) {
  this->Items.append(Item); // Add Items to the Menu
}

void Menu::NavUp() {
  if(this->Items.size() < 1) return;
  if(this == nullptr) return;
  if (Menu::SelectedID == 0) {
    Menu::SelectedID = this->Items.size() - 1; // Wrap around to the last index
  } else {
    Menu::SelectedID -= 1;
  }
  
  // Check if the selected item is above the display range
  if (SelectedID < ItemsOffset) {
  // Wrap the offset back to the last items when it reaches the beginning
    ItemsOffset = SelectedID;
  } else if (SelectedID >= ItemsOffset + ItemsToDisplay) {
    // Move up the Menu
    ItemsOffset = SelectedID - (ItemsToDisplay - 1); 
  }

  Menu::Display();
}

void Menu::NavDown() {
  if(this == nullptr) return;
  if(this->Items.size() < 1) return;
  if (Menu::SelectedID >= this->Items.size() - 1) {
    Menu::SelectedID = 0;
  } else {
    Menu::SelectedID += 1;
  }
  // Check if the selected item is below the display range
  if (SelectedID >= ItemsOffset + ItemsToDisplay) {
    // Scroll the menu down by one item
    ItemsOffset = SelectedID - ItemsToDisplay + 1;
  } else { 
    // Overflow Gack to item 0
    ItemsOffset = 0;
  }
  Menu::Display();
}

void Menu::Display() {
  this->Header->Draw();
  uint8_t offsetSize = this->Items.size() - this->ItemsOffset;
  uint8_t itemsToShow = min(this->ItemsToDisplay, offsetSize);

  display.fillRect(0, HEADER_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT-HEADER_HEIGHT, 0);
  // Loop through the menu items that should be shown.
  for(uint8_t i = 0; i < itemsToShow; i++) {
    uint8_t itemID = (ItemsOffset + i) % this->Items.size();
    MenuItem* item = this->Items.findMenuItemByID(itemID);
    item->Draw(i);

  }
}

void Menu::RunSelected() {
  if(this->Items.DoesItemExistByID(this->SelectedID) == true) {
    this->Items.findMenuItemByID(this->SelectedID)->Run();
  }
}

void Menu::Back() {
  if(this->ParentMenu != nullptr) {
    Menu::SelectedID = 0;
    Menu::ItemsOffset = 0;
    this->ParentMenu->Display();
    CurrentMenu = this->ParentMenu;
  }
}
#

that's the source

glacial wigeon
#

so, it populates the Header field only

sick apex
#

by design

glacial wigeon
#
puts("before");
Menu* SSID_List = new Menu("SSID List", true);
puts("after");
sick apex
#

the menu works

glacial wigeon
#

and this only prints before?

sick apex
#

yes

#

the menu works fine

#

normally

#

except in this instance

#

like if i remove it

#

i can navigate through the menu

#

go forwards

#

back

#

nav up and down

#

open applications

#

its just in this instance

#

which i find weird

glacial wigeon
#

Menu(const char* HeaderText, bool displayMenuHeader = true, Menu* ParentMenu = nullptr) {};
if you dont initialize the Header, does it print the after?

sick apex
glacial wigeon
#

and what is the source, for just the MenuHeader() function?

sick apex
#

its literally just printing to the screen

glacial wigeon
#

that makes no sense

#

the constructor shouldnt print

sick apex
#

it doesn't

#

because it's fine

#

unless i run it from there

#
class MenuHeader {
  public:
    MenuHeader(const char* Header, bool display = true) : Header(Header) {
      if(display == true) {
        this->Draw();
      }
    };
    const char* Header; // Text to Display at the Top of the Screen.  
    void Draw(); // Draw the Header to the ScreLinkeden
};
#
void MenuHeader::Draw() {
  if(this == nullptr) return;
  display.fillRect(0, 0, SCREEN_WIDTH, HEADER_HEIGHT, 1);
  display.setTextColor(0);
  display.setTextSize(1);
  display.setTextWrap(false);
  uint8_t textOffset = (SCREEN_WIDTH - (strlen(this->Header) * TEXT_WIDTH)) / 2;
  display.setCursor(textOffset, 4);
  display.print(this->Header);
  display.display();
}
glacial wigeon
#
    MenuHeader(const char* Header, bool display = true) {
      puts("before");
      this->Header = Header;
      puts("after");
      if(display == true) {
        this->Draw();
      }
    };
#

what if you change it to this?

sick apex
#

hang on

#

i had an idea

glacial wigeon
sick apex
#

i dont have debugging tools

#

i wish i did

#

it would be easy to figure it out

glacial wigeon
#

same, the debugger for my VPU is behind NDA

#

what are you on?

sick apex
#

i really need a jtag debugger

#

im on an esp32 using platformio

#

it has debugging tools

glacial wigeon
#

arm?

#

how do you know its segfaulting?

sick apex
#

oops

raw jasper
#

It posts backtraces to the serial console when something bad happens to it

glacial wigeon
#

the bot muted him for correcting a typo too quickly

raw jasper
#

I guess it's some hook the bootloader puts

glacial wigeon
#

so we had to move to PM

raw jasper
#

Yeah, the bot kinda does that

glacial wigeon
#

the exception handler printed all the registers, and a large chunk of the stack
the return-addr was inside Adafruit_GFX::fillRect(short, short, short, short, unsigned short)

raw jasper
#

I'm guessing some casting was going on in the call?

glacial wigeon
#

4200163a: 8441 srai s0,s0,0x10
is where it faulted
and S0/FP : 0x00010000

#

that feels like a null framebuffer, plus an offset to a button on-screen

#

but i dont know risc-v, so i'm not sure what srai is doing

raw jasper
#

Google says shift right arithmetic

#

I don't know risc-v asm either. I've made it a point to get a RISC-V devboard and learn

sick apex
#

omg im unmuted

glacial wigeon
#

wb!

rapid geode
#

boing

rapid geode
#

ha

#

i got my 3d prints in the mail. need to make some alterations and reorder a couple. but its coming along. im going to do 20 of that set of 4. see how fast they sell. will it be 2 days, 2 months, 2 years? ๐Ÿ˜›

#

the jlc sls nylon prints are super nice. module 0.5 gear turned out clean. as did my work gear threads. nice uniform black colour.

tardy badger
#

Seems cool

rapid geode
#

i hope someone things its cool ha. i see other people selling keys for $40-$100 each. but its so hard to know what epople will like and buy

#

and how many.

tardy badger
#

If I had the $$ I would

#

Ask me at the end of November after Iโ€™ve been working 20+ hours of OT a week trying to keep my programs afloat lol

rapid geode
#

im not fully set on price yet on this. need to fully finish them and add up any extra costs

#

ha

#

๐Ÿ™‚

#

i mada a nice desk top for photographing these things.

keen sparrow
#

Does anyone here live in an apartment like me? Cause when buying from the adafruit site, it won't let me enter my address with an apartment number

tardy badger
#

Thatโ€™s usually how you have to put it

dusty citrus
tardy badger
tranquil swallow
#

MIT researchers have flown to Seoul so we'll know soon enough

dusty citrus
#

in hope that it doesn't get paywalled if it's legit

tardy badger
burnt tendon
patent hemlock
#

๐Ÿคฃ

sick apex
#

is there a faster way to draw on an OLED screen

#

its so slow

#

im using Adafruit_SSD1306 if anyone knows how

sick apex
#

nevermind

#

figured it out

glad ruin
#

There is actually someone who has documented some hidden capabilities in the SSD1306...
https://community.arduboy.com/t/hardware-accelerated-3d-on-the-ssd1306/11116

burnt tendon
#

Huh, so there's a bunch of fascinating stuff that never really stuck in the 3D world because everybody just built hardware to do z-buffered triangles but if you are rendering triangles as strips, there's a bunch of algorithms to do things like hidden surface removal without a z-buffer.

late fulcrum
#

Everybody but SGI, who decided to do Z-buffered Gouraud shaded trapezoids for reasons of their own

fresh niche
#

Hallo ppl quick question, any updates on lk99? The last time i checked a 3rd paper was released

dusty citrus
tranquil swallow
#

If legit why would someone respect the patent

dusty citrus
#

Remember svarosky

fresh niche
dusty citrus
#

Anyhow, anyone knows any free netscanners, that do list ports, mac adress, ip, device and other related informations
There's a lot of donkey work, that seem to not be automated in some way or another (at least by download random software on the net)

late fulcrum
#

The old "Security Administrator Tool for Analyzing Networks" might do what you want

dusty citrus
#

I'll take a look thanks
If that's the case, the boss will be happy to use the satan software being highly catholic

late fulcrum
#

If I recall correctly, it comes with a "repent" command that renames all the scripts "SANTA"

raw jasper
#

The name certainly has some old tool charm :P

brittle condor
#

does anyone have any experience separating a stepper motor from a dvd drive from it's metal frame?

#

they are using some pretty strong glue and i can't get it off

glad ruin
#

That might be welded or riveted.

brittle condor
#

I sacrificed one for science and it seems like you are right :L i was hoping it was just glued...

#

hmmmm, i guess i could try to open it more carefully and then 3d print a case for it within the design....

#

or i could just cut off the braket, but that wouldn't look very nice i'd guess...

glad ruin
#

I think you mean sacrificed for science

tranquil swallow
#

What are you going to do with your room temperature superconductors once they become commercially available

brittle condor
brittle condor
fossil dawn
#

Adafruit Skunk Works is already working on a way to use superconductors to improve CircuitPython controlled RGB LEDs

glad ruin
#

It will finally allow you to power a pi 4 without it browning out due to the voltage drop.

sick apex
#

anyone know how i could go about generating something inside of a function then keeping it in scope after the function has finished

#

but like many things

sick apex
#

but now i need to be able to programmatically generate menu items

#

for SSID names

#

but most of it works with pointers so it needs to stay in scope

#

i don't know how many SSIDs will show up and i only have 320k of memory so i cant just make a list of 128 places

#

linked lists and vectors work with pointers will will turn null after the scope ends

glad ruin
#

Usually graphical interface code is object-oriented. Meaning there will be a menu object, and somewhere in that object will be a container holding references to each item. As long as you free those items when you are done with them it should be fine.

sick apex
#

there is and that uses a linked list

#

which uses pointers

glad ruin
#

Pointers can refer objects on the stack. You only need to free things if they are dynamically allocated.

sick apex
#

well when i call the back function i'll make it delete the objects

#

im a bit lost

#

how do i put it on the stack

#

it just needs to stay there and not leave until i say so

glad ruin
#

... then you'll probably want to dynamically allocate that.

sick apex
#

how

#

im confused this is new to me

glad ruin
#

What language?

sick apex
#

C++

#

arduino

glad ruin
#

In C++ dynamic memory allocation is done with the new operator. Then you can free objects using delete.

sick apex
#

right so if i do new

#

then it wont go out of scope

tranquil swallow
#

You should read the stroustrup c++ intro book

glad ruin
sick apex
# glad ruin The scope depends on where you keep your pointer(s) to it.
#include "strings.h"
#include "SSID_Scanner.h"
#include "Wifi.h"
#include "SPI.h"
#include "../../../OLED/OLED.h"

Menu SSID_List_Cache("SSID List1", false);

// Menu* SSID_List = new Menu("SSID List", true);
namespace Wifi::SSID_Scanner {
  Vector<MenuItem> SSIDs;
  void BackMenu() {
    CurrentMenu->Back();
  }
  void Run() {
    Menu::SelectedID = 0;
    Menu::ItemsOffset = 0;
    display.clearDisplay();
    SSID_List_Cache.ParentMenu = CurrentMenu;
    Application::DisplayPrompt("Scanning...");
    delay(1);
    SSID_List_Cache.Header->Draw();
    int8_t SSIDCount = WiFi.scanNetworks(); 
    SSID_List_Cache.Display();
    delay(10);
    
    if(SSIDCount <= 0) {
      CurrentMenu = &SSID_List_Cache;
      return;
    } else {
      display.clearDisplay();
      CurrentMenu = &SSID_List_Cache;
      for(uint8_t i = 0; i < SSIDCount; i++) {
        const char* SSIDName = WiFi.SSID(i).c_str();
      }

    }
  }
}```
#

this is what i got so far

#

ignore the 1 i wasn't sure if my code was being compiled correctly

glad ruin
#

Kinda hard to read from my phone, but I think what you want to do here is inherit the Menu class. You can then store your SSID cache there and delete anything you allocated for it in the destructor. That should ensure your SSID cache is kept in the same scope as the menu, and goes out of scope along with it.

sick apex
#

it's kinda unorthodox

#

the way its all structured

#

depending on if its a menu or an app

#

it will run a void pointer

#

to a function

#

that i specify on item init

#

or when i make the item

glad ruin
#

Another approach would be to create a wrapper class that manages the menu and SSID cache. That could be stack-allocated and clean up the menu and cache (both heap-allocated) when it goes out of scope.

glad ruin
#

In C++ you almost always want to avoid void*.

sick apex
#

i know i was going to use virtual functions but i forgot about them and i'd already made it work

glad ruin
#

Keep in mind though that void* thing is not the same as void (*thing)(). The former is a "blank check" that could be pointing to any location in memory. The latter is a pointer to a function that accepts no arguments and returns nothing.

sick apex
#

i know

#

im using void (*thing)();

glad ruin
#

Yeah, so unless you have something in global scope you've backed yourself into a bit of a corner.

sick apex
#

is there a way i can make a global cache list

#

that doesn't take pointers

glad ruin
#

You don't want a global cache list.

sick apex
#

i mean of just the currently displayed menu items

#

then i can delete them when a new menu is entered

#

that means everything would then be in scope always unless something is running

glad ruin
#

The issue is that without explicitly deleting it your cache will persist in memory even if the menu is long gone.

#

That's why I'm suggesting either inheriting the menu or creating a wrapper class for it.

sick apex
#

im so lost

#

if i made a class for it

#

then it would still go out of scope

#

because the pointers would be out of scope

#

wouldn't they?

glad ruin
reef lantern
#

where do I go to find help with my ESP32 feather boarda that I can not upload code to? must be something wrong with them since I can upload code to all boards I have except for the once from adafruit

glad ruin
fossil dawn
#

The massive fireball is due to the air in front of the projectile being compressed and ionized
sounds like "air = explosive" to me ๐Ÿ˜

glad ruin
#

Just combustible, not explosive.

sick apex
fossil dawn
#

Changelog:
-removed ๐Ÿงจ
+added โ›ฝ

#

just more impressive power ๐Ÿ˜†

glad ruin
rapid geode
#

it has begun

#

eep

raw jasper
olive dome
#

I mean that is where currently most superconductors goes

#

But yeah I think I know the reference?

raw jasper
olive dome
#

Ahhh yes Sorry I thought you mean a maker in JP that builds such a thing

raw jasper
#

Nah haha. Though it does look like a surname

#

deepl thinks it means "quicksilver" ๐Ÿ˜‚

olive dome
#

Ihttps://twitter.com/yashiro_ld/status/1650694809752068097?s=20

raw jasper
#

Google translate gets it right

raw jasper
olive dome
#

Yeah I can read it in hiragana but not ateji...

raw jasper
#

It's fairly obscure, but the mac OS IME insists on using it, and I'm too lazy to teach it

#

Apparently, there's also ้‰

#

which is read the same, but my IME does not have it

olive dome
#

Oh no he just use strong magnets

#

Like MRI machine you can use strong magnets it just that the signal is weak

raw jasper
#

ah, I only read the tweet you linked me to. Besides, there's probably something weird in the way twitter now displays an user's messages, because as far as I (non-logged in visitor) am concerned, they only tweeted in April, March, and 2021

raw jasper
olive dome
#

Digital Image Processing?

raw jasper
#

No, inner workings of microscopes and stuff

olive dome
#

Ah I see, processing MRI images is one of the topics for Digital Image Processing that I've taken back in uni

raw jasper
#

probably a lot of convolution was involved

olive dome
#

that's our matlab coding homework, but it is pretty straightforward.
Later on the course just turns in to machine learning basically

raw jasper
#

What kind of ML?

#

(Matlab ๐Ÿคข :( )

olive dome
#

Image processing ML so compression, AI resolution stuff

raw jasper
#

Those are cool, but I doubt medical MRI will be using these ;)

olive dome
#

Yeah so the reason why MRI is at the beginning is mostly because the convolution and 2D FFT, which is the basics for digital image processing algorithm.
But recent research on this field is just flood with machine learning stuff, so the end it is mostly that

raw jasper
#

Well, as long as it can pass medical device certification....

olive dome
#

You don't really need those (Compression and AI resolution) for MRI anyways

raw jasper
#

It's not like "AI resolution" is going to give you any relevant details...

#

If anything, it's gonna hallucinate something that'll give you a misdiagnosis

rapid geode
#

and people said there was no point building a machine this fast or precise ๐Ÿ˜›

#

zoom