I have created a ticket with a proposed patch attached.
Alexandre
How to use DAC1 Ch2 without dual mode Topic is solved
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: How to use DAC1 Ch2 without dual mode
Hi,
Fixed in repository, could you confirm everything is OK?
Giovanni
Fixed in repository, could you confirm everything is OK?
Giovanni
- alex31
- Posts: 379
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 38 times
- Been thanked: 62 times
- Contact:
Re: How to use DAC1 Ch2 without dual mode
looks fine. I was on the road this two days, I will be able to do a real test tomorrow.
thanks
Alexandre
thanks
Alexandre
- alex31
- Posts: 379
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 38 times
- Been thanked: 62 times
- Contact:
Re: How to use DAC1 Ch2 without dual mode
Tests has been done on F4 and F7 and all is working nicely !
Alexandre
Alexandre
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: How to use DAC1 Ch2 without dual mode
Hi,
I have a similar problem. I'm using a STM32L4R5ZI-NUCLEO144 board and the version 19.1.0 of ChibiOS.
My mcuconf.h have the following definitions:
The DAC configuration is:
When the following code is executed, an assertion fails:
The dacPutChannelX() function contains:
channel is 1 and DAC_MAX_CHANNELS is 1.
The DAC_MAX_CHANNELS macro is defined in hal_dac_lld.h as:
Is it possible to use that channel with that instance of the driver? Should I use channel 0 in both instances?
Thanks
I have a similar problem. I'm using a STM32L4R5ZI-NUCLEO144 board and the version 19.1.0 of ChibiOS.
My mcuconf.h have the following definitions:
Code: Select all
/*
* DAC driver system settings.
*/
#define STM32_DAC_DUAL_MODE FALSE
#define STM32_DAC_USE_DAC1_CH1 TRUE
#define STM32_DAC_USE_DAC1_CH2 TRUE
#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10
#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10
#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
#define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID_ANY
#define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID_ANY
The DAC configuration is:
Code: Select all
static DACConfig dac_cfg = {
// Initial output on DAC channels.
.init = 0U,
// DAC data holding register mode.
.datamode = DAC_DHRM_8BIT_RIGHT,
// DAC control register.
.cr = 0
};
When the following code is executed, an assertion fails:
Code: Select all
dacPutChannelX(&DACD2,1,dac_out2);
The dacPutChannelX() function contains:
Code: Select all
void dacPutChannelX(DACDriver *dacp, dacchannel_t channel, dacsample_t sample) {
osalDbgCheck(channel < (dacchannel_t)DAC_MAX_CHANNELS);
osalDbgAssert(dacp->state == DAC_READY, "invalid state");
dac_lld_put_channel(dacp, channel, sample);
}
channel is 1 and DAC_MAX_CHANNELS is 1.
The DAC_MAX_CHANNELS macro is defined in hal_dac_lld.h as:
Code: Select all
/**
* @brief Max DAC channels.
*/
#if STM32_DAC_DUAL_MODE == FALSE
#define DAC_MAX_CHANNELS 1
#else
#define DAC_MAX_CHANNELS 2
#endif
Is it possible to use that channel with that instance of the driver? Should I use channel 0 in both instances?
Code: Select all
dacPutChannelX(&DACD1,0,dac_out1);
dacPutChannelX(&DACD2,0,dac_out2);
Thanks
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: How to use DAC1 Ch2 without dual mode
Hi,
It is a bug, I think the problem is here:
Those two definitions are inverted. Moving this topic in bug reports.
Giovanni
It is a bug, I think the problem is here:
Code: Select all
/**
* @brief Max DAC channels.
*/
#if STM32_DAC_DUAL_MODE == FALSE
#define DAC_MAX_CHANNELS 1
#else
#define DAC_MAX_CHANNELS 2
#endif
Those two definitions are inverted. Moving this topic in bug reports.
Giovanni
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Who is online
Users browsing this forum: No registered users and 5 guests