- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi MaPo_2163411,
Unconfigured SCB mode is best suited for your application and is used when you want to change the SCB modes in run-time.
I have created a sample project to demonstrate your application. The unconfigured SCB is first configured to SPI mode slave mode. RX_FIFO_NOT_EMPTY is used to receive the bytes.
To change to SPI master mode, a pin interrupt is used (application dependent). Upon button press, the SCB is configured to SPI master mode and transmits a byte of data every 500 ms to the slave.
Please let me know if it helps.
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi MaPo_2163411,
Unconfigured SCB mode is best suited for your application and is used when you want to change the SCB modes in run-time.
I have created a sample project to demonstrate your application. The unconfigured SCB is first configured to SPI mode slave mode. RX_FIFO_NOT_EMPTY is used to receive the bytes.
To change to SPI master mode, a pin interrupt is used (application dependent). Upon button press, the SCB is configured to SPI master mode and transmits a byte of data every 500 ms to the slave.
Please let me know if it helps.
Regards,
Bragadeesh
Bragadeesh