User:Hjhee/GSoC2018

=BeagleBone synchronous data collection= IRC Nick: hjhee Student: Jianhang He Mentors: Hunyue Yau, Kumar Abhishek Code: https://github.com/hjhee/GSoC_SynchronousDataCollectionPRU Wiki: http://elinux.org/BeagleBoard/GSoC/SynchronousDataCollectionPRU

=Status= This project is currently just a proposal.

=Proposal=

About me
IRC: hjhee Github: https://github.com/hjhee School: Technische Universität Darmstadt Country: Germany Primary language: Chinese Typical work hours: 17-22 (CET)

About my project
Project name: BeagleBone-based Synchronous Data Collection

Description
As written in the idea list, the goal of this project is to give BeagleLogic the ability to sample Synchronous data.

Synchronous Measurement and Asynchronous Measurement
Basically signals are transmitted in two ways: Synchronous transmission and Asynchronous transmission. The current implementation of BeagleLogic samples the input signals in a Asynchronous way. And that could cause a data loss if the sampling rate is not set correctly (referring to Sampling theorem should the sampling rate at least the double frequency of the signal). When one wants to measure a signal of higher speed (>100 MHz, e.g. DDR, PCI), it is not possible to prevent data loss without using Synchronous sampling. In Synchronous sampling mode BeagleLogic would enable the engineer to view actual the signal received the devices, which is very useful for software debugging.

PRU and EGPIO
PRU is the additional component of AM335x, which is intended for offloading real time tasks from the main processor. The main feature of PRU is, that it performs instructions in determined cycles.

BeagleLogic utilizes the PRUs on the BeagleBone processor AM3358 to perform high speed measurement, one for sampling data (PRU1), the other for pushing data to DDR RAM (PRU0). As written in the AM335x PRU-ICSS Reference Guide, PRU has a special type of GPIO, named Enhanced GPIO, whose GPI can work in three mode: Direct Connection Mode and 16-Bit Parallel Capture Mode as well as 28-Bit Shift Mode. The project will allow user to change the GPIO working mode between Direct Connection Mode (for Asynchronous measurement) and 16-Bit Parallel Capture Mode (for Synchronous measurement).



Implementation
Currently BeagleLogic loads firmware to PRUs via Remote Processor Framework. As already mentioned, BeagleLogic uses Direct Connection Mode to perform internal clock triggered sampling. The project should


 * update the firmware code of this two PRUs (PASM)
 * add new sysfs attributes in the BeagleLogic kernel module for sampling configuration (C)
 * update test app (C)
 * update web backend (Node.js and Go)
 * update web app (HTML and javascript)

Week 1

 * Familiar with BeagleBone board and read datasheet
 * get the knowledge about registers of Cortex-A and PRUs
 * write testing programs for Cortex-A

Week 2

 * Familiar with PRU and read the manual
 * measure cycles of instructions of interes
 * design Synchronous sampling procedure

Week 3-4

 * implement Synchronous sampling in assembly code and C
 * test the program by feeding testing signals

Week 5-6

 * Familiar with Linux kernel module development
 * understand the detail about Remote Processor Framework
 * set up development environment for Linux kernel

Week 7

 * review code and comment
 * write development notes
 * update the code of the example app
 * buffer week

Week 8-10

 * adding new API for web server
 * tcp-server-go
 * tcp-server-node
 * update web interface

Week 11

 * receive feedback
 * review documentation

Week 12

 * buffer week

Experience and approach
Graduated as bachelor in 2016 for Measurement, Control Technique and Instrumentation at Harbin Institute of Technology, China, I decided to continue my master at TU Darmstadt for Electrical and Computer Engineering (Elektrotechnik und Informationstechnik), Germany.

I have fundamental knowledge about measurement and instrumentation, including measurement error, sampling theorem, structure of an electrical instrument and so on.

I have experience with ARM (Cortex-M4, Cortex-M0+) and FPGA (Cyclone IV). I can implement DMA or make use of other peripherals from Cortex-M0+ independently.

I also have experience in ACM-ICPC (Gold, 2015, Asia Regional Shanghai Invitational), in which I've improved my ability to code in C. I've written an crawler in Go. I also have experience with Node.js and am familiar with Angular.

I'm good at reading technical document, debugging software and solving hardware problems. I'm familiar with Linux since 2007, including Ubuntu, Gentoo, Debian.

Contingency
There is enough documents for independent development, including AM3358, PRU-ICSS, rpmsg, Linux kernel module, etc. I think I can find the solution on the Internet. Another possible way is to ask question on IRC, which may get respond slower.

Benefit
BeagleLogic users will have an alternative sampling mode. The community will have one more example about PRU development. The PRU is very powerful and should deserve more attention from the community.

Suggestions
Additionally I think the project should also consider utilizing the EDMA controller for data transmission. Because as another GSoC project (BeagleBone PRU DMA) suggested, this allows PRU0 to perform some logic operation. For example the user can specify some trigger conditions like: "a falling edge on pin B when pin A is high", or "after 5 rising edges on pin C when pin D is high and pin E is low" and so on. These conditions is originally suggested by the author of BeagleLogic. PRU0 can act in this situation as a state machine, and only request an Interrupt to EDMA when the conditions are met.