**** BEGIN LOGGING AT Tue Jul 16 03:02:17 2019 Jul 16 03:02:21 what's PRU? Jul 16 03:03:23 programmable real-time unit. they're a special kind of RISC core used for hard real-time stuff in the AM3358 SoC used on the beaglebone. It has two of such cores (running at 200 MHz) together with some fast SRAM and local peripherals (including a UART) in a subsystem Jul 16 03:03:47 they can basically produce any kind of signal with cycle-accurate (i.e. 5ns resolution) timing Jul 16 03:04:22 so the idea is to connect that to the BeagleBone and send the data from there? Jul 16 03:04:30 it's part of the beaglebone Jul 16 03:04:33 oh! Jul 16 03:04:36 it's one of the best features of it Jul 16 03:04:39 wow! Jul 16 03:05:01 and I thought the best feature was the lack of required nonfree blobs for it to boot! Jul 16 03:05:46 nah, that's not that interesting Jul 16 03:06:08 it's better than a Raspberry Pi Jul 16 03:06:35 so how do I get code to run on it? Jul 16 03:07:40 there are two kernel drivers you can choose between: uio-pruss and remoteproc-pru. uio-pruss has a kinda crappy C library and my py-uio python library you can use to interact with it, remoteproc-pru is controlled via sysfs attributes Jul 16 03:09:06 huh, I guess if I'm handling the most time-sensitive stuff separately, I don't need to worry too much about performance on the main CPU Jul 16 03:09:31 there are also two options for writing code: the pasm assembler (which is a fairly fancy assembler with support for macros and data structures) and the clpru C/C++ compiler (which produces pretty crappy code and basically demolishes your real-time guarantees) Jul 16 03:09:38 yes that's the whole idea Jul 16 03:10:13 yeah, I guess it is Jul 16 03:10:19 the old libprussdrv (C library for uio-pruss) can only load raw binaries as produced by pasm, remoteproc-pru can only load ELF executables produced by clpru, my py-uio library can load both Jul 16 03:10:23 ooh, so I still get to learn assembly for this project! Jul 16 03:10:59 PRU assembly is quite simple and clean. PRU was made to be programmed in assembly, the C compiler was an afterthought Jul 16 03:11:04 fun Jul 16 03:11:23 so the kernel drivers let me communicate with it? Jul 16 03:11:42 uio-pruss lets you mmap() the whole pruss subsystem as well as receive interrupts from it via a file descriptor Jul 16 03:12:25 I am so happy that I randomly came across the BeagleBoard website a while ago and so happened to have one to use for this project Jul 16 03:12:54 py-uio lets you easily start and stop the cores, read/write their instruction memory and registers (provided the core is halted), and map shared memory data structures Jul 16 03:13:11 not things I would've thought Python would be good at Jul 16 03:13:52 and the PRU uses the same RAM as the main CPU? Jul 16 03:14:16 it has a small amount of fast local SRAM which it can access with deterministic latency Jul 16 03:14:40 how slow is access to the main RAM? Jul 16 03:15:09 it can also access main (DDR3) memory, and both kernel drivers can reserve some memory there for PRU's use. however keep in mind that reading from main ram has comparatively high and non-deterministic latency Jul 16 03:16:23 writing to main ram is fire-and-forget hence doesn't ruin performance unless as long as you don't manage to fill up any queue on its way there Jul 16 03:16:26 how much local RAM does it have? Jul 16 03:18:17 each core has 8KB of instruction ram (2048 instructions) and 8KB of data RAM, and there's an additional 12 KB of shared data ram. cores can also access each other's data ram (although they get lower priority in case both cores try to access the memory at the same time) Jul 16 03:18:50 it's not a huge amount, but plenty for most applications Jul 16 03:19:01 so that's probably enough to store the state of every DMX address Jul 16 03:19:09 sure, that's only 512 bytes Jul 16 03:19:56 you can do a lot with 8+8+12=28KB of ram total Jul 16 03:20:44 a typical application which does need external ram is BeagleLogic, which uses PRU to turn the beaglebone into a 100Msps logic analyzer Jul 16 03:21:03 (which is quite impressive, since it means it samples the inputs every other cpu cycle) Jul 16 03:21:35 wow Jul 16 03:21:36 you can find my py-uio library here btw: https://github.com/mvduin/py-uio Jul 16 03:23:31 what exactly does it do? Jul 16 03:23:47 it lets me interact with the PRU while it's halted from the main CPU? Jul 16 03:26:53 it has some generic support stuff for UIO in general, as well as data structures that model a fair amount of the PRUSS (I'm still missing some of the peripherals), has methods for controlling the PRU cores (start, stop, single-stepping, using the cycle- and stall-counters, etc), loading code onto a core (when halted), reading/writing a core's registers (when halted), configuring interrupt routing, ... Jul 16 03:26:55 (sorry if I'm asking the same questions again) Jul 16 03:26:59 ...sending events to the cores, receiving interrupts from the subsystem (e.g. from the cores, depending on routing setup) Jul 16 03:27:15 I'd suggest just looking at the examples listed in the readme Jul 16 03:28:09 (there are a few more examples in the pru-examples directory not mentioned in the README, but those are a bit more obscure) Jul 16 03:28:39 I will! Jul 16 03:29:27 pru-examples/basic-test.py + pru-examples/fw/test.pasm shows some basic usage Jul 16 03:30:09 while the intc-test uses both cores, shared-memory data structures (both in python and in the pru assembly), and interrupts from pru to python Jul 16 03:31:06 I don't imagine needing two cores for what I'm doing Jul 16 03:31:12 indeed Jul 16 03:32:33 while you're here, is there a name for the kind of connector the board uses for power? Jul 16 03:32:52 I don't seem to have one, but being able to power the board seems useful Jul 16 03:33:45 note that you can also power the board via the mini-usb plug or via the P9 expansion header (P9.01+02 = ground, P9.05+06 = 5V to beaglebone) Jul 16 03:33:52 or should I just go into an electronics store and ask for "one of those round power connector things that's this big"? Jul 16 03:34:07 it's a very common connector for it yeah Jul 16 03:34:18 not sure what the official name for it is Jul 16 03:34:49 usually just called "barrel jack" or something like that Jul 16 03:35:00 oh, okay, I should be able to find it, then Jul 16 03:36:10 with 5.5mm outer diameter, 2.1mm center pin (center = positive) Jul 16 03:36:40 one of the first google hits for "5v barrel" was https://www.sparkfun.com/products/12889 Jul 16 03:37:06 ah, https://www.sparkfun.com/products/15312 is its replacement apparently Jul 16 03:37:52 so I'm pretty sure 5.5mm outer 2.1mm inner 5V center-positive is a pretty standard configuration Jul 16 03:38:18 oh, and it's the right size, fantastic Jul 16 03:39:18 how can I find documentation about the PRU? Jul 16 03:41:17 nevermind, I think I found TI's manual Jul 16 03:42:01 various places... for some reason the relevant chapter in the AM335x Technical Reference Manual was pretty comprehensive at some point, then disappeared from it, then reappeared as a separate "unsupported" chapter here: https://github.com/beagleboard/am335x_pru_package (the am335xPruReferenceGuide.pdf, some other docs in the Documentation dir, then reappeared as a chapter in the TRM but not with all ... Jul 16 03:42:07 ...of the info it had in previous incarnations Jul 16 03:43:12 and although the TI processors wiki has been made read-only and deprecated (it was even offline for a bit until too many peopl complained), it's still a very useful resource, e.g. for this instruction reference: http://processors.wiki.ti.com/index.php/PRU_Assembly_Instructions Jul 16 03:44:34 I see the assembler isn't free software Jul 16 03:45:18 pasm is open source, clpru is closed-source but freely available (and I think freely distributable but I'd need to double-check that) Jul 16 03:45:42 I don't see a free license attached to pasm? Jul 16 03:46:12 the TI wiki says "PASM is no longer supported. Please use CLPRU instead" Jul 16 03:46:16 yada yada Jul 16 03:47:06 https://github.com/beagleboard/am335x_pru_package/blob/master/pru_sw/utils/LICENCE.txt <--- pasm license Jul 16 03:47:44 ah, missed the "with or without modification" part the first time Jul 16 03:48:08 looks like some flavor of standard BSD license? Jul 16 03:49:11 someone also worked on a pru port of gnu binutils and gcc, but I don't know the status Jul 16 03:49:17 oh, yes, that's it Jul 16 03:49:22 I basically just use pasm Jul 16 03:49:59 I might also at some point include code generation support in py-uio itself Jul 16 03:50:51 hmm, looks like this might not be the best-supported and best-documented architecture to learn assembly with for the first time Jul 16 03:51:14 the instruction set is quite adequately documented Jul 16 03:51:20 and more importantly, it's very simple Jul 16 03:51:58 all right, I'll go for it Jul 16 13:43:26 m **** ENDING LOGGING AT Wed Jul 17 02:59:57 2019