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.

MSPM0G3507: MSPM0G3507 SPI slave mode combine input output in one frame

Part Number: MSPM0G3507

Hello,

Is any possible to make MSPM0G 3/4-wire SPI slave mode work for below input:SPI.png

  1. A frame is always 16bit. clock speed lower than 500khz.
  2. normal case, it receives entire frame 16bit from master, 8bit instrustion plus 8bit input data 
  3. some case, it receives first half frame with 8bit instruction, immediately, preloaded 8bit output data should be presented on the output pin according to clock in rising edge, feed to master.

Is any possible to implement? seems 3-wire PICO not able to do? acceptable case is PICO connect to POCI to build output? in the period of first half frame for instruction 8bit, the output pin must be high-z.

  • In that case, you might need to connect PICO to POCI, and configure the POCI pin in slaves based on the former 8 bit data. This is the easiest way I can think of.

  • Alright, thanks. if you can, would you please detail how to do with code example - 

    frame size, fifo level, high-z, transmit trigger, loopback avoid etc all in PICO config, POCI config, IRQs handler......

  • You can change pin function based on PF in IOMUX register, from not connected to SPI function

  • Hello,

    Can anybody help for an additional question, in peripheral mode PICO interruptions reigisters, for motorola mode, is there chip selection CS 'completion' (or say cs_deassert) interruption IIDX can be used to know a physical frame ended? 

    Regards 

  • Hi EK,

    Sorry for the late reply. I just back to office.

    CS cannot trigger the interrupt.

    What I can think of to realize this is that:

    • You can set SPI frame to 8bit
    • Enable Receive interrupt
    • Every time 8bit data is received, then check this command is write or read
      • If write, then change PICO to Hi-Z
      • If read, then remain PICO as the SPI function

    I am not sure why you need CS interrupt function. And if you must to have this, the workaround can be use another input IO to reconnect to the CS pin in hardware. And enable the interrupt of this input IO to monitor here.

    Regards,

    Zoey

  • Hi Zoey,

    Yeah ok, the workaround is fine as well. thanks.

  • Hello Zoey,

    Since the Hi-Z setting ** DL_GPIO_enableHiZ(GPIO_SPI_IOMUX_PICO) ** doesn't work for me, can you please give hands for exact code sentence.

    it should be like IOMUX->SECCFG.PINCM[GPIO_SPI_IOMUX_PICO] = sentence,

    but not clear how to use :
    IOMUX_PINCM_PF_MASK
    IOMUX_PINCM_PF_OFS
    IOMUX_PINCM_PC_OFS
    IOMUX_PINCM_PC_MASK
    IOMUX_PINCM_PC_UNCONNECTED
    IOMUX_PINCM_PC_CONNECTED

    assume there is already:
    #define GPIO_SPI_PICO_PORT GPIOB
    #define GPIO_SPI_PICO_PIN DL_GPIO_PIN_8
    #define GPIO_SPI_IOMUX_PICO (IOMUX_PINCM25)
    #define GPIO_SPI_IOMUX_PICO_FUNC IOMUX_PINCM25_PF_SPI1_PICO.

    Thanks in advance.

  • Hi EK,

    I suggest not enable the Hi-Z mode but change the pin function.

    Please use the code:

        DL_GPIO_initPeripheralOutputFunction(
            IOMUX_PINCM25, IOMUX_PINCM25_PF_UNCONNECTED);
    After execute this code line, the GPIO will not connected to any module, making Hi-Z by default.
    Regards,
    Zoey