Page 1 of 1

Component for MCP4728

Posted: Mon Feb 11, 2019 6:50 pm
by chad
Hey, while you are at it ;) I am going to be using the mcp4728...Actually I am going to be using 4 of them.

thanks,
chad

Re: Component for MCP4728

Posted: Wed Feb 13, 2019 6:07 pm
by Benj
Hi Chad,

I've had a go at adding this. I think it should work ok but I haven't done the code to allow you to set the I2C address on the onboard EE memory. Do you need this or will you have unique I2C pins for each device?

Available now via the update system.

Re: Component for MCP4728

Posted: Wed Feb 13, 2019 8:19 pm
by chad
Hi Ben, that's awesome!

I was hoping to use them all on the same i2c line so I didn't have to waste all of those pins and have multiple i2c bitbangs going.
Just took a look at the component. Looks great. One suggestion if possible. on the 3d display It would be cool of the 0-4.1 could scale with the vref setting. Not a big deal, Just a little thing. *EDIT Never mind, I see now that it does it.)

My friend has my 4728 and I will get it back from him later this week and give it a shot!

*EDIT. I got it back and was going to give it a try but the 446re target is broken, so I will test is as soon as i can..

Thanks!!

chad

Re: Component for MCP4728

Posted: Sun Feb 17, 2019 3:11 am
by chad
I was looking at the data sheet and looking at some old arduino code. We really need to be able to write to the eeprom. I am going to have to be able to set the dac voltages to 0 on power up. Very picky laser diodes are going to be hanging of the back of these.

thanks
Chad

Re: Component for MCP4728

Posted: Tue Feb 19, 2019 5:26 pm
by Benj
Hi Chad,

I've had a go for you, the latest component is now available via the update system.

Let us know how you get on.

Re: Component for MCP4728

Posted: Tue Feb 19, 2019 6:11 pm
by chad
Ok I will!

I'll give it a shot. I did have one question. In the properties you have sda and sda pins, scl, scl pins.

I don't get why there are 4 pin settings for those two pins.

Chad

Re: Component for MCP4728

Posted: Tue Feb 19, 2019 6:16 pm
by Benj
Hi Chad,

SCL and SDA should be the fixed hardware pins. These should be read only.

SCL Pins and SDA Pins should only appear when you have remappable functionality onboard your target chip which lets you select the SCL and SDA pins. These should be selectable from a list of valid pins.

Looks like there may be a bug at the moment which makes SCL and SDA writable when in hardware mode. I'll investigate this as I've not come across this one before.

Re: Component for MCP4728

Posted: Tue Feb 19, 2019 6:23 pm
by chad
Yeah, something is funky, because I can't choose the pins that I want to use. I can select sda c9 and scl c8, but can't select them in the pins.

Chad

Re: Component for MCP4728

Posted: Tue Feb 19, 2019 6:25 pm
by chad
And btw, I can't select hardware at all. It only has the software option.

and it didn't work...
I am using the 446re chip target.
chad

Re: Component for MCP4728

Posted: Tue Feb 19, 2019 6:30 pm
by Benj
Hi Chad,

I've re-exported the component and hopefully the pin properties should behave better for you now.

Currently no HW I2C support on the ST ARMs though Leigh is looking into this. Software should work fine.

Re: Component for MCP4728

Posted: Tue Feb 19, 2019 6:41 pm
by chad
Cool, I try it out. Thanks!

I'll give it a try when I get home later..

Chad

Re: Component for MCP4728

Posted: Tue Feb 19, 2019 6:47 pm
by chad
I Tried it out. I am not getting anything on the sda or scl pins.

Edit I had the pin wrong Scl is pb8 I get a blip on the scope but it isn't changing the dac output.
I'll dig into it later
thanks


C

Re: Component for MCP4728

Posted: Tue Feb 19, 2019 11:39 pm
by Benj
Hi Chad,

Do you have pull up resistors fitted to the SDA and SCL pins? The MCP472 likely won't provide them for you.

It should be possible to use the internal pull ups using a line of C code to avoid external components. What pins are you using and I'll have a stab at the code for you.

Re: Component for MCP4728

Posted: Wed Feb 20, 2019 7:39 am
by chad
Yeah I had 4.7k pullups. I also had a dud jumper wire... I don't want to talk about it...

Anyway I spent many hours testing it this evening. Here's a rundown.

Initialize works.
Dac channels work.
Enable channels work.
100kb,400kb works. 1meg is no different in speed to 400k. Have not verified actual 400k.
The DeviceAddress works when set to 0(default) and my default chip. Doesn't work when set to other than 0. Can't' test further.


The GainOP property setting is inverted on hardware. It's backwards.
The SetinitalEEOutput doesn't function.
The SetDeviceAddress doesn't function.
The PDOoption doesn't doesn't function.

Haven't tried disable channel yet.
Haven't tried ControlPins yet. Question on ControlPins, Do I have to toggle this manually or does it do it's thing when writing to this dac [component UseLDAC]?

A Properties: VREFOPtion,GAinOP,VrefVol issue. I run my dac at 3.3v. The 2.048 vref x2 gain only gets to 3.3 not 4.096 and probably isn't linear. The VREFOPtion>VDD doesn't allow you to set the slider values to match actual dac output based on voltage. Not quite sure how to fix this. If=VDD VrefVol (Input VDD voltage)?. If VREFOPtion>INTernal | Gain 1X everything matches. The chip works from 2.7v to 5.5v... Is any of that legible:)

So far so good.

Thanks,

chad

Here is my test prog.
dac test.fcfx
(11.83 KiB) Downloaded 178 times

Re: Component for MCP4728

Posted: Thu Feb 21, 2019 2:21 pm
by Benj
Hi Chad,
The GainOP property setting is inverted on hardware. It's backwards.
Fixed.
The SetinitalEEOutput doesn't function.
I've added a new parameter to allow you to specify if the DAC is enabled or not on power up my guess is it's currently working but disabled.
The SetDeviceAddress doesn't function.
This macro requires you to have the Use LDAC pin set to True and each MCP4728 IC connected must have a unique LDAC pin. The macro then toggles the LDAC pin for you, hopefully as required.
The PDOoption doesn't doesn't function.
This is only active when the DAC is in the disabled state. I can't specifically find a fault with this code.
Haven't tried ControlPins yet. Question on ControlPins, Do I have to toggle this manually or does it do it's thing when writing to this dac [component UseLDAC]?
The component uses the LDAC pin when executing the SetDeviceAddress macro. Other then this it is not used by the component.

I'll get the updated component pushed to the update system for you tomorrow.

Re: Component for MCP4728

Posted: Fri Feb 22, 2019 5:20 pm
by chad
Hi ben,

Sorry I have been busy with work.. I'll give this a shot this weekend and let you know!

Thanks

chad

Re: Component for MCP4728

Posted: Fri Feb 22, 2019 9:45 pm
by Benj
No Worries :D

I didn't manage to push the file to the update system in the end so here it is if you want to have a go.
DAC_Output_MCP4728.fcpx
(6.47 KiB) Downloaded 184 times