* Re: [9fans] Pi updates [not found] <1247329197.3731220.1451419922659.JavaMail.yahoo.ref@mail.yahoo.com> @ 2015-12-29 20:12 ` Brian L. Stuart 0 siblings, 0 replies; 14+ messages in thread From: Brian L. Stuart @ 2015-12-29 20:12 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs > but http://raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md > has an erratum suggesting "power of 2" should be "multiple of 2". I have > been using a default divisor of 250 for a 1MHz clock, and that's the frequency > I see on my oscilloscope. Excellent. I had suspected that statement was too restrictive, but hadn't seen the errata or gotten around to checking on a scope. I'll update that today. Thanks, BLS ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <594280736.4698467.1451711534944.JavaMail.yahoo.ref@mail.yahoo.com>]
* Re: [9fans] Pi updates [not found] <594280736.4698467.1451711534944.JavaMail.yahoo.ref@mail.yahoo.com> @ 2016-01-02 5:12 ` Brian L. Stuart 2016-01-02 18:06 ` erik quanstrom 0 siblings, 1 reply; 14+ messages in thread From: Brian L. Stuart @ 2016-01-02 5:12 UTC (permalink / raw) To: blstuart, 9fans, erik quanstrom On Fri, 1/1/16, erik quanstrom <quanstro@quanstro.net> wrote: > i'm looking @ the gpio interface, and i wonder what the recommended > technique for sampling a pin might be from a shell script? I haven't really used it in shell scripts, but if I were going to do so, I'd probably write up a little utility to take a hex string and a bit number and do the 'and' on it. Then feed that with the result of dd to get exactly one sample from devgpio. On the other hand, if one of the usual suspects (e.g. hoc, bc, dc, awk) have some bit-wise operators I'm forgetting, use that. BLS ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [9fans] Pi updates 2016-01-02 5:12 ` Brian L. Stuart @ 2016-01-02 18:06 ` erik quanstrom 2016-01-02 19:58 ` Bakul Shah 0 siblings, 1 reply; 14+ messages in thread From: erik quanstrom @ 2016-01-02 18:06 UTC (permalink / raw) To: blstuart, 9fans, quanstro On Fri Jan 1 21:15:03 PST 2016, blstuart@bellsouth.net wrote: > On Fri, 1/1/16, erik quanstrom <quanstro@quanstro.net> wrote: > > i'm looking @ the gpio interface, and i wonder what the recommended > > technique for sampling a pin might be from a shell script? > > I haven't really used it in shell scripts, but if I were going to do > so, I'd probably write up a little utility to take a hex string and > a bit number and do the 'and' on it. Then feed that with the > result of dd to get exactly one sample from devgpio. On the > other hand, if one of the usual suspects (e.g. hoc, bc, dc, awk) > have some bit-wise operators I'm forgetting, use that. the (atom) aux/number program does do that; none of the others do for fairly fundamental reasons: as awk and hoc are really floating point, and bc and dc are mp, and the mp library has no bit operations. i believe acid can as well, but only with great pain. perhaps just using base 2 for the encoding would make life a lot easer. so 00000000000000000000000000010000000000000000000000000000000000000 for bit 27 active. with this format there's no limit to the number of bits one could represent. also, mightn't there be some value in presenting the full state of the device to allow it to be restored directly from the status file, so perhaps 3 lines could be added, one each for up/down/float settings? 00000000000000000000000000010000000000000000000000000000000000000 00000000000000000000000000010000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000 might represent bit 27 set, with the pull up resistor active. (perhaps float ≡ (pullup | pulldown) == 0? and could be elimitated. i'm sure a little tinkering with this idea can make it a lot more useful. - erik ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [9fans] Pi updates 2016-01-02 18:06 ` erik quanstrom @ 2016-01-02 19:58 ` Bakul Shah 0 siblings, 0 replies; 14+ messages in thread From: Bakul Shah @ 2016-01-02 19:58 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs FWIW, when I was looking at doing a gpio drive I was thinking of something like the following. Devices: #G/gpio/ctl #G/gpio/$pin/ctl #G/gpio/$pin/data #G/gpio/$pin/event ... bing -a '#G' /dev A pin must be configured before use (and only if neither of its data & event file is open). For example: echo 'in rising edge high' > /dev/gpio/10/ctl Syntax reset # reset to default in [async][rising|falling][edge] [high|low] [init $value] [buf $value] out [pullup|pulldown] [init $value] [strength $value] alt [0..5] # pi specific You can use the same syntax to configure multiple pins by writing to /dev/gpio/ctl and appending pin numbers. echo 'out pullup 4 12 17' > /dev/gpio/ctl You can *gang* multiple pins into a single port. For example: echo 'create 100 1 2 5 10' > /dev/gpio/ctl This creates a new "pin" 100 (number must be >= # of physical pins) and creates a new entry in /dev/gpio. This succeeds only if the pins can actually be ganged (this is device dependent). You can now configure the port: echo 'in rising edge low' > /dev/gpio/100/ctl To delete a port echo 'delete 100' > /dev/gpio/ctl All constituent pins revert to their default state. Reading /dev/gpio/N/data returns a sample of the present value. [The following needs more work] Reading /dev/pio/N/event blocks the caller until something changes. Returns value and timestamp (in case of "async" inputs, events are handled in the interrupt handler and buffered). Random notes: An "in" pin has an init value since some pins can be bidirectional. "alt" may create other devices as a side-effect such as SPI, I2C, I2S, PWM, UART etc. Configs are sticky and persist across device opens, which is why there is a "reset" command. While this may be easy to use, its implementation would be somewhat complex.... Ideally one would break this into a small core kernel mode driver and a fancier user mode one for configuring. I stopped at this point for various reasons and never got back to it. On Sat, 02 Jan 2016 10:06:31 PST erik quanstrom <quanstro@quanstro.net> wrote: > On Fri Jan 1 21:15:03 PST 2016, blstuart@bellsouth.net wrote: > > On Fri, 1/1/16, erik quanstrom <quanstro@quanstro.net> wrote: > > > i'm looking @ the gpio interface, and i wonder what the recommended > > > technique for sampling a pin might be from a shell script? > > > > I haven't really used it in shell scripts, but if I were going to do > > so, I'd probably write up a little utility to take a hex string and > > a bit number and do the 'and' on it. Then feed that with the > > result of dd to get exactly one sample from devgpio. On the > > other hand, if one of the usual suspects (e.g. hoc, bc, dc, awk) > > have some bit-wise operators I'm forgetting, use that. > > the (atom) aux/number program does do that; none of the others do > for fairly fundamental reasons: as awk and hoc are really floating > point, and bc and dc are mp, and the mp library has no bit operations. > i believe acid can as well, but only with great pain. > > perhaps just using base 2 for the encoding would make life a lot easer. so > > 00000000000000000000000000010000000000000000000000000000000000000 > > for bit 27 active. with this format there's no limit to the number of bits > one could represent. > > also, mightn't there be some value in presenting the full state of the device > to allow it to be restored directly from the status file, so perhaps 3 lines > could be added, one each for up/down/float settings? > > 00000000000000000000000000010000000000000000000000000000000000000 > 00000000000000000000000000010000000000000000000000000000000000000 > 00000000000000000000000000000000000000000000000000000000000000000 > 00000000000000000000000000000000000000000000000000000000000000000 > > might represent bit 27 set, with the pull up resistor active. (perhaps > float =E2=89=A1 (pullup | pulldown) =3D=3D 0? and could be elimitated. > > i'm sure a little tinkering with this idea can make it a lot more useful. > > - erik ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <1780889748.4171096.1451514147540.JavaMail.yahoo.ref@mail.yahoo.com>]
* Re: [9fans] Pi updates [not found] <1780889748.4171096.1451514147540.JavaMail.yahoo.ref@mail.yahoo.com> @ 2015-12-30 22:22 ` Brian L. Stuart 2015-12-31 16:25 ` Joseph Stewart 2016-01-02 3:26 ` erik quanstrom 0 siblings, 2 replies; 14+ messages in thread From: Brian L. Stuart @ 2015-12-30 22:22 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Wed, 12/30/15, Skip Tavakkolian <9nut@9netics.com> wrote: > > - Enhancements for I2C and SPI > > is there an updated devrtc3231.c, or a conventional user space > fs, that uses the new i2c? Yes, there's a devi2c userland interface ported over from Inferno. That's what's being used to drive the robot in the video clip. BLS ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [9fans] Pi updates 2015-12-30 22:22 ` Brian L. Stuart @ 2015-12-31 16:25 ` Joseph Stewart 2016-01-02 3:26 ` erik quanstrom 1 sibling, 0 replies; 14+ messages in thread From: Joseph Stewart @ 2015-12-31 16:25 UTC (permalink / raw) To: Brian L. Stuart, Fans of the OS Plan 9 from Bell Labs [-- Attachment #1: Type: text/plain, Size: 503 bytes --] Thanks for posting your slides and other work Brian. On Wed, Dec 30, 2015 at 5:22 PM, Brian L. Stuart <blstuart@bellsouth.net> wrote: > On Wed, 12/30/15, Skip Tavakkolian <9nut@9netics.com> wrote: > > > - Enhancements for I2C and SPI > > > > is there an updated devrtc3231.c, or a conventional user space > > fs, that uses the new i2c? > > Yes, there's a devi2c userland interface ported over from Inferno. > That's what's being used to drive the robot in the video clip. > > BLS > > [-- Attachment #2: Type: text/html, Size: 993 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [9fans] Pi updates 2015-12-30 22:22 ` Brian L. Stuart 2015-12-31 16:25 ` Joseph Stewart @ 2016-01-02 3:26 ` erik quanstrom 1 sibling, 0 replies; 14+ messages in thread From: erik quanstrom @ 2016-01-02 3:26 UTC (permalink / raw) To: blstuart, 9fans On Wed Dec 30 14:27:27 PST 2015, blstuart@bellsouth.net wrote: > On Wed, 12/30/15, Skip Tavakkolian <9nut@9netics.com> wrote: > > > - Enhancements for I2C and SPI > > > > is there an updated devrtc3231.c, or a conventional user space > > fs, that uses the new i2c? > > Yes, there's a devi2c userland interface ported over from Inferno. > That's what's being used to drive the robot in the video clip. i'm looking @ the gpio interface, and i wonder what the recommended technique for sampling a pin might be from a shell script? - erik ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <170083162.3836274.1451437972190.JavaMail.yahoo.ref@mail.yahoo.com>]
* Re: [9fans] Pi updates [not found] <170083162.3836274.1451437972190.JavaMail.yahoo.ref@mail.yahoo.com> @ 2015-12-30 1:12 ` Brian L. Stuart 0 siblings, 0 replies; 14+ messages in thread From: Brian L. Stuart @ 2015-12-30 1:12 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Mon, 12/28/15, Anthony Sorace <a@9srv.net> wrote: > And yes, I’d be interested in seeing your > slides, although you’ve already given me > enough to keep my busy for a bit. Anthony, I've put the slides up in the directory at: http://cs.drexel.edu/~bls96/plan9/ The class met one night a week and we have 10 week quarters. So there are only 9 sets of slides. There's not a lot of textual meat in them. I tend to have a lot of figures I talk over with some outline-level textual material. BLS ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <546388050.3796592.1451425715223.JavaMail.yahoo.ref@mail.yahoo.com>]
* Re: [9fans] Pi updates [not found] <546388050.3796592.1451425715223.JavaMail.yahoo.ref@mail.yahoo.com> @ 2015-12-29 21:48 ` Brian L. Stuart 0 siblings, 0 replies; 14+ messages in thread From: Brian L. Stuart @ 2015-12-29 21:48 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs, Brian L. Stuart > Excellent. I had suspected that statement was too restrictive, but hadn't > seen the errata or gotten around to checking on a scope. I'll update that > today. New versions posted. spiclock() now rounds the divisor up to the smallest even number that results is a clock rate less than or equal to that requested. Let me know if you run into anything else that needs attention. BLS ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <1211924935.3518360.1451362224733.JavaMail.yahoo.ref@mail.yahoo.com>]
* [9fans] Pi updates [not found] <1211924935.3518360.1451362224733.JavaMail.yahoo.ref@mail.yahoo.com> @ 2015-12-29 4:10 ` Brian L. Stuart 2015-12-29 4:52 ` Anthony Sorace ` (3 more replies) 0 siblings, 4 replies; 14+ messages in thread From: Brian L. Stuart @ 2015-12-29 4:10 UTC (permalink / raw) To: 9fans A few months ago I brought up the question of small platforms suitable for a course on small/embedded computing. If you recall the conversation, with input from the collective wisdom, I decided to use the Pi. At that time several people asked if I could share any results from the course that I'm able to. I've finally finished putting some of it together in a form that's useful. In /n/sources/contrib/blstuart/pi/ ... http://cs.drexel.edu/~bls96/plan9/pi/ ... are a collection of changes with all the changes collected into a tarball: /n/sources/contrib/blstuart/pi.tgz http://cs.drexel.edu/~bls96/plan9/pi.tgz The changes include: - Richard's post 9pi.img changes on contrib - I2C and SPI contributions from Steve Simon with the I2C support ported from Inferno - Enhancements for I2C and SPI - Devgpio driver - Man pages for I2C, SPI, and GPIO - Support for a 320x480 SPI TFT display - Enhancements to the USB keyboard support to handle the Rii k12 keyboard/trackpad combination I've also posted a little video (apologies in advance for the quality, or lack thereof) of a Pi with the TFT screen and k12 keyboard controlling a PiBog vehicle my wife gave me for Christmas: http://cs.drexel.edu/~bls96/plan9/robot9.mp4 I'll look into making the slides I used in the lecture available if there's interest. There are some rough edges, but hopefully it might be useful to some. BLS ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [9fans] Pi updates 2015-12-29 4:10 ` Brian L. Stuart @ 2015-12-29 4:52 ` Anthony Sorace 2015-12-29 6:29 ` Skip Tavakkolian ` (2 subsequent siblings) 3 siblings, 0 replies; 14+ messages in thread From: Anthony Sorace @ 2015-12-29 4:52 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs Wow, that’s amazing timing. I was reading about SPI on the Pi, considering getting one of those TFT displays, closed the window to head to bed, and there’s your message. This is super useful, thanks. And yes, I’d be interested in seeing your slides, although you’ve already given me enough to keep my busy for a bit. Anthony ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [9fans] Pi updates 2015-12-29 4:10 ` Brian L. Stuart 2015-12-29 4:52 ` Anthony Sorace @ 2015-12-29 6:29 ` Skip Tavakkolian 2015-12-29 10:55 ` Richard Miller 2015-12-30 21:55 ` Skip Tavakkolian 3 siblings, 0 replies; 14+ messages in thread From: Skip Tavakkolian @ 2015-12-29 6:29 UTC (permalink / raw) To: blstuart, 9fans Cool! Thank you. -Skip > A few months ago I brought up the question of small > platforms suitable for a course on small/embedded > computing. If you recall the conversation, with input > from the collective wisdom, I decided to use the Pi. > At that time several people asked if I could share > any results from the course that I'm able to. I've > finally finished putting some of it together in a form > that's useful. In > > /n/sources/contrib/blstuart/pi/ ... > http://cs.drexel.edu/~bls96/plan9/pi/ ... > > are a collection of changes with all the changes > collected into a tarball: > > /n/sources/contrib/blstuart/pi.tgz > http://cs.drexel.edu/~bls96/plan9/pi.tgz > > The changes include: > - Richard's post 9pi.img changes on contrib > - I2C and SPI contributions from Steve Simon with the > I2C support ported from Inferno > - Enhancements for I2C and SPI > - Devgpio driver > - Man pages for I2C, SPI, and GPIO > - Support for a 320x480 SPI TFT display > - Enhancements to the USB keyboard support to handle > the Rii k12 keyboard/trackpad combination > > I've also posted a little video (apologies in advance for > the quality, or lack thereof) of a Pi with the TFT screen > and k12 keyboard controlling a PiBog vehicle my wife > gave me for Christmas: > > http://cs.drexel.edu/~bls96/plan9/robot9.mp4 > > I'll look into making the slides I used in the lecture > available if there's interest. > > There are some rough edges, but hopefully it might be > useful to some. > > BLS ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [9fans] Pi updates 2015-12-29 4:10 ` Brian L. Stuart 2015-12-29 4:52 ` Anthony Sorace 2015-12-29 6:29 ` Skip Tavakkolian @ 2015-12-29 10:55 ` Richard Miller 2015-12-30 21:55 ` Skip Tavakkolian 3 siblings, 0 replies; 14+ messages in thread From: Richard Miller @ 2015-12-29 10:55 UTC (permalink / raw) To: 9fans Thanks, Brian - that all looks very useful to make the pi more amenable to hardware tinkering. One small suggested amendment: your spiclock() says this - /* * According the Broadcom docs, the divisor has to * be a power of 2. This code rounds up so that the * resulting clock is the highest value no greater than * what's requested. */ but http://raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md has an erratum suggesting "power of 2" should be "multiple of 2". I have been using a default divisor of 250 for a 1MHz clock, and that's the frequency I see on my oscilloscope. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [9fans] Pi updates 2015-12-29 4:10 ` Brian L. Stuart ` (2 preceding siblings ...) 2015-12-29 10:55 ` Richard Miller @ 2015-12-30 21:55 ` Skip Tavakkolian 3 siblings, 0 replies; 14+ messages in thread From: Skip Tavakkolian @ 2015-12-30 21:55 UTC (permalink / raw) To: 9fans > - Enhancements for I2C and SPI is there an updated devrtc3231.c, or a conventional user space fs, that uses the new i2c? ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-01-02 19:58 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1247329197.3731220.1451419922659.JavaMail.yahoo.ref@mail.yahoo.com> 2015-12-29 20:12 ` [9fans] Pi updates Brian L. Stuart [not found] <594280736.4698467.1451711534944.JavaMail.yahoo.ref@mail.yahoo.com> 2016-01-02 5:12 ` Brian L. Stuart 2016-01-02 18:06 ` erik quanstrom 2016-01-02 19:58 ` Bakul Shah [not found] <1780889748.4171096.1451514147540.JavaMail.yahoo.ref@mail.yahoo.com> 2015-12-30 22:22 ` Brian L. Stuart 2015-12-31 16:25 ` Joseph Stewart 2016-01-02 3:26 ` erik quanstrom [not found] <170083162.3836274.1451437972190.JavaMail.yahoo.ref@mail.yahoo.com> 2015-12-30 1:12 ` Brian L. Stuart [not found] <546388050.3796592.1451425715223.JavaMail.yahoo.ref@mail.yahoo.com> 2015-12-29 21:48 ` Brian L. Stuart [not found] <1211924935.3518360.1451362224733.JavaMail.yahoo.ref@mail.yahoo.com> 2015-12-29 4:10 ` Brian L. Stuart 2015-12-29 4:52 ` Anthony Sorace 2015-12-29 6:29 ` Skip Tavakkolian 2015-12-29 10:55 ` Richard Miller 2015-12-30 21:55 ` Skip Tavakkolian
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).