Jump to content
  • 0

Unable to read Audio Code (SSM2603) registers on Zybo


Lincoln

Question

Hi All,

I am unable to read the registers on the Audio Code (SSM2603) on the Zybo board.

I have followed all the example code I can find (Zybo_base_system). I have built the hardware in Vivado and it all builds with no errors.

In Xilinx SDK I then create a modified C program using the code "audio_demo.c" as a reference.

The C code compiles with no errors and I load the hardware and software on the Zybo. I then use an external logic analyzer to probe the i2c signal to verify it.

All the write signals match up with the i2c format outlined in the Audio Code (SSM2603) datasheet. No errors are reported it the software either.

The problem happens when I perform a read (I want to read the Audio Code (SSM2603) register values). Using the external logic analyzer again I can see that the first part of the i2c signal matches but if fails after the second device write (no ACK is given). It then returns a value of 00010111b (or 23 in decimal). No matter what register I try and read it returns 00010111b (or 23 in decimal) with no ACK.

I have done everything I can think of to solve the problem but with no luck.

Any help would be great.

Thanks very much,

Lincoln

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Hello Lincoln,

I have been working through the audio codec and also have had problems reading register from the chip.  

So I started digging through the IP core to see what was going on.  It looks like there is some control scheme that prevents the user from reading all of the registers.  I'm not sure why this is.  Also, I am not sure if Digilent wrote the IP core of if ADI wrote the IP core.  

I am checking with some people at Digilent to see if I can find any kind of documentation for the IP core.

Marshall

Link to comment
Share on other sites

I know I'm a little bit out of date but i had the same problem to read register values from the SSM2603 via I2C. The solution I can suggest if you use the IIC of the PS is to set and clear the "XIICPS_REP_START_OPTION" bit. Setting this bit disables sending the STOP bit after the device and register address write sequence.

I used the following code to read the register values:

u16 AudioReadFromReg(u8 u8RegAddr) {

    unsigned char u8RxData[2];
    unsigned char u8TxData[1];
    s32 status;

    u8TxData[0] = u8RegAddr << 1;    //register address is 7 bit

    // disable sending STOP bit, 7-bit address mode
    XIicPs_SetOptions(&Iic, XIICPS_REP_START_OPTION | XIICPS_7_BIT_ADDR_OPTION);

    status = XIicPs_MasterSendPolled(&Iic, u8TxData, 1, IIC_SLAVE_ADDR);
    if (status != XST_SUCCESS) {
        xil_printf("IIC write to address 0x%08x failed\r\n",u8TxData);
    }

    XIicPs_ClearOptions(&Iic, XIICPS_REP_START_OPTION);    //enable sending STOP bit after data transfer
    status = XIicPs_MasterRecvPolled(&Iic, u8RxData, 2, IIC_SLAVE_ADDR);
    if (status != XST_SUCCESS) {
            xil_printf("IIC read from address 0x%08x failed\r\n",u8TxData);
    }
    while(XIicPs_BusIsBusy(&Iic)); // Wait for I2C to finish
    u8RxData[1] &= 0x01;
    return (u16) ( (u8RxData[1] << 8) | u8RxData[0] );
}

 

Alex

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...