HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: dileep254 on 2014-02-04 10:17:26

Title: cs42l55
Post by: dileep254 on 2014-02-04 10:17:26
Hi guys,

    Using cp2114-cs42l55 i  programmed using python scripting .For cp2114_set ram config i programmed the audio properties.when i am reading default dac read address using cp2114_Get Dac read register i am not able see any communication in waveform of SDA pin .I am just seeing as zero trasnistion .llly for Dac register of address at 02h and 03h i have written data i am not able to get data from dac registers through i2c


Please help me guys

import ctypes
import time
import os
mydll=ctypes.WinDLL("C:\Python27\SLABHIDtoUART.dll")
mydk=ctypes.WinDLL("C:\Python27\SLABHIDDevice.dll")
SI_SUCCESS =0x00;
j=0;
vid=0x10C4;
pid=0xEAB0;
devicenum=0;
k = ctypes.c_ulong();
R=ctypes.pointer(k);

c=ctypes.c_uint()
m=ctypes.pointer©

ro=ctypes.c_ulong();
rd=ctypes.pointer(ro);



kbuf =ctypes.create_string_buffer(255)
B=ctypes.pointer(kbuf)

status = mydll.HidUart_GetNumDevices(R,vid,pid);
print "status is " + str(status)

pk=ctypes.c_ulong();
D=ctypes.pointer(pk);

no=ctypes.c_ulong();
dw=ctypes.pointer(no);

if status != SI_SUCCESS:
    print "No of devices found is error "
print k.value

statusk=mydll.HidUart_GetString(devicenum,vid,pid,B,0x04);
print statusk
if statusk==SI_SUCCESS:
    print "connected to device number :"
print kbuf.value

##reset=mydll.HidUart_Reset(c.value);
##print "Reset is "+str(reset)


op=mydll.HidUart_Open(m,devicenum,vid,pid)
print "op is " +str(op)
print c.value


##statusk=mydll.HidUart_GetOpenedString(c.value,B,0x05);
##print statusk
##if statusk==SI_SUCCESS:
##    print "connected to device number :"
##print kbuf.value






enable=mydll.HidUart_SetUartEnable(c.value,1)
print "enable is " +str(enable)

Getenable=mydll.HidUart_GetUartEnable(c.value,D)
print Getenable
print pk.value

Gpio=(ctypes.c_ulong*14)()
Gpio[0]=3
Gpio[1]=3
Gpio[2]=3
Gpio[3]=3
Gpio[4]=3
Gpio[5]=4
Gpio[6]=4
Gpio[7]=4
Gpio[8]=4
Gpio[9]=3
Gpio[10]=4
Gpio[11]=3
Gpio[12]=2
Gpio[13]=2

PGpio=ctypes.pointer(Gpio)
pinconf=mydll.CP2114_SetPinConfig(c.value,PGpio,0,0x0000,0x0000,0x00)

print "pincnf"  + str(pinconf)

Ram=(ctypes.c_ulong*30)(255)
##Ram=de();
Ram[0]=0x01
Ram[1]=0x00
Ram[2]=0x94
Ram[3]=0xA6
Ram[4]=0xC4
Ram[5]=0x0C
Ram[6]=0x01
Ram[7]=0xE0
Ram[8]=0x1C
Ram[9]=0x1D
Ram[10]=0x1A
Ram[11]=0x1B
Ram[12]=0x1C
Ram[13]=0x1D
Ram[14]=0x1A
Ram[15]=0x1B
Ram[16]=0x70
Ram[17]=0x77
Ram[18]=0x44
Ram[19]=0x0C
Ram[20]=0x00
Ram[21]=0x00
Ram[22]=0x00
Ram[23]=0x00
Ram[24]=0x00
Ram[25]=0x00
Ram[26]=0x00
Ram[27]=0x00
Ram[28]=0x00
Ram[29]=0x00


Ramp=ctypes.pointer(Ram)



RA=mydll.CP2114_SetRamConfig(c.value,Ramp)
print "RA is "+str(RA)

time.sleep(2)
os.startfile('song.wav')

##time.sleep(2)
##os.startfile('song.wav')
##
##GRam=(ctypes.c_ulong*32)(255)
##GRamp=ctypes.pointer(GRam)
##
####
##GRA=mydll.CP2114_GetRamConfig(c.value,GRamp)
##print "GRA is "+str(GRA)
##
##print GRamp.contents[0],GRamp.contents[1],GRamp.contents[2],GRamp.contents[3]
##      
##
##time.sleep(2)





dac=(ctypes.c_ulong*2)(255)
dac[0]=0x02;
dac[1]=0x0F;





dacp=ctypes.pointer(dac)
IC=mydll.CP2114_SetDacRegisters(c.value,dacp,2)
print "IC status is "+str(IC)
##time.sleep(10)

Gdac=(ctypes.c_ulong*4)(255)
Gdacp=ctypes.pointer(Gdac)

DC=mydll.CP2114_GetDacRegisters(c.value,0x02,2,Gdacp)
print "DC status is "+str(DC)
print Gdacp.contents[0],Gdacp.contents[1]











Title: cs42l55
Post by: DVDdoug on 2014-02-04 17:18:51
There are some programmers here, but this isn't a programming forum.

(I do some programming, but I've never used Python and I don't know anything about that chip.)