ΣSigmaStudio Ask AI Русский Log in

ADAU1452 load by microcontroller

SigmaDSP & SigmaStudio wygonski Nov 14, 2017 00:00 1 replies Original on forum ↗
Thread Summary

Thread Summary

The user encountered an issue where the ADAU1452, when loaded with a program by a microcontroller, output a sine wave at 1/4 the expected frequency after changing the system sample rate to 192kHz. The problem was due to a discrepancy in the microcontroller code where a different #define value for the Start Pulse Selection Register was used, setting the sample rate to 48kHz. The solution involved ensuring the correct register value (R66_START_PULSE_IC_1_Default) was consistently used in the microcontroller code. The user suggested a more uniform naming strategy for register values in SigmaStudio to prevent similar issues.
AI Generated Content
Subscribe
wygonski Question
Nov 14, 2017 00:00

Our product has a microcontroller connected to the slave port of the ADAU1452 which connects to a AD1938 codec on a board of our own design. For quite some time our microcontroller firmware is able to load a program image to the ADAU1452 and also configure the AD1938. The firmware can also configure the codec, and then disconnect from the SPI port so that the USBi can be used in SigmaStudio for DSP program development.

We have recently changed our system sample rate from 48kHz to 192kHz, and we are experiencing an odd problem with loading the ADAU1452. A simple program with Fs=192kHz to output a sinewave to the DAC works fine when run within SIgmaStudio, However when our microcontroller loads the program using the exported system files, the sine frequency is 1/4 of what it should be, as if the value of the Start Pulse selection has reverted to 48kHz. I have verified that the exported files have the correct value:

/* START_PULSE - Registers (IC 1) */
#define REG_START_PULSE_IC_1_ADDR 0xF401
#define REG_START_PULSE_IC_1_BYTE 2
#define REG_START_PULSE_IC_1_VALUE 0x4

and that code is exported to load this register:

SIGMA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_IC_1, REG_START_PULSE_IC_1_ADDR, REG_START_PULSE_IC_1_BYTE, R66_START_PULSE_IC_1_Default );

So I'm at a loss to explain why the microcontroller-loaded code is not working at 192kHz?

I've attached the project file and the exported system files.

Thanks,

John

Audio Signal Processors

adau1452

ad1938

adau1452 sigmastudio

Integrated/Special Purpose A/D Converters

adau1452 + mcu

SigmaDSP Audio Processors

Audio CODECs

Show More

wygonski Reply
Nov 15, 2017 00:00

Posting the solution to my problem here after writing code to read back the Start Pulse Selection Register contents.

My microcontroller code has a function to hibernate and kill the ADAU1452 core when doing writes to program memory. My mistake was that while the exported default_download_ic_1() function had the proper value for the start pulse register for 192k as literal value R66_START_PULSE_IC_1_Default :

...

SIGMA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_IC_1, REG_KILL_CORE_IC_1_ADDR, REG_KILL_CORE_IC_1_BYTE, R64_KILL_CORE_IC_1_Default );
SIGMA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_IC_1, REG_START_ADDRESS_IC_1_ADDR, REG_START_ADDRESS_IC_1_BYTE, R65_START_ADDRESS_IC_1_Default );
SIGMA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_IC_1, REG_START_PULSE_IC_1_ADDR, REG_START_PULSE_IC_1_BYTE, R66_START_PULSE_IC_1_Default );
SIGMA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_IC_1, REG_START_CORE_IC_1_ADDR, REG_START_CORE_IC_1_BYTE, R67_START_CORE_IC_1_Default );
SIGMA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_IC_1, REG_START_CORE_IC_1_ADDR, REG_START_CORE_IC_1_BYTE, R68_START_CORE_IC_1_Default );
SIGMA_WRITE_DELAY( DEVICE_ADDR_IC_1, R69_START_DELAY_IC_1_SIZE, R69_START_DELAY_IC_1_Default );
SIGMA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_IC_1, REG_HIBERNATE_IC_1_ADDR, REG_HIBERNATE_IC_1_BYTE, R70_HIBERNATE_IC_1_Default );

...

I had other microcontroller code to write program memory that brought the ADAU1452 out of hibernation with a block of code from this forum post which unfortunately used a different #define R53_START_PULSE_IC_1_Default which set the sample rate at 48k.

So I'll definitely own this programming mistake, but I'll question why every register value emitted by SigmaStudio in exported xxx_IC_1.h header file is prefixed with Rnn_ where Rnn_ changes. A uniform naming strategy would make programming of host code a bit easier. Why not simply name it START_PULSE_IC_1_Default so that my boilerplate microcontroller code can alway as reference it?