This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

i can‘t use chip select of spi expect cs_0

Other Parts Discussed in Thread: HALCOGEN

hi,

    i found i only can use cs_0 and  when   i choose  other chip select ,it is not actived(i have configured  pinmux ) .  if CSNR = 1 ,it means CS_1 will be actived? 

  • Ron,


    When SPI is used as master (Compatibility mide), you can decide which Chip Select will be activated.
    Assuming you are using HalcoGen to generate your SPI driver, this is done as following:

        dataconfig1_t.CSNR    = 0xFE;              // Select CS0    (11111110)
        dataconfig1_t.CSNR    = 0xFD;              // Select CS1    (11111101)
    and so on....

    Usually slave SPI devices are expecting the CS to be active low.
    This is the default configuration for our microcontroller but it can be changed. See the following extract from the TRM.

    When the SPI is used in SPI slave (compatibility mode), it's expecting the CS0 as signal the start a transfer. Other CS cannot be used.

    Please let me know if I've answered your question.

  • Hi Jean-Marc,

    i am using SPI in master mode. i ve connected the externel 23lc1024 SRAM to CS1. hence CSNR = 0XFD.
    in order to initiate the write and read operation should i load CSDEF to make the chip select low and high?
    or is it enough once CSNR is loaded with 0xFD? whether it will take care of the operation?
  • Hi Ron,
    If you want to use CS1, the CSDEF field should be 0xFD (bit one is cleared). If you init the SPI module properly, writing data and control bits to SPT_DAT1 will transmit the data automatically.
    spi->DAT1 = ((uint32)DataFormat << 24U) |
    ((uint32)ChipSelect << 16U) |
    (WDelay) |
    (Chip_Select_Hold) | (uint32)Tx_Data;
    Regards,QJ