Post Go back to editing

Loading the DSP via assembly language

I have reviewed the tutorial and examples for loading a ADAU1781 via I2C, but they all involve writing in C, which I do not use.

All the files, headers, etc. make no sense to me.

I am a consultant on the development team for a product which has a PIC microcontroller, (my portion), and the DSP,

which another consultant is developing.

My first attempt was to take the file "hex_program_data.dat" from the DSP guy, convert it to data statements, include it in

my .asm program, then use I2C to send the contents to the AD device.

After talking to Brett, I realized this would not work.

I looked at all the files in the integration example, and could not make much sense out of them.

My preference is to make the loading automatic and not have to massage the assembly code if the DSP code changes,

by using the include feature.  If multiple files are necessary, that is not a problem.  If any required sub-addresses

are embedded in this file that need to be handled in the I2C routines, that is not a problem.

I just cannot get my head around what needs to be done to load the DSP.

Has anyone done this, or can someone help me make sense out of this?


  • Hi Richard,

    In SigmaStudio, a number of things are downloaded to the target hardware when the user clicks the "Link-Compile-Download" button:

    • Program RAM
    • Parameter RAM
    • Non-Modulo Data RAM
    • Hardware Control Registers

    That might not sound like much, but for a simple ADAU1781 program like this...

    (screenshot of basic ADAU1781 project)

    ...the data that is downloaded looks like THIS:

    (screenshot of the Capture Window in SigmaStudio for the example project download)

    These data downloads have to occur in the exact same sequence on your  microcontroller in order to get the SigmaDSP into the same operating  mode as it is when the code is downloaded via SigmaStudio. That's quite a bit of data.

    Unfortunately, the data files generated in the project folder by default (hex_program_data.dat, for example) simply contain the program RAM and parameter RAM contents of the project. That will not suffice. You need to get all of the information shown above in order to make your hardware work properly. In other words, you need to emulate the exact write sequence shown in the capture window above.

    There is a way to manually copy this information out to raw address + data files by right-clicking one line at a time, as shown here:

    (manually exporting raw data)

    However, as you can imagine, that's very time-consuming...

    Luckily, there's an easier solution!

    First, make sure your project is compiled by pressing the Link-Compile-Download button:


    Now, click the button to its immediate right, labeled Export System Files:

    (Export System Files)

    This generates a huge amount of data in the form of C-compatible include files and raw data files, as you have seen. In the case of assembly programming, the C header files are pretty useless. However, the important files for the initialization download are these two files:

    (NumBytes and TxBuffer files)

    These two files contain all of the data you need to boot your chip. The file TxBuffer contains the I2C address and write data for every address in the download sequence shown above in the Capture Window.

    For example, the first two lines of this file are as follows:

    0x40, 0xEB,             /* (0) IC 1.Start Pulse */

    If you refer to the Capture Window screenshot above, you'll see that the first register write is to address 0x40EB, and the data is 0x0A.

    The next two lines in TxBuffer are as follows:

    0x40, 0xF6,             /* (1) IC 1.Sound Engine Run */

    If you refer to the Capture Window screenshot above, you'll see that the second register write is to address 0x40F6, and the data is 0x00.

    And so on....

    The file NumBytes accompanies TxBuffer in that it shows how many bytes are included in each transaction. For the first two examples I showed above, there are 2 address bytes and 1 data byte. So, as one might expect, the first two lines of the NumBytes file are:


    When you get down to the program and parameter RAM downloads, you'll see much larger numbers like:


    The main idea is that you can parse these two files and easily create an I2C write function that will download all of the data in order. No C compiler required!

    The NumBytes and TxBuffer files for my example project are attached for your reference.

  • This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

    Thank you,
    EZ Admin