Skip to content

Problem on DAC Lib. #2

@LeoPersike

Description

@LeoPersike

Hello,
First of all, thanks for sharing your library.
I was using your DAC library on an Arduino Due and found some problems.

At the file dacc.h
Line 21 -> #define DACC ((dacc_reg_t *) 0x40094000U)
If you check the ATSAM3X8E Datasheet you will see that the correct address is 0x400C8000U

Another problem is when you select channel 0 and after that sellect channel 1 (or vice-versa). When you do that you write a value on channel select register that is reserved (11 - check the datasheet again). My suggestion is to change dacc_select_channel function to this:

void dacc_select_channel(uint32_t channel)
{
if (channel <= DACC_CHANNEL_MAX)
{
DACC->DACC_MR &= 0xFFFCFFFF;
DACC->DACC_MR |= (channel << DACC_MR_USER_SEL_POS);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions