Question regarding PIC32 SPI bus on the Cyton board

edited June 2021 in Build-it-yourself

Looking at the Cyton schematic, it seems as if the PIC32 uses SPI to communicate with the ADS1299, accelerometer, SD card, and Daisy bus. But on the PIC32's datasheet, it tells me that there are only two SPI modules available, so how is the PIC32 able to use SPI to communicate with all 4 of the aforementioned components? Have I misunderstood something, or is the schematic incorrect, and if so, which communication protocols are used? Thanks.

Comments

  • wjcroftwjcroft Mount Shasta, CA
    edited June 2021

    Hi MM,

    Each device on the board has it's own dedicated chip select line (CS). The one SPI bus can be time-shared amongst all the devices.

    Regards, William

  • Sorry, I'm not familiar with the concept of time-sharing, could you go into a bit more detail about how it works? If I understand correctly, the time-sharing feature allows all the devices to use the SPI bus despite there being only 2 modules? Does this mean only two devices can communicate with the PIC32 at the same time? Does the PIC32 quickly switch between which devices it communicates with?

  • wjcroftwjcroft Mount Shasta, CA

    Only one SPI bus is used. The PIC32 is master. It only turns on the CS line for the device that it is talking to at the moment. After finished with that device, it turns off the CS line for that device. This is a common way of multiplexing the SPI bus in microcontrollers.

    If you look through the source code you can see how this is done.

    https://github.com/OpenBCI/OpenBCI_Cyton_Library

    Or also these pages,

    https://www.google.com/search?q=spi+bus+arduino+example

    Regards, William

  • I understand now, thanks a lot for the help.

Sign In or Register to comment.