I cant get this PGA2310 chip to work

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

I have been working on a preamp using a PIC 16F877 and a PGA2310 but with no luck.
I cannot get the volume to work properly for the PGA2310.

I have been using the SPI port to send the 16 bits to the chip. The first 8 bits are fine but the second 8 bits get messed up. I think I have timing issues. I tried waiting till the first SPI transfer was done (checking PR1 register bit 3 for a '1') and then sending the other 8 bits, but the wait was too long. Then I tried adding 'nop' instructions instead of checking the PR1 register, this was a little better with two 'nop' instructions but still no good.

Can anyone point me in the right direction as to how to get this thing working??



Thanks,
Lawrence



BTW- I program in assembly
 
what you have to do send 16 bits of data to PGA is define variables as:
one variable containing data of both channels as word byte
one variable defined as byte containing data of left channel
one variable defined as byte containing data of right channel
when you want to shift data to PGA transfer word variable and you ll be able to operate both channels.
Right now I am working on two different version of pre around PIC and PGA myself one isa simple version and other is a high end one.
I have got the board (made in my own fabrication unit).
Here is the PIC of the simple version pre board ( I ve got 6 each)
Hopefully you ll be able to control both channels if you still have problems let me know and I ll try to help.....
 

Attachments

  • simplepre.jpg
    simplepre.jpg
    78.6 KB · Views: 452
I dont understand how to do all that you have suggested.
How do I define a word byte.
As far as I know the PIC only can handle 1 byte (8 bits) variable.

I do have a 8 bit variable which keeps the volume level data, what do I do with it?
Sending it twice does not work. If I send it once how do I know how long to wait before I send the other?
 
I have tried the following but it does not work:

movw SSPBUF
movw SSPBUF


I have also tried the following but it does not work either:

movw SSPBUF
write_again
btfss PIR1, 3
goto write_again
movw SSPBUF

Does anyone have any ideas or suggestions?


Thanks
Lawrence
 
Must be possible... Mark Hennessy used this controller in his Preamp which is the same thing, pretty much.

Would need to see your setup code to comment further. Only thing I can think is that the MSSP is not set up right. You should just be able to assert the PGA2310's chip select, send two 8-bit values out through SPI consecutively, and unassert it.
 
_vol_r equ _vol
_vol_l equ _vol + 001h
_vol_byte0 equ _vol
_vol_byte1 equ _vol + 001h

_shift_l equ 00018h
_shift_r equ 0001ch


label?l _shift
Low?t _cs
pauseus?C 064h
shiftdata?t _sdi
shiftclock?t _sclk
shiftmode?C 005h
shiftout?wc _vol, 010h
High?t _cs
pauseus?C 064h
High?t _sdi
Return?

Hope it helps, otherwise share your schematics I may be able to help you, or may be send a pre-programmed PIC-MCU based on your schematics.
Must be possible... Mark Hennessy used this controller in his Preamp which is the same thing, pretty much.
not must be possible it is very much possible. Google around and you may found lots of projects build around PIC MCU and PGAs, only catch is not every one is willing to share his firmware. There was one project build around PGA and PIC in elector as well.
 
As far as I remember PIC just can't tranfer data too fast, as PGA2310 cant recieve. The most probable problem is chip select (CS) signal. If you use fully hardware SPI the PIC's SPI controller changes CS during every transaction, so PGA2310 sees only one byte. The most common solution is conecting PGA's CS pin to PIC's general purpuse pin and manual CS control.
If you do this way you should go the following steps:
1- Set active CS (on GPIO)
2- Send first byte
3- Send second byte
4- Set inactive CS
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.