problem with buffer for DAC DUAL

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
vambwodonk
Posts: 15
Joined: Tue Oct 14, 2014 5:36 am

problem with buffer for DAC DUAL

Post by vambwodonk »

Hi,

I'm trying DUAL DAC from TESTHAL but cannot get sine wave output.
I'm using STM32-F4 Discovery. Looks like this,
example.png


then after i see this note:

Code: Select all

The buffer is organized as a matrix of M*N elements where M is the
 *          channels number configured into the conversion group and N is the
 *          buffer depth. The samples are sequentially written into the buffer
 *          with no gaps.


i change my code buffer 100 sample sine wave to this:

Code: Select all

#define DAC_BUFFER_SIZE 200

/*
 * DAC test buffer (sine wave).
 */
static const dacsample_t dac_buffer[2][100] = {
      {
            2048,2176,2304,2431,2557,2680,2801,2919,3034,3145,
            3251,3353,3449,3540,3625,3704,3776,3842,3900,3951,
            3995,4031,4059,4079,4091,4095,4091,4079,4059,4031,
            3995,3951,3900,3842,3776,3704,3625,3540,3449,3353,
            3251,3145,3034,2919,2801,2680,2557,2431,2304,2176,
            2048,1919,1791,1664,1538,1415,1294,1176,1061,950,
            844,742,646,555,470,391,319,253,195,144,
            100,64,36,16,4,0,4,16,36,64,
            100,144,195,253,319,391,470,555,646,742,
            844,950,1061,1176,1294,1415,1538,1664,1791,1919
      },
      {
            2048,2176,2304,2431,2557,2680,2801,2919,3034,3145,
            3251,3353,3449,3540,3625,3704,3776,3842,3900,3951,
            3995,4031,4059,4079,4091,4095,4091,4079,4059,4031,
            3995,3951,3900,3842,3776,3704,3625,3540,3449,3353,
            3251,3145,3034,2919,2801,2680,2557,2431,2304,2176,
            2048,1919,1791,1664,1538,1415,1294,1176,1061,950,
            844,742,646,555,470,391,319,253,195,144,
            100,64,36,16,4,0,4,16,36,64,
            100,144,195,253,319,391,470,555,646,742,
            844,950,1061,1176,1294,1415,1538,1664,1791,1919
      }
};


then start DAC:

Code: Select all

dacStartConversion(&DACD1, &dacgrpcfg1, *dac_buffer, DAC_BUFFER_SIZE);


But, i got no luck, my DUAL DAC still fail to load correct buffer,
after.png

Please help me.

Thanks,
Arif,
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: problem with buffer for DAC DUAL

Post by Giovanni »

Hi,

That looks like a driver problem, I will verify this, stay tuned but it will take some days, there are other things in queue.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: problem with buffer for DAC DUAL

Post by Giovanni »

Hi,

Just a note.

I haven't forgot this, I am waiting for an oscilloscope at home in order to test the driver.

Giovanni
vambwodonk
Posts: 15
Joined: Tue Oct 14, 2014 5:36 am

Re: problem with buffer for DAC DUAL

Post by vambwodonk »

May i can help you with my oscilloscope?,
if your Oscilloscope not ready yet.

Arif,
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: problem with buffer for DAC DUAL

Post by Giovanni »

I need to do some debugging so I need one :) it is almost here anyway, during the weekend I will be on this.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: problem with buffer for DAC DUAL

Post by Giovanni »

OK, oscilloscope received :)

I have been able to see the problem in the DAC_DUAL demo, I am trying to understand the problem.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: problem with buffer for DAC DUAL

Post by Giovanni »

It was a wrong DMA setting, the driver sent twice the data specified so garbage was added at the end of the stream.

Fixed in repository as bug #677.

Giovanni
vambwodonk
Posts: 15
Joined: Tue Oct 14, 2014 5:36 am

Re: problem with buffer for DAC DUAL

Post by vambwodonk »

Nice update !! :D
Post Reply