Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: MK20DX256 CS Pin

  1. #1
    Junior Member
    Join Date
    Oct 2020
    Posts
    13

    MK20DX256 CS Pin

    Hello I am making my own teensy board, and was wondering if any digital pin can be used as a chip select pin on the MK20DX256VLH7 (Teensy 3.2)

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,571
    Quote Originally Posted by Constation View Post
    Hello I am making my own teensy board, and was wondering if any digital pin can be used as a chip select pin on the MK20DX256VLH7 (Teensy 3.2)
    It really depends...

    Chip Select for what? To be used as???

    If you are using SPI as the master device, the majority of libraries simply use any digital IO pin, and drive them using something like digitalWrite... (Some more use registers and the like but same difference).

    Now there are some Teensy specific libraries, like the ILI9341_t3, library that require the CS and DC pin both be hardware CS pins:

    For the SPI object the pins are pins: 10, 2, 9, 6, 20, 23, 21, 22, 15
    But there is an additional complication that you can not use all of these together at the same time, that is some of these pins are logically the same to SPI as some of the others:
    That is they map to a mask: and the mask bits for the above are: 0x1, 0x1, 0x2, 0x2, 0x4, 0x4, 0x8, 0x8, 0x10

    So (10, 2)PCS0 are to SPI the same as is PCS1(9,6), PCS2(20, 23), PCS3 (21, 22), and PCS4(15) is unique...


    Now if instead you are wanting to use this board with it hooked up as the SPI Slave device, than you can I believe only use PCS0 for this which again is either pin 10 or pin 2...


    Hope that helps

  3. #3
    Junior Member
    Join Date
    Oct 2020
    Posts
    13
    Yes it's for 2 spi devices a spi flash and spi sd card

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •