Add DA3 DAC PMOD to the default PYNQ-Z1 overlay

Hi guys,

I’ve just bought a Pynq board.
Could anyone help and give the main steps to follow to add a new PMOD device to the default overlay? I’d like to add the DA3 PMOD DAC that is currently missing.

Many thanks!

1 Like

Some info here:
https://pynq.readthedocs.io/en/v2.4/overlay_design_methodology/pynq_microblaze_subsystem.html

I’d suggest you look at the code for an existing similar Pmod. E.g.

Or find something with similar interface or functionality.

You can usually find reference code for the chip used on a Pmod from the chip manufactures website, so you might not need to write a driver from the beginning.

Cathal

1 Like

Thank you very much Cathal!

I´m trying to add the Pmod DA3 to the Python library.

Looking at other PMOD devices in pynq.lib.pmod library, the command “self.microblaze.write_blocking_command(cmd)” is used to write to PMOD devices.

write_blocking_command function links to “write_mailbox” in pynq.py file:

def write_mailbox(self, data_offset, data):
“”"This method write data into the mailbox of the Microblaze.

    Parameters
    ----------
    data_offset : int
        The offset for mailbox data, 0,4,... for MAILBOX 0,1,...
    data : int/list
        A list of 32b words to be written into the mailbox.

    Returns
    -------
    None

    """
    offset = MAILBOX_OFFSET + data_offset
    self.write(offset, data)

This is the point I´m a bit stuck to now…

I try to figure out how the code is structured to link “self.microblaze.write_blocking_command” argument to the register address and data wrote to the PMOD AD3 device.

I don´t really get how the cmd value in “self.microblaze.write_blocking_command function(cmd)” is handled at lower level, to finally write to the correct register of AD3 DAC.

Any further clarification on this is really appreciated!

Kind regards.

Y_H

THis is a “convention” between the PS, and the MicroBlaze that is controlling the Pmod peripheral.

In the MicroBlaze C code for the peripheal you will have something like this:

loop: check for new command

switch(command):
 ... case xxx: read(ADC)
 ...

In the Python code you will write the word for the command to a location where the MicroBlaze will check for it. You can define this communication convention to be whatever you want. You just need to make sure what you do in Python matches what the C code you write expects.

Cathal

1 Like

Hi Y_H, just wanted to know if you were able to successfully add the DA3 to the Python library. I am currently facing the same task so it would be nice to know you were able to do it.