Problem with DAC MCP41x6

Any bugs you encounter with Flowcode should be discussed here.
DirkB
Posts: 59
http://meble-kuchenne.info.pl
Joined: Thu Dec 10, 2020 3:55 pm
Been thanked: 4 times

Problem with DAC MCP41x6

Post by DirkB »

Hello,

the family DAC MCP41x6 does not work with the hardware. In simulation it works very well.
However the speed of the program is decreased by about half in simulation and hardware, if
you include a DAC. If a PWM is used as output, the speed increases again by about twice.

regards
Dirk

BenR
Matrix Staff
Posts: 1740
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 442 times
Been thanked: 603 times

Re: Problem with DAC MCP41x6

Post by BenR »

Hello Dirk,

Please can you attach your program and I'll investigate the issue for you, would be interesting to see the speed difference.

DirkB
Posts: 59
Joined: Thu Dec 10, 2020 3:55 pm
Been thanked: 4 times

Re: Problem with DAC MCP41x6

Post by DirkB »

Hello Ben,

here it is. A small wave generator. if you activate either the pwm or the dac, you can see the
difference in speed very well. However, the DAC does not work with the hardware chip.
Is it possible that PWM as well as of course the DAC reduce the speed less? Without output the
speed is really dramatically faster.

regards
Dirk
Attachments
Wavegen-DAC.fcfx
(24.4 KiB) Downloaded 92 times

DirkB
Posts: 59
Joined: Thu Dec 10, 2020 3:55 pm
Been thanked: 4 times

Re: Problem with DAC MCP41x6

Post by DirkB »

sorry, it should of course be mpc47x6 ;O)

regards
Dirk

DirkB
Posts: 59
Joined: Thu Dec 10, 2020 3:55 pm
Been thanked: 4 times

Re: Problem with DAC MCP41x6

Post by DirkB »

Hi Ben, any news?

Dirk

BenR
Matrix Staff
Posts: 1740
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 442 times
Been thanked: 603 times

Re: Problem with DAC MCP41x6

Post by BenR »

Hi Dirk,

Is the User Address Bits property correct for your MCP47x6 device? It wont work without this being correct.

Assuming that' correct you have enabled the DAC before intialising it and so the enable call will likely never make it to the DAC.

medelec35
Matrix Staff
Posts: 1452
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: Problem with DAC MCP41x6

Post by medelec35 »

Hi Dirk.
Following on from Ben's post about the address.
You might already know this, but if so this will be useful for other people with a similar device.
The User Address Bits is of course determined by the Logic state of Pins A0 to A2.
If I was you I would the voltage of the pins and then set the User Address Bits according to the table below:
MCP47x6 DAC I2C Address.png
MCP47x6 DAC I2C Address.png (6.75 KiB) Viewed 2632 times
If you are still having issues, then I will order a DAC and see if I can work out what the issue is.
The Address in Hex column is just in case you are using a logic analyser that shows address.
If not it can be ignored as it's not required for your project file.
Martin

DirkB
Posts: 59
Joined: Thu Dec 10, 2020 3:55 pm
Been thanked: 4 times

Re: Problem with DAC MCP41x6

Post by DirkB »

Hello,

I do not understand. It is an I2C device and the channel and address are set in the properties. In my case channel 1 (Hardware) and address 0 or 1,
it does not matter. And yes, I enabled the DAC first and then initialized. But there is still the problem that the actual program is extremely
slowed down when the DAC is used, unlike a PWM.

Dirk

DirkB
Posts: 59
Joined: Thu Dec 10, 2020 3:55 pm
Been thanked: 4 times

Re: Problem with DAC MCP41x6

Post by DirkB »

Me again. You can understand the problem with the speed very well in my small program attached above by activating once the PWM and then instead of the PWM the DAC. The speed appears 10 times slower with the DAC. My DAC also gives no output voltage, it does not work.

Dirk

BenR
Matrix Staff
Posts: 1740
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 442 times
Been thanked: 603 times

Re: Problem with DAC MCP41x6

Post by BenR »

Hi Dirk,

Do you have pull up resistors fitted on the SCL and SDA traces? The I2C will be slower then the PWM which is based on internal register writes but shouldn't be really slow as each write only sets a couple of registers on the device.

If it's still not working and you've confirmed the pull up resistors are in place then I'll have another look through the component code and make sure this all looks ok.

Post Reply