Arduino Forum

Using Arduino => Audio => Topic started by: WilliamK Govinda on Oct 12, 2011, 08:43 pm

Title: FM62429 Digital Volume?
Post by: WilliamK Govinda on Oct 12, 2011, 08:43 pm
Guys, I found this cheap Digital Volume chip: FM62429 - its great, but the datasheet tells me its a 2-wire interface: Data, Clock - but doesn't show me what is transmitted. Can someone give me a hint, please?   :smiley-red:

http://www.fmsh.com/english/products/FM62429_ds_eng.pdf

Thank you, Wk
Title: Re: FM62429 Digital Volume?
Post by: robtillaart on Oct 12, 2011, 08:55 pm

first idea: from datasheet - Gain is from 0- -83dB in 1dB steps so I think one byte should be sufficient.

google gave me zillion links to the same datasheet or rubbish,
seems you have to reverse engineer the spec.  clock in bytes and measure ....
Title: Re: FM62429 Digital Volume?
Post by: WilliamK Govinda on Oct 12, 2011, 09:16 pm
Indeed. As soon as the chips arrive I will start playing around with it and see what happens, txs.

Wk
Title: Re: FM62429 Digital Volume?
Post by: WilliamK Govinda on Dec 03, 2011, 07:41 pm
Sadly no luck, couldn't get it to work.  =(
Title: Re: FM62429 Digital Volume?
Post by: WilliamK Govinda on Dec 06, 2011, 10:25 pm
A great friend just pointed me this out:

Quote
the FM62429 is a "copy" of Mistubishi's M62429/FP


And he sent me all PDF data, here's some links:

http://william-k.com/temp/M62429P.pdf

(http://william-k.com/temp/M62429P_1.jpg)

(http://william-k.com/temp/M62429P_2.jpg)

8)
Title: Re: FM62429 Digital Volume?
Post by: christianlykke on Apr 20, 2013, 11:55 pm
Do you mind sharing the part of your code where you are communicating with the volume control circuit?

I am having trouble sending 11 bits. How do you do that?
Title: Re: FM62429 Digital Volume?
Post by: sonnyyu on Apr 23, 2013, 07:32 pm
Additional from FM62429, CSC62429, CD62429 is replacement for M62429 as well.

if I were you , I will send 11 bits as 2 bytes since Arduino is 8 bits cpu. first byte is first 8 bits data, second byte will be rest 3 bits plus "00000" as tail by using Arduino virtual serial/serial port. I do not have above IC. You could give it a try.



Title: Re: FM62429 Digital Volume?
Post by: vile on Jun 01, 2014, 09:21 pm
Hello all,

if someone is interested, I'm running the M62429 on such a "Digital Stereo Audio Volume Control Board PT2259":  http://www.ebay.de/itm/Digital-Stereo-Audio-Volume-Control-Board-PT2259-Headphone-Audio-Amplifier-DIY-/141084601932?pt=DE_Computer_Sonstige&hash=item20d94c2e4c (http://www.ebay.de/itm/Digital-Stereo-Audio-Volume-Control-Board-PT2259-Headphone-Audio-Amplifier-DIY-/141084601932?pt=DE_Computer_Sonstige&hash=item20d94c2e4c) (https://imagizer.imageshack.us/v2/347x300q90/841/76z8.png)

If you do not use the rotary encoder but instead plug +5V, GND, DATA, and CLOCK to your Arduino it will work perfectly. The external power supply is also not needed.
(https://imagizer.imageshack.us/v2/900x506q90/842/stn5q.jpg)

I found a library and examples at this site https://github.com/krupski/M62429 (https://github.com/krupski/M62429), but in the library the delay functions have wrong syntax, so change _delay_ms to delay and _delay_us to delayMicroseconds.

The following code is based on the library, but mine doesn't need a library, it's all in the code.

Code: [Select]
/*
A little example sketch based on this lib: https://github.com/krupski/M62429/blob/master/M62429.cpp
*/

int x=0;
int VolumePinDAT=7; // connect to DATA
int VolumePinCLK=6; // connect to CLOCK




void setup (void)
{
 pinMode(VolumePinDAT, OUTPUT);
 pinMode(VolumePinCLK, OUTPUT);
}

void loop (void)
{

 // sweep from quiet to loud
 for (x=0;x<=100;x++)
{
 setVolume(x);
 delay(100);
 }
 
 // sweep back
 for (x=100;x>=0;x--)
{
 setVolume(x);
 delay(100);
 }
}


 

// this function does the job
void setVolume (uint8_t volume)
{
uint8_t bits;
uint16_t data = 0; // control word is built by OR-ing in the bits

// convert attenuation to volume
volume = (volume > 100) ? 0 : (((volume * 83) / -100) + 83); // remember 0 is full volume!
       // generate 10 bits of data
data |= (0 << 0); // D0 (channel select: 0=ch1, 1=ch2)
data |= (0 << 1); // D1 (individual/both select: 0=both, 1=individual)
data |= ((21 - (volume / 4)) << 2); // D2...D6 (ATT1: coarse attenuator: 0,-4dB,-8dB, etc.. steps of 4dB)
data |= ((3 - (volume % 4)) << 7); // D7...D8 (ATT2: fine attenuator: 0...-1dB... steps of 1dB)
data |= (0b11 << 9); // D9...D10 // D9 & D10 must both be 1

for (bits = 0; bits < 11; bits++) { // send out 11 control bits
delayMicroseconds (2); // pg.4 - M62429P/FP datasheet
digitalWrite (VolumePinDAT, 0);
delayMicroseconds (2);
digitalWrite (VolumePinCLK, 0);
delayMicroseconds (2);
digitalWrite (VolumePinDAT, (data >> bits) & 0x01);
delayMicroseconds (2);
digitalWrite (VolumePinCLK, 1);
}
delayMicroseconds (2);
digitalWrite (VolumePinDAT, 1); // final clock latches data in
delayMicroseconds (2);
digitalWrite (VolumePinCLK, 0);
//return data; // return bit pattern in case you want it :)
}

Title: Re: FM62429 Digital Volume?
Post by: Frederic_Plante on Jul 26, 2014, 12:00 am
Ok, so final confirmation before I buy.

1.These chips FM62429 work well with Audio
2.Although they are not I2C they work with 2 Wires.
3.You are satisfy with the audio results

One more question, can you read the data that you send after you send? I mean if I set the volume value, can I go later and check what the value is set to? Or is the register write only?
Title: Re: FM62429 Digital Volume?
Post by: jerome187 on Aug 10, 2017, 09:17 pm
can this chip be used as an actual pot?
Title: Re: FM62429 Digital Volume?
Post by: jerome187 on May 18, 2018, 01:44 am
anyone?  its advertised as a digital potentiometer  in many places