PSLab: Circuitpython busio compatibility layer for pslab-python

PSLab: Circuitpython busio compatibility layer for pslab-python

About Me

I am NAVEEN S R, a third year student pursuing B.E. in Computer Science and Engineering, from
INDIA. This is my first project with GSoC.

About My Project

The PSLab project has many instruments and supports some external sensors, but there are many sensors which are supported by pslab board yet to be implemented.
My project is to add busio compatibility layer for pslab-python to make use of large repository of sensor drivers maintained by Adafruit.

My Time Zone

Indian Standard Time (UTC +5:30)

Getting in Touch

[Community Bonding Period] Week 1:

Firstly, I would like to thank my mentor Alexander Bessman, @mb1, Madhushanka Padmal for selecting me, Really glad to get this opportunity!

This week (or in the last 3 days), started with @mb1 welcoming us to the community. He congratulated all the selected students. Then Madhushanka Padmal guided us about what we have to do next.

Then I studied about the implementation of I2C in both circutepython’s busio and pslab-frimware. Then I had discussion with Alexander Bessman about the best way to implement this in our project. Learned in depth about I2C protocols.

I will study about other serial communication protocols in upcomming days.

I have also participated in the community’s weekly meeting, where everyone in the community gets a chance to chat and report their accomplishments of the week.

Looking forward to learn and grow with the community.

1 Like

[Community Bonding Period] Week 2:

This week, I learned in depth about SPI and I2C(SMBus, PMBus, etc.,) and how it is implemented in circutepython and pslab-frimware.

I cleared my doubts regarding pslab skematics and frimware with help of my mentors and reported some bugs in firmware. I also made a UML class diagram for my future implementation of pslab.bus.I2C and pslab.bus.SPI.

I will study about UART serial communication protocols in upcomming days.

I have also participated in the community’s weekly meeting, where I came to know about other cool projects our fossasia-pslab team working in.

2 Likes

[Coding Phase] Week 4:

  • made PR on Refactor I2C
  • made PR on Add busio.I2C

I will on SPI in upcomming days.

1 Like

[Coding Phase] Week 5-6:

  • Made some improvement in Add busio.I2C, and PR merged :tada:.

  • Got solution for issue on “updating SPI parameters” with help of mentors.

Issue:

The PGA (MCP6S21) PSLab board using only supports SPI Modes 0,0 and 1,1 and SCK Frequency max10MHz. So setting SPI parameters other than PGA supports (like SPI Mode 0,1 or 1,0) will block setting gain value in PGA.
Ref : http://ww1.microchip.com/downloads/en/devicedoc/21117b.pdf

Solution:

re-implementing Oscilloscope._set_gain to check previous config before sending gain value. If config not supported by PGA it will re-init SPI with supported config and re-config back after send gain value.

  • Made outline for pslab.bus.spi.
1 Like

[Coding Phase] Week 7:

  • Opened PR on Refactor SPI
  • Contributed to the initiative of making external sensors available for CLI and Front End.
    By which this project will be more useable for users :sparkles:.
1 Like

[Coding Phase] Week 8:

  • Improvement at set_gain in PGA, to reset SPI configuration if the config is not supported by PGA while setting gain value. on Refactor SPI PR
  • Opened Issue on Additional bus functions, to improve firmware functionality for these new API changes.
1 Like

[Coding Phase] Week 9-10:

  • Wrote tests for pslab.bus.spi.
  • Studied on PWM Generator datasheet for how to make a PWM wave with the same frequency as SPI and 50% phase shifted from SPI?

:-1: droped, Since it requires huge modifications in firmware.

  • Made an alternative logical approach to test SMP bit in SPI config.

Upcoming week I will work on busio part of SPI.

1 Like

[Coding Phase] Week 11:

  • Added busio.SPI part of circuitpython’s busio compatibility layer for pslab-python.
  • Gone through esp and stm ports circutepython to find how each handles setting supported prescalar values for user desired frequency, and updated the functionality accordingly in pslab.bus.spi.SPI.

Upcoming week I will work on UART.

[Coding Phase] Week 12

  • Made some improvement in Refactor SPI & Add busio.SPI, and PR merged :tada:.

  • Had detailed conversations with the community about the UART and cleared all my doubts regarding it.

  • Made an outline for pslab.bus.uart.

[Coding Phase] Week 13

  • Made PR to support stop_bits, bits_per_word and parity in firmware.
  • Working on pslab.bus.uart.

[Coding Phase] Week 14

  • Made PR on Refactor pslab.bus.uart.UART, and merged :rocket:
  • Made PR for pslab.bus.busio.UART.
  • Completed GSoC Final Evaluation and submitted final report link.

Upcoming week I will work on firmware.