Turnkey PRU deskclock application for BBB

I’m making available for image download a sample (clock) application with these features:

  • turnkey – after initial EULA agreement step, the application launches on boot
    • there is NO WARRANTY on ANY part of this project
  • uses both PRU and the ARM processor
    • not only one, but two ring buffers enabling fast data transfer (1.2MB/sec)
    • connected by /dev/mem
    • this app in no way needs this fast transfer, but your app might
  • Needs ILI9341 SPI (4wire) connection … PRU0 implements minimal SPI protocol:
    .asg “pru0outP9_31_hi”, RESET_HI
    .asg “pru0outP9_31_low”, RESET_LOW
    .asg “pru0outP9_27_hi”, DC_DATA
    .asg “pru0outP9_27_low”, DC_COMMAND
    .asg “pru0outP9_28_hi”, SS_HI
    .asg “pru0outP9_28_low”, SS_LOW
    .asg “pru0outP9_29_hi”, MOSI_HI
    .asg “pru0outP9_29_low”, MOSI_LOW
    .asg “pru0outP9_25_hi”, CLOCK_HI
    .asg “pru0outP9_25_low”, CLOCK_LOW
  • my wrapper for PRUdebug included and preconfigured
    • no djb configuration pain
    • easy to use with this app
  • video showing clock display during PRU stress test (1.2MB / sec)
  • image file NOT a flasher – run without EMMC modification
  • custom scheduler controls launch
    • ntp sync (clock app) … configured for Ubuntu pool
    • wait for remoteproc file system to be created
    • pin configuration
    • PRU initialization
    • application initialization
    • when using ring buffers, it is important that the processors are started in the correct order
  • application independent abstractions for pin manipulation … see pru.h
    .asg “.t1”, pru0P9_29
    .asg “CLR pruout, :pruout::pru0P9_29:”, pru0outP9_29_low
    .asg “SET pruout, :pruout::pru0P9_29:”, pru0outP9_29_hi
    .asg “CLR pruin, :pruin::pru0P9_29:”, pru0inP9_29_low
    .asg “SET pruin, :pruin::pru0P9_29:”, pru0inP9_29_hi
  • image file distribution has benefits similar to VM’s
    • dogtag – BeagleBoard.org Debian Image 2018-10-07
    • system code already loaded and configured
      • Perl
      • cr.yp.to
      • ncat
  • ILI9341 device orientation is landscape
    • if your display is upside down, the ‘flip_horizontal’ step can be adjusted
    • if device pins are on the left of the display, ‘flip_horizontal’ is a no op
  • video of earlier implementation:
  • Most of work done on PRU(s)
    • barely measurable ARM utilization
    • clock app generates and average of 650 bytes / second
    • PRU stress test utilizes ARM process @ 40% (performance freq 1Ghz)
      • 60MB input file executes in 50 seconds (1.2MB/sec)

use as you wish, in good health
gomer

missing from initial post:
gomer@mercury:~/Downloads$ cksum clock.img.gz
1533175342 1047110484 clock.img.gz
gomer@mercury:~/Downloads$

wow… what an oversight!

user: debian
password: ILI9341

user: root
password: ILI9341

message of the day on debian login has instructions for EULA agreement, basically – sudo touch /root/Iaggree…

good luck
gomer

Hey Gomer,

This project sounds like a great way for a beginner to get some exposure to PRU programming. I am thinking about giving it a look-see. Does your image come with the source code?

Fred

this is as intended, as long as you are not too particular about (not using) remoteproc (eww).

all source code included, including the warts, but not the history.

all parts of the project can be rebuilt from source with matching cksums on executables.

image would PROBABLY need at least a 16GB microSD card if using etcher to create it due to this issue: eMMC to bootable SD

good luck
gomer

Hi Gomer,

Any chance we can get a higher res image of the internals? I am hoping to see how you connected the ILI9341 to the BBB.

Is it just the 4 SPI wires, BBB +3.3V to ILI9341 VCC and BBB Gnd to ILI9341 Gnd?

Thanks,
Fred

image? you mean picture? The pic provided from Amazon review is misleading, don’t use that. It was an earlier implementation.

how could this description from earlier post be clearer? it is from the actual software (gpio_code.asm). Its’ purpose is to provide symbolic substitution specific to the app (MOSI_HI) to the symbolic substitution in pru.h (pru.h is application agnostic).

is it clearer if I instead specify:
P9_25 ---- sclk
P9_29 ----- mosi
P9_28 — SS/CS
P9_27 ---- DC
P9_31 ----- reset

I didn’t think that was necessary, but am happy to provide it…

If that wasn’t clear, it probably also wasn’t clear that enough of the SPI protocol has been coded into PRU0 to drive the ILI9341 device. (not claiming anything close to complete compliance with SPI). This is a roll your own exercise in SPI communication for one specific device (ILI9341). that is why I specify which pins do what.

If I haven’t answered your question, please restate. Can provide pic if that is what you meant.

good luck
gomer

Hi Gomer,

That is much clearer. Thank you very much. Wasn’t necessary but, makes is easier on the new user.

My main concern however, was how you did the power supply to the display. I see the BBB can supply up to 250mA on the 3.3V outputs on the P9 header. Did you plug the ILI9341 right into the header? something like:

P9_01 ---- GND
P9_03 — VCC

The ILI9341 datasheet shows that it draws 100uA in standby but, i don’t see what it draws in full on display mode. Just trying to avoid damaging my new hardware before I get to run your awesome clock!!!

Thanks,
Fred

This is correct. without a breadboard, you’ll probably want to use two 3.3 sources (P9_03 and P9_04), one for VCC and one for led.

you’ll get plenty of warning if display is underpowered, it will dim on and off. Just be sure to use a 5v supply on the barrel jack, don’t try to power it from the usb connection. (or you can try, just to see it fail)…

I hope that you didn’t pay too much ($15) for one of these… it is good value. I can attest that I tortured these devices for years with misconfigurations, and bad practices without any damage.

good luck
gomer