SPI custom clock frequency value calculation

I have a slightly off the wall requirement where I need to send a serial data stream at 5kbps, it will be used to drive an external OOK 433MHz transmitter. The data format and bit timing are rigid as it will be used with some existing legacy receivers. The Softdevice will be running, the system will be advertising and accepting GATT connections at all times.

Because the softdevice is running and will interrupt any code I need DMA, SPI looks like the best option as far as I can see. But is it possible to set the frequency as low as 5k bps? I have read other articles here and know it is out of spec, but that doesn't matter here as it's not actually interfacing to another SPI device. If so, what is the calculation for custom bitrates?

UART won't work because it adds start/stop bits.

(If you can suggest a better way to serially transmit 56 bits of data by DMA I'm happy to listen!)

Parents Reply
  • Sadly 5kbps wasn't achievable, although it will go low enough the frequency setting doesn't have enough resolution - it jumps from 4k to 6k

        spi_config.frequency =   0x0017fffeUL; // 250uS 4kbps
        spi_config.frequency =   0x0017ffffUL; // 165uS 6kbps

    Still it may be a moot point after all: looking at hardware options for the 433MHz RF side many devices now incorporate a TX FIFO so I may be able to just use SPI as-is.

Children
No Data
Related