BeagleBoard/GSoC/2020 Projects/Cape Compatibility

From eLinux.org
< BeagleBoard‎ | GSoC‎ | 2020 Projects
Revision as of 12:22, 23 March 2020 by Lorforlinux (talk | contribs) (Timeline)
Jump to: navigation, search


Proposal for Cape compatibility layer for BeagleBone Black and BeagleBone AI

Student: Deepak Khatri
Mentors: Jason Kridner
Code: https://github.com/deepaklorkhatri007/linux/tree/4.14
Wiki: https://elinux.org/BeagleBoard/GSoC/2020Proposal/DeepakKhatri
GSoC: [N/A]

Status

This project is currently just a proposal.

Proposal

Completed all the requirements listed on the ideas page. the code for the cross-compilation task can be found here submitted through the pull request #130.

About you

IRC: lorforlinux
Github: Deepak Khatri
School: Netaji Subhas Univerity of Technology (NSUT) formely NSIT
Country: India
Primary language(s): Hindi,English
Typical work hours: 9AM - 7PM IST
Previous GSoC participation: I participated in GSoC2019 but i was not selected for the project. The project was to make a jekyll website for AIMA organization, Discussion on the project can be found here and the prototype i made can be found here. From the GSoC2019 I learnt the importance of communication.

About your project

Project name: Cape compatibility layer for BeagleBone Black and BeagleBone AI

Description

Making P8 and P9 header compatible

The idea of this project is to make the same userspace examples work with both BeagleBone Black and AI, using the same references to drivers for peripherals assigned to the same pins between Black and AI. Main things to do for achieving that are assigning similar muxing of pins, same pin names and same aliases for both the boards. Changes will be done in the file am5729-beagleboneai.dts of BeagleBoard-DeviceTrees repo.

  1. For making the boards pin to pin compatible as in pin names, a new node will be created cape-universal {...} which will hold child nodes like P8_03{...} for pin name assignment.
  2. Setting up the same default pin configuration in pin muxing nodes of board device tree files is required which will be achieved using nodes that uses DRA7XX_CORE_IOPAD() functions along with pinctrl-single driver. I have included the required code through pull requests #8 #9 #10. We are also required to assign pinctrl-names by creating nodes like P9_26_pinmux{...} AM335x uses bone-pinmux-helper for doing that.
  3. we also require to assign same aliases which is the easiest part after achieving the above goals. We need some assignments under aliases {...} node similar to what we have in BeagleBone Black device tree file.

After testing we may require to create new device tree sources include (dtsi) files. The file am335x-bone-common-univ.dtsi for BeagleBone Black and am335x-pocketbeagle.dts provides all the information for pinmuxing and pin naming. The porject will enable us to use serial ports and userspace I2Cdev/spidev, aliases provided by the device trees would match. For GPIOs, examples would work using pin names under libgpiod.

Cape compatibility

Pin muxing, pin naming and aliasing of P8 and P9 headers of BeagleBone AI will enable us to use different peripherals like I2C, SPI, UART, CAN, ADC, PWM/TIMER etc on the exact pin required by the cape. BeagleBone cape interface spec shows all the details on that. We have many peripherals available to use on AM5729 SoC but with different MUX_MODExx than AM3358. First let's see an example for /dev/bone/i2c/1 specs for which are :


AM3358 I2C1
AM5729 I2C5

    P9.17 - SCL
    P9.18 - SDA

Let's see this code from my pull requests #8 #9 #10 in BeagleBoard-DeviceTrees repo. It is for the I2C peripiral on AM5729 based BeagleBone AI. The pin P9.17 has 2 GPIO pins of SoC attached to it and the code configures the pin to use the 2nd GPIO in MUX_MODE10 that enables the I2C on that pin. You see all that information and more insde the System Reference Manual for BeagleBone AI, info on P9.17 can be cound here.


P9_17_i2c_pin: pinmux_P9_17_i2c_pin { pinctrl-single,pins = <
		DRA7XX_CORE_IOPAD(0x36B8, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE10) >; };

Looking on the code for AM3358 for the same P9.17 pin on BeagleBone Black which can be found here. We see that it is using the MUX_MODE2 and only one GPIO pin of SoC is attached to this header pin.


P9_17_i2c_pin: pinmux_P9_17_i2c_pin { pinctrl-single,pins = <
		AM33XX_IOPAD(0x095c, PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE2) >; };	/* spi0_cs0.i2c1_scl */

For making the capes entirely compatible. I will have to include the code for pin-muxing names, pin naming and aliases. I am working on some of that at the moment. Also, the code requires testing on the real hardware and that part will be done only during the GSoC coding period.

Software required and Programmign Languages

The project requires the use of the device tree compiler (dtc) for compiling the device tree source (ex. *.dts, *.dtsi) files. The c programming language will be used for kernel-level programming and gcc compiler along with other build tools will be used for compiling the C source code (*.c).

Timeline

Apr 27 Pre-work Community Bonding Period and discussion on the project and resources available.
May 18 Pre-work complete Coding officially begins!
May 25 Milestone #1
  • Introductory YouTube video.
  • Setting up BeagleBone Black and Ai boards i.e flashing up to date Linux image and Testing user-led blink code :)
  • Running cape examples and userspace examples on BeagleBone Black. This will allow me to get more info on the process of setting up the software and hardware of the cape for future reference.
June 1 Milestone #2
  • Testing the code I pushed for BeagelBone AI which is on P8 and P9 header pins muxing.
  • Finalizing the initial code for pin muxing, assigning correct aliases and pin names of AM5729.
June 8 Milestone #3
  • Adding multiple-gpio muxing code for available peripheral on each header pins of BeagleBone AI. All the pin functionality for BeagleBone AI in System Reference Manual will be matched.
  • Finalizing the compatibility of the header pins of the BeagleBone AI with the BeagleBone Black.
  • Detailed discussion with the mentor on the work done till now.
June 15 - 19 18:00 UTC Milestone #4
(Phase 1 Evaluation)
  • Demonstrating the pin control using names and pin muxing through examples.
  • Finalizing everything done till now and submitting the first report for evaluation.
June 22 Milestone #5
  • Taking notes and feedback from my mentor on the quality of code.
  • Testing the pin control using libgpiod.
  • Running already available examples that demonstrate the proper working of pin control using libgpiod.
June 29 Milestone #6
  • Testing userspace examples with BeagleBone AI.
  • Writing required examples for the work in progress.
  • Making the required fixes for running the userspace examples on BeageleBone AI.
July 6 Milestone #7
  • Continuing to test userspace examples provided for Black on Ai.
  • Finalizing the device tree code and driver code.
  • Initial setup for using capes with BeagleBone AI.
  • Detailed discussion on the work done till now.
July 13 -17 18:00 UTC Milestone #8
(Phase 2 Evaluation)
  • Testing the Robotics Cape on BeagleBone AI using newly created device tree and already available cape examples.
  • Fixing the code and making required changes for cape compatibility.
  • Documenting everything and submitting the report for evaluation.
July 20 Milestone #9
  • Testing following capes :
  1. Servo Cape
  2. Motor Cape
  3. Load Cape
  • Code cleaning and proper commenting if not done already.
  • Taking notes and feedback from my mentor on the quality of code.
July 27 Milestone #10
  • Testing the Relay Cape.
  • Documenting everything done during the summer.
  • Taking feedback from my mentor.
August 3 Milestone #11
  • Completion YouTube video
August 10 - 17 18:00 UTC Final week Students submit their final work product and their final mentor evaluation
August 17 - 24 18:00 UTC End of competition Mentors submit final student evaluations

Experience and approach

I have a good understanding of C, C++, and python. I have done an internship on Embedded Electronics using BeagleBoneBlack. I completed this project called "Mausam national" during my internship. Mausam national is an air quality cum multiple gases ppm level acquisition system. The interesting part of the project is that it can connect to the internet and fetch the air quality data from my university's pollution center that they provide for everyone to use. we used that data for the calibration of the MQ sensors on-board.

I was one of the quarter-finalists in IICDC2017 and during that period I worked with ARM cortex M4 based MSP432. I participated in Electronics Maker contest '17 there I presented a low-cost biopotential amplifier based on TL074 and won Ti's C2000 DSP for the project. I have worked on both hardware and software-based projects, hardware projects can be found on my youtube channel here and software projects can be found on my GitHub here.

Contingency

I believe that if I get stuck on my project and my mentor isn’t around, I will use the resources that are available to me. Some of those information portals are listed below.

  1. Derek Molly's beagle bone guide provides all the information needed for getting up and running with my beagle.
  2. Content on e-ALE.org is very useful for information that ranges from tutorials and walkthroughs to the level of very advanced stuff.
  3. BeagleBone cookbook from Mark A. Yoder & Jason Kridner is the best source for test projects during the prototyping period.
  4. The technical reference manuals provided by TI on am3358 and am5729 are the best source for getting the insights on the SoC used in Black and Ai.

Benefit

If successfully completed, what will its impact be on the BeagleBoard.org community? Include quotes from BeagleBoard.org community members who can be found on http://beagleboard.org/discuss and http://bbb.io/gsocchat.

Suggestions

Is there anything else we should have asked you?