cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
132 Views
Registered: ‎08-06-2019

Petalinux 2019.1 app for Si5382 programming on the ZCU111

Dear all:

I want to create an app for  Si5382 programming on the ZCU111  board,but have some issues:

1.In the ug1271-zcu11 Table 3-6, SI5382 Target Device Address is defined 0x68,figure 1

   but in the zcu111-reva.dtsi,si5328 is defined as 0x69:

i2c@4 { /* i2c mw 74 0 10 */
 #address-cells = <1>;
 #size-cells = <0>;
 reg = <4>;
 si5328: clock-generator4@69 { /* SI5328 - u48 */
 compatible = "silabs,si5328";
 reg = <0x69>;
 };

https://github.com/Xilinx/device-tree-xlnx/blob/master/device_tree/data/kernel_dtsi/2018.1/BOARD/zcu111-reva.dtsi

  I want to know are si5382 and si5328 the same device?

  If I want to access si5382, is it correct to modify 

   si5328: clock-generator4@ 69  to  clock-generator4@ 68

 

2.I use clock builder to generate a header file to program SI5382,the program code list below ,but I can't observe SI5382_SDA,SI5382_CLK , is the program code have any issue?  

#define XIIC_BUS1 12

#define SI5382_ADDR (0x68)

int Si5382Init()
{

int i;
char XIicDevFilename[20];
unsigned char tx_array[3];

sprintf(XIicDevFilename, "/dev/i2c-%d", XIIC_BUS1);
XIicDevFile = open(XIicDevFilename, O_RDWR);

if (ioctl(XIicDevFile, I2C_SLAVE_FORCE, SI5382_ADDR) < 0) {
printf("Error: 5382 IIC Could not set address \n");
return FAIL;
}

for(i=0;i<3;i++)
{
tx_array[0]=(si5382a_reve_registers[i].address)>>8 & (0x00ff);
tx_array[1]=(si5382a_reve_registers[i].address)& (0x00ff);
tx_array[2]= si5382a_reve_registers[i].value;
WriteSI5382Data(tx_array,3);

}
sleep(1);

for(i=3;i<SI5382A_REVE_REG_CONFIG_NUM_REGS;i++)
{
tx_array[0]=(si5382a_reve_registers[i].address)>>8 & (0x00ff);
tx_array[1]=(si5382a_reve_registers[i].address)& (0x00ff);
tx_array[2]= si5382a_reve_registers[i].value;
WriteSI5382Data(tx_array,3);
}

printf("5382 configure done \n");
//IO_Update();
ReadSI5382Reg();
close(XIicDevFile);

}

static unsigned char WriteSI5382Data(unsigned char WriteBuffer[], unsigned char NoOfBytes)
{
unsigned char BytesWritten=0; /* Number of Bytes written to the IIC device. */

BytesWritten = write(XIicDevFile, WriteBuffer, NoOfBytes);

usleep(100);

return BytesWritten;
}

Thanks a lot

    

 

 

 

 
 

 

 

 

 

0 Kudos