1 Reply Latest reply on Aug 20, 2019 2:31 AM by BragadeeshV_41

    CYBLE ProCBle -> SPI Master Slave switch while runtime

    MaPo_2163411

      Hello,

      i need to implement a SPI Slave which has to switch into Master Mode while runtime.
      I tried the SCB unconfigured mode for that. But it is not working.
      SPI Slave mode only (SPI configured) is working well!

       

      This is my SPI (SCB unconfigured mode) implementation:

       

      slave_init.mode = SPI_SPI_SLAVE;
          slave_init.submode = SPI_SPI_MODE_MOTOROLA;
          slave_init.sclkMode = SPI_SPI_SCLK_CPHA1_CPOL1;
          slave_init.oversample = SPI_SPI_OVS_FACTOR; //ignore for slave mode
          slave_init.enableMedianFilter = 0;
          slave_init.enableLateSampling = 0;
          slave_init.enableWake = 0;
          slave_init.rxDataBits = 8;
          slave_init.txDataBits = 8;
          slave_init.bitOrder = SPI_BITS_ORDER_MSB_FIRST;
          slave_init.transferSeperation = SPI_SPI_TRANSFER_SEPARATED;
          slave_init.rxBufferSize = 32;
          slave_init.rxBuffer = NULL;
          slave_init.txBufferSize = 32;
          slave_init.txBuffer = NULL;    
          slave_init.enableInterrupt = 1;
          slave_init.rxInterruptMask = SPI_INTR_RX_FULL;
          slave_init.rxTriggerLevel = 15;
          slave_init.txInterruptMask = SPI_SPI_INTR_TX_MASK;
          slave_init.txTriggerLevel = 0;
          slave_init.enableByteMode = 1;
          slave_init.enableFreeRunSclk = 0;
          slave_init.polaritySs = SPI_SPI_SS_ACTIVE_LOW;
          SPI_SpiInit(&slave_init);
          SPI_Start();
      

       

      Is there any example doing this?

      Any ideas how to get it running?

      Thanks a lot

      Best regards

      Max