/*************************************
ADC Register Settings
Block Name Register Name Data Register Address
AFE4490 CONTROL0 0 0
AFE4490 LED2STC 1770 1
AFE4490 LED2ENDC 1F3E 2
AFE4490 LED2LEDSTC 1770 3
AFE4490 LED2LEDENDC 1F3F 4
AFE4490 ALED2STC 0 5
AFE4490 ALED2ENDC 7CE 6
AFE4490 LED1STC 7D0 7
AFE4490 LED1ENDC F9E 8
AFE4490 LED1LEDSTC 7D0 9
AFE4490 LED1LEDENDC F9F A
AFE4490 ALED1STC FA0 B
AFE4490 ALED1ENDC 176E C
AFE4490 LED2CONVST 2 D
AFE4490 LED2CONVEND 7CF E
AFE4490 ALED2CONVST 7D2 F
AFE4490 ALED2CONVEND F9F 10
AFE4490 LED1CONVST FA2 11
AFE4490 LED1CONVEND 176F 12
AFE4490 ALED1CONVST 1772 13
AFE4490 ALED1CONVEND 1F3F 14
AFE4490 ADCRSTSTCT0 0 15
AFE4490 ADCRSTENDCT0 0 16
AFE4490 ADCRSTSTCT1 7D0 17
AFE4490 ADCRSTENDCT1 7D0 18
AFE4490 ADCRSTSTCT2 FA0 19
AFE4490 ADCRSTENDCT2 FA0 1A
AFE4490 ADCRSTSTCT3 1770 1B
AFE4490 ADCRSTENDCT3 1770 1C
AFE4490 PRPCOUNT 1F3F 1D
AFE4490 CONTROL1 101 1E
AFE4490 SPARE1 0 1F
AFE4490 TIAGAIN 0 20
AFE4490 TIA_AMB_GAIN 0 21
AFE4490 LEDCNTRL 1BEBE 22
AFE4490 CONTROL2 0 23
AFE4490 SPARE2 0 24
AFE4490 SPARE3 0 25
AFE4490 SPARE4 0 26
AFE4490 RESERVED1 0 27
AFE4490 RESERVED2 0 28
AFE4490 ALARM 0 29
AFE4490 LED2VAL 0 2A
AFE4490 ALED2VAL 0 2B
AFE4490 LED1VAL 0 2C
AFE4490 ALED1VAL 0 2D
AFE4490 LED2-ALED2VAL 0 2E
AFE4490 LED1-ALED1VAL 0 2F
AFE4490 DIAG 0 30
*************************************/
按照上面的寄存器内容配置成功后 读出来的寄存器内容也是正确的 但是ADC_RDY无脉冲输出,该芯片的TXN和TXP端是不是应该输出脉冲信号?如何判断芯片出入工作状态了?
Nick Dai:
Hi Kuang,
你用的是开发板?
你可以参考一下开发板的使用指南。
kuang kuang:
回复 Nick Dai:
自己布的板子 这款芯片只需要配置寄存器就好了么?可是配置好寄存器后板子没有反应
Xiaopeng Wang:
回复 kuang kuang:
请问是哪个时钟使能配置寄存器?我没找到
yu fan1:
回复 Xiaopeng Wang:
你好啊!!我最近也在用这颗芯片做毕业设计~~板子也是自己画的,然后我自己写了SPI的程序后读写寄存器没有成功,因为读出来的数据一直是0。
我现在不知道是我的硬件有问题还是程序有问题,所以可不可以给你读写寄存器的程序我参考一些啊。。。。。或者我们可以讨论一下。万分感谢啊,,,,,
我再贴上我的程序,能帮我看看有什么问题么
//spi WRITE a byte.void SPI_WRITE_BYTE(int data){ int i; for(i=0;i<8;i++){ if(data&0x80)SIMO->DATA=1; else SIMO->DATA=0; usleep(10); //set up time SCLK->DATA=1; data<<=1; usleep(10); //hold time SCLK->DATA=0; }}
//SPI read a bytechar SPI_READ_BYTE(){ int i; char data; data=0; for(i=0;i<8;i++){ data<<=1; SCLK->DATA=1; usleep(10); data |=SOMI->DATA;// printf("the SOMI is %d \n",SOMI->DATA); SCLK->DATA=0; usleep(10); } SIMO->DATA=0; return(data);}
//addr is a byte,but value is a 24-bit datavoid SPI_WRITE_REG(int addr,int value){ int value1,value2; STE->DATA=0; usleep(1); SPI_WRITE_BYTE(addr); printf("The written addr is %d \n",addr); value1=value>>16; printf("value1 is %d \n",value1); SPI_WRITE_BYTE(value1); value2=value>>8; printf("value2 is %d \n",value2); SPI_WRITE_BYTE(value2); printf("value is %d \n",value); SPI_WRITE_BYTE(value); usleep(1); STE->DATA=1;}
//READ THE REGISTERint SPI_READ_REG(int addr){ int value=0; STE->DATA=0; usleep(1); SPI_WRITE_BYTE(addr); printf("the read addr is %d \n",addr); value |=SPI_READ_BYTE(); printf("the 1 read value is %d \n",SPI_READ_BYTE()); value<<=8; printf("the 2 read value is %d \n",value); value |=SPI_READ_BYTE(); printf("the 3 read value is %d \n",SPI_READ_BYTE()); value<<=8; printf("the 4 read value is %d \n",value); value |=SPI_READ_BYTE(); printf("the 5 read value is %d \n",SPI_READ_BYTE()); usleep(1); STE->DATA=1; return(value);}
chenghao fan:
请问下你哪个问题解决了吗?
chenghao fan:
回复 kuang kuang:
请问下是那个寄存器?
kuang kuang:
回复 chenghao fan:
PRPCOUNT中的Bit D8 时钟使能
chenghao fan:
回复 kuang kuang:
你好 这是PRPCOUNT寄存器的介绍?PRPCOUNT[15:0] ;The contents of this register can be used to set the pulse repetition period (in number of clock cycles of the 4-MHz clock). The PRPCOUNT value must be set in the range of 800 to 64000. Values below 800 do not allow sufficient sample time for the four samples; see the Electrical Characteristics table.
kuang kuang:
回复 chenghao fan:
sorry,看错行了,PRCOUNT的下一个寄存器CONTROL1的D8