wiki:GSoC/2019/PRU_support

Version 4 (modified by Nils Hölscher, on May 15, 2019 at 4:45:54 PM) (diff)

Altered Hardware section

Add PRU-ICSS loader/driver to RTEMS

Student: Nils Hölscher

Mentors: Amaan Cheval, Kuan-Hsun Chen, Chris Johns, Sarvesh Patkar

Ticket: https://devel.rtems.org/ticket/3730

Development Blog: TBA

Introduction

This Project intends to add the PRU support to RTEMS, using the Beaglebone Black (BBB). The BBB has an Texas Instruments AM3358 SoC [3][4] with two Programmable Real-Time Unit(PRU) running @200MHz. The PRU is able to connect to the SoC s i/o within one cycle. This will enable the RTEMS community to develop heavily i/o dependent tasks on the Texas Instruments SoC s with PRUs. For more Information about PRU see [5].

Hardware

PRU i/o pins and modes

PRU #R30(output) bitPinmux ModeR31(input) bitPinmux ModeBB HeaderBB Pin NameConflictZCZ Ball NameOffset RegDT Offset-
00Mode_50Mode_6P9_31SPI1_SCLKMcASPmcasp0_aclkx990h0x190-
01Mode_51Mode_6P9_29SPI1_D0McASPmcasp0_fsx994h0x194-
02Mode_52Mode_6P9_30SPI1_D1McASPmcasp0_axr0998h0x198-
03Mode_53Mode_6P9_28SPI1_CS0McASPmcasp0_ahclkr99Ch0x19C-
04Mode_54Mode_6P9_42(*note1)McASPmcasp0_aclkr9A0h0x1A0-
05Mode_55Mode_6P9_27GPIO3_19McASPmcasp0_fsr9A4h0x1A4-
06Mode_56Mode_6P9_41(*note2) mcasp0_axr19A8h0x1A8-
07Mode_57Mode_6P9_25GPIO3_21McASPmcasp0_ahclkx9ACh0x1AC-
014Mode_6N/A P8_12GPIO1_12 gpmc_ad12830h0x030-
015Mode_6N/A P8_11GPIO1_13 gpmc_ad13834h0x034-
0N/A 14Mode_6P8_16GPIO1_14 gpmc_ad14838h0x038-
0N/A 15Mode_6P8_15GPIO1_15 gpmc_ad1583Ch0x03C-
0N/A 16Mode_6P9_24UART1_TXD uart1_txd984h0x184-
10Mode_50Mode_6P8_45GPIO2_6HDMIlcd_data08A0h0x0A0-
11Mode_51Mode_6P8_46GPIO2_7HDMIlcd_data18A4h0x0A4-
12Mode_52Mode_6P8_43GPIO2_8HDMIlcd_data28A8h0x0A8-
13Mode_53Mode_6P8_44GPIO2_9HDMIlcd_data38ACh0x0AC-
14Mode_54Mode_6P8_41GPIO2_10HDMIlcd_data48B0h0x0B0-
15Mode_55Mode_6P8_42GPIO2_11HDMIlcd_data58B4h0x0B4-
16Mode_56Mode_6P8_39GPIO2_12HDMIlcd_data68B8h0x0B8-
17Mode_57Mode_6P8_40GPIO2_13HDMIlcd_data78BCh0x0BC-
18Mode_58Mode_6P8_27GPIO2_22HDMIlcd_vsync8E0h0x0E0-
19Mode_59Mode_6P8_29GPIO2_23HDMIlcd_hsync8E4h0x0E4-
110Mode_510Mode_6P8_28GPIO2_24HDMIlcd_pclk8E8h0x0E8-
111Mode_511Mode_6P8_30GPIO2_25HDMIlcd_ac_bias_en8ECh0x0EC-
112Mode_512Mode_6P8_21GPIO1_30emmc2gpmc_csn1880h0x080-
113Mode_513Mode_6P8_20GPIO1_31emmc2gpmc_csn2884h0x084-
1N/A 16Mode_6P9_26UART1_RXD uart1_rxd980h0x180-

*Note1: The PRU0 Registers{30,31} Bit 4 (GPIO3_18) is routed to P9_42-GPIO0_7 pin. You MUST set GPIO0_7 to input mode in pinmuxing.

*Note2: The PRU0 Registers{30,31} Bit 6 (GPIO3_20) is routed to P9_41-GPIO0_20(CLKOUT2). You must set GPIO0_20 to input mode in pinmuxing.

The table is taken from [5].

The high i/o speed of the PRU is realised by using the registers R30 and R31 s bits to access the SoC s pins as seen in the table. The PRU1 unit is blocked by HDMI, so this unit can only be utilised when HDMI is not needed.

Project

Starting Point

Since the Beagle Board community already uses the PRU, I will start by trying out their drivers.[1][2] After reproducing these results with the Linux, the drivers have to be ported to RTEMS to reproduce these Results on RTEMS.

Proof of Concept

Since the PRU is designed to be more predictable than your normal CPU, it is able to access I/O peripherals in a deterministic manner. This behaviour will be used to demonstrate that code is running on the PRU and not the CPU. The PRU is able to output a square wave with constant small wavelength on the BBB s Pins. The SOC s CPU is not capable of this, due to pre-emptive behaviour of most OS s.

References

[1] Drivers - https://github.com/beagleboard/am335x_pru_package

[2] PRU guide for BBB - http://www.righto.com/2016/08/pru-tips-understanding-beaglebones.html

[3] AM3358 TI Documentation - https://www.ti.com/lit/ds/symlink/am3358.pdf

[4] AM335x TI Technical Reference Manual - https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf

[5] eLinux Pru Documentation - https://elinux.org/Ti_AM33XX_PRUSSv2