home bbs files messages ]

Just a sample of the Echomail archive

Cooperative anarchy at its finest, still active today. Darkrealms is the Zone 1 Hub.

   RBERRYPI      Support for the Raspberry Pi device      21,939 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 20,650 of 21,939   
   Theo to john larkin   
   Re: uP port mapping   
   12 Sep 24 17:43:04   
   
   INTL 3:770/1 3:770/3   
   REPLYADDR theom+news@chiark.greenend.org.uk   
   REPLYTO 3:770/3.0 UUCP   
   MSGID:  788e2538   
   REPLY:  2c176ae1   
   PID: SoupGate-Win32 v1.05   
   XPost: sci.electronics.design   
      
   In comp.sys.raspberry-pi john larkin  wrote:   
   > Something I've wondered about:   
   >   
   > Suppose we have a c program running on some little uP, and it has some   
   > integer variable value, 8 or 12 bits or something, and wants to drive   
   > a parallel DAC off-chip.   
   >   
   > The msb...lsb bits of the variable obviously have to get to the right   
   > pins of the DAC.   
   >   
   > So, in general, how does one pick the physical i/o port pins on the   
   > uP, to get the order right? The PCB layout is easiest if we just wire   
   > the DAC to the handiest port pins.   
      
   A lot of MPUs have 'ports', ie you don't have individual GPIOs, but P0.0 to   
   P0.7, P1.0-P1.7, etc.  You can write to a whole 8 bit port in a single   
   operation.  That way you know to wire up P0.0 to the LSB of your DAC and   
   P0.7 to the MSB, or maybe use P1.0-1.3 for the upper 4 bits.   
      
   Slightly surprisingly I don't see that on the RP2040 datasheet, it looks   
   like you can only set single bits at a time.  It seems you have to use the   
   PIOs to get parallel transfers.  Maybe you can also do something with DMA?   
      
   There's a 'PIO and DMA (a logic analyser)" in 3.2.3 of the C/C++ SDK doc:   
   https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf   
      
   which says:   
      
   "Pin Groups (Mapping)   
   We mentioned earlier that there are four pin groups to configure, to connect a   
   state machine’s internal   
   data buses to the GPIOs it manipulates. A state machine accesses all pins   
   within a group at once, and   
   pin groups can overlap. So far we have seen the out, side-set and in pin   
   groups. The fourth is set.   
   The out group is the pins affected by shifting out data from the OSR, using   
   out pins or out pindirs, up to   
   32 bits at a time. The set group is used with set pins and set pindirs   
   instructions, up to 5 bits at a time,   
   with data that is encoded directly in the instruction. It’s useful for   
   toggling control signals. The side-set   
   group is similar to the set group, but runs simultaneously with another   
   instruction. Note: mov pin uses   
   the in or out group, depending on direction."   
      
   and 3.2.5 in the RP2040 datasheet says:   
      
   "3.2.5. Pin Mapping   
   PIO controls the output level and direction of up to 32 GPIOs, and can observe   
   their input levels. On every system clock   
   cycle, each state machine may do none, one, or both of the following:   
   • Change the level or direction of some GPIOs via an OUT or SET instruction,   
   or read some GPIOs via an IN instruction   
   • Change the level or direction of some GPIOs via a side-set operation   
   Each of these operations is on one of four contiguous ranges of GPIOs, with   
   the base and count of each range   
   configured via each state machine’s PINCTRL register. There is a range for   
   each of OUT, SET, IN and side-set operations.   
   Each range can cover any of the GPIOs accessible to a given PIO block (on   
   RP2040 this is the 30 user GPIOs), and the   
   ranges can overlap.   
   For each individual GPIO output (level and direction separately), PIO   
   considers all 8 writes that may have occurred on   
   that cycle, and applies the write from the highest-numbered state machine. If   
   the same state machine performs a SET   
   /OUT and a side-set on the same GPIO simultaneously, the side-set is used. If   
   no state machine writes to this GPIO   
   output, its value does not change from the previous cycle.   
   Generally each state machine’s outputs are mapped to a distinct group of   
   GPIOs, implementing some peripheral   
   interface."   
      
   so I suppose you want all of your pins consecutively in the same pin group.   
      
   It looks like this example does parallel output:   
   https://github.com/raspberrypi/pico-examples/blob/master/gpio/he   
   lo_7segment/hello_7segment.c   
   via gpio_set_mask() (set to high all the bits in the mask) and gpio_clr_mask()   
   but I wouldn't say for sure that it's atomic.   
      
   Theo   
      
   --- SoupGate-Win32 v1.05   
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)   
   SEEN-BY: 10/0 1 90/1 103/705 105/81 106/201 124/5016 129/305 134/100   
   SEEN-BY: 153/135 148 151 757 7715 218/0 1 601 700 840 870 930 220/70   
   SEEN-BY: 221/1 6 360 226/17 30 100 227/114 229/110 111 114 200 206   
   SEEN-BY: 229/300 317 400 426 428 470 550 616 664 700 240/1120 266/512   
   SEEN-BY: 267/800 282/1038 291/111 292/854 301/1 113 812 310/31 320/219   
   SEEN-BY: 322/757 335/364 341/66 342/200 396/45 460/58 633/280 712/848   
   SEEN-BY: 770/1 3 100 330 340 772/210 220 230 5020/400 1042 5058/104   
   SEEN-BY: 5075/35   
   PATH: 770/3 1 153/757 221/6 301/1 218/700 229/426   
      

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca