devsaurus's PCM/Sigma Delta module questions
Posted: Wed Jan 03, 2018 12:22 pm
I'm making calls to the PCM firmware module to synthesise audio and drive a loudspeaker. It works great but the PCM operates at 4MHz which is a bit too fast for my particular output driver (H-Bridge driver). The Sigma Delta firmware module on the other hand generates PWM at a fixed 312 kHz frequency which would be ideal but it's not possible to "feed" it at audio frequencies from Lua.
I've been staring at the C sources trying to figure out how the PCM firmware module sets up the Sigma Delta hardware but just can't see it. If a new PCM object is created with the pcm.SD argument, it seems to check for the sigma_delta module:
but I'm left with many questions - some simple such as what dependencies there are when using the two firmware modules. I can build the firmware without the Sigma Delta module yet the PCM module works OK. I hope someone is able to clarify and possibly give some tips on how it might be possible to change the base frequency of the PCM
I've been staring at the C sources trying to figure out how the PCM firmware module sets up the Sigma Delta hardware but just can't see it. If a new PCM object is created with the pcm.SD argument, it seems to check for the sigma_delta module:
Code: Select all
if (driver == PCM_DRIVER_SD) {
cfg->pin = luaL_checkinteger( L, 2 );
MOD_CHECK_ID(sigma_delta, cfg->pin);
but I'm left with many questions - some simple such as what dependencies there are when using the two firmware modules. I can build the firmware without the Sigma Delta module yet the PCM module works OK. I hope someone is able to clarify and possibly give some tips on how it might be possible to change the base frequency of the PCM