Need help!! with PCM1738 and uP code

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Welcome.

I have a big problem with PCM1738 and control program. I am using Atmel ATmega 8535. The software ,I have is Bascom AVR.
In program I use SPI-hardware. This is an example of my code:

"Config Spi = Hard , Interrupt = On , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4

Dim Reg18a As Byte
Dim Reg18b As Byte
Reg18a = &B00010010
Reg18b = &B10110001

Spiinit
Spiout Reg18a , 1
Spiout Reg18b , 1
"
This is a main idea of course.
I tried many ways, but it does not work. I also have PGA2310 and the similar code works great. In code below i try to mute PCM1738. The main idea is to change attenuation and many useful option.


Please help me
 

Attachments

  • image001.jpg
    image001.jpg
    71.7 KB · Views: 599
Hi Audiopower -

Register 18 in the PCM1738 wants a 16 bit word, which you are sending to it as two bytes. I think Bascom deasserts the SS line, which I assume you are using as the PCM's CS, after each SPIOUT instruction. I'm only guessing here, but if the PGA uses its CS going high to load its shift register into its internals, then it would happen after only 8 bits.

Maybe it would work if you put reg18a and b into a two byte array, and do an SPIOUT reg18(1),2 ?

On the other hand, the PGA2310 definitely uses CS in this way, as you can daisy chain several together, and send 16 x number of chips clocks. So maybe I'm wrong.

Brian
 
Thank you very much " Bee"
You have right.Today when i have read your reply i changed the code. I used your guideline , built array and sent data with array to PCM1738. Apparently Bascom deasserts the SS line after SPIOUT instruction. Now it works. I am listening an audio now. Thank you very much for your advice. But as you noticed the pga datasheet is similar to PCM1738 in Serial control of course. In PGA when i send 8 bits for right channel then 8 bits for left , it works,unimportant.

I am very happy. Now I can change attenuation and turn on monural mode operation !!!!!!!!!!!!. When i have finished my DAC i will post photos.

Once again THANK YOU
 
Just returned after two weeks in France.

Glad it works. I think what happens in the PGA 2310 is this: you send first the left channel data, SPIOUT deasserts CS, and it is loaded into the right hand register, which is probably wrong. You then send the right channel data, this slides the left data across 8 bits, SPIOUT deasserts CS again, and the correct data is now loaded into the left and right register. It's so fast you don't hear the glitch. So it works. In the PCM1738, one byte is a pointer to the register that the second byte has to be loaded into. So it's not surprising that bits fly in all the wrong directions!

I look forward to seeing how you get on. I too am playing with these chips, and as you have guessed I too admire Bascom.
 
Welcome

Sorry that I don't respond so long. I was just very busy.
I have finished my dac at last. There is only inscription to do on my chassis. I think that silk-screen printing will be a good idea.I post you some photo. Tell me what do you think about it.


Audiopower

(If you don't measure you don't know :) )
 

Attachments

  • img_4029_resize.jpg
    img_4029_resize.jpg
    72.6 KB · Views: 235
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.