Class to be able to send SPI data with almost no overhead, useful at very high speeds.

Dependents:   MakerBotServer epaper_mbed_130411_KL25Z epaper_mbed_test epaper_mbed_test_copy1 ... more

Issue: Support STM32F103

Dear All,

How can we change this code to make it compatible with the STM32F103 chip? Thank you in advance.

2 comments:

16 Oct 2019

Add following "BurstSPI_STMF103C8.cpp" and make according changes in "BurstSPI_Unsupported.cpp"

#if defined(TARGET_STM32F103C8)
#include "BurstSPI.h"


void BurstSPI::fastWrite(int data) 
{
    SPI_TypeDef *spi = (SPI_TypeDef *)(_peripheral->spi.spi.handle.Instance);
    // Check if data is transmitted
    while ((spi->SR & SPI_SR_TXE) == 0);
    spi->DR = data;
}
   
void BurstSPI::clearRX( void )
{
    const SPI_TypeDef *spi = (SPI_TypeDef *)(_peripheral->spi.spi.handle.Instance);
    while (spi->SR & SPI_SR_BSY){   
        // Check RX buffer readable
        while ((spi->SR & SPI_SR_RXNE) == 0);
        int dummy = spi->DR;
        (void)dummy; // suppress UNUSED warning 
    }
}


#endif
13 Mar 2021

the code posted by davydov does literally nothing on the SPI pins for me, the code posted by zoltan at https://os.mbed.com/questions/81244/Getting-NeoPixels-WS2812-working-on-an-S/ does, but also not *quite* right (my neopixels are all orange no matter what i send)