Sujet : Re: uP port mapping
De : tnp (at) *nospam* invalid.invalid (The Natural Philosopher)
Groupes : sci.electronics.design comp.sys.raspberry-piDate : 13. Sep 2024, 09:30:22
Autres entêtes
Organisation : A little, after lunch
Message-ID : <vc0t6u$oup6$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 12/09/2024 20:35, john larkin wrote:
RP2040 has I think 2 PIO blocks and each has a couple of hardware
programmable state machines, and those can be set up to drive pins.
I'm mostly concerned now with a PCB schematic design, picking the
appropriate and easy-to-route pins from the CPU to things.
It would be unusual for the pins in numerical order not to be part of the same PIO block
So you might as well design the PCB that way.
My general question, for various processors, is how to associate bits
in integer variables with physical pins on the chip.
Well that is a software issue.
I thought that on the Pi PICO there was software to do a bulk set of pins
Yes.
https://www.raspberrypi.com/documentation/pico-sdk/hardware.html#functions70There is a set pins by mask - mask is up to 32 bits - and clear pins by mask.
So presumably if you invert the mask (XOR with FFFF) and clear with that and set with the original mask and add a strobe pulse as well to latch the data, its three calls in C....or have I misunderstood..not sure if you can set AND clear simultaneously.
Now irrespective of whether the hardware supports more, that's as good as you are going to get with the C SDK, and presumably only assembler is faster. And presumably the actual gpio functions are written in assembler anyway. So that (c gpio) will be as good as it gets.
What that leads to in respect of your original question is to treat the gpio numbers as if they represented the bits in order.
https://forums.raspberrypi.com/viewtopic.php?t=326719That conversation implies that they are.
So gpio 0-12 should e.g. go to the DAC lsb->msb set of bots.
These are all arranged in order down one side of the board, so it should be easy
Good luck!
-- No Apple devices were knowingly used in the preparation of this post.