Electronic – Do I need a RTOS

bluetoothdspfreertosrtossound

My hardware would have a DSP with the following characteristics:

  • Sound generation (internal parameter will generate pure tones, white noise, filtered white noise or the sum of them).
  • I2C communication with sensors.
  • 4 capacitive sensing inputs (on/off for example) and 2 LEDs.
  • Communication with flash memory (I2C or SPI) for MP3 or other music files storage
  • HCI (UART or USB) to Bluetooth module (probably Panasonic's, as they are smaller).
  • BT stack with ability of SPP/iAP + HFP/HSP profiles.
  • Communication with audio codec (I2S or PCM) with mic input and headphones output. First, I would send music from the flash memory and then sound would be internally generated.
  • Communication with battery charger chip.
  • USB communication for flash memory music exchange.
    To take in consideration the BT communication with HFP + SPP/iAP will last one hour at maximum and will be one time every month. SPP communication only could be done everyday but the data transferred is few. Wouldn't last more than ten minutes.

The battery will have to last 8 hours with only sound generation.

In order to use the BT STACK from Dotstack I would need to use FreeRTOS (also I could port the code to my device but that would take some time if it is needed).

Should I use a RTOS in my DSP as I have so many things to do? I have some questions, as I have never used one and also I think I would increase power consumption a lot.

Best Answer

The asynchronous nature of the things you need to do, and the fact that there's so many of them, means that you'll end up building a complex web of interrupt handlers if you don't use an RTOS. It will make your software considerably easier, especially if it includes drivers for things like USB.

Battery life in this sort of scenario is mostly affected by how much you can sleep between actions. An RTOS shouldn't affect that much. If you're generating audio for 8 hours you'll probably find that the current consumption of your audio is larger than that of the DSP, especially if you have an amplifier.