Am-PCB 发表于 2013-2-2 11:15:18

SI4432 接收数据 好像有问题,不知道是什么原因?

本帖最后由 Am-PCB 于 2013-2-2 11:47 编辑

现附上程序问题详述:第一次循环后,NIRQ的值就变为1(对应的NIRQ引脚电平为高)而不会再变为0,不会再进入if,也就是说只接收一次数据。困惑。。。
while(1)
      {      
                if( NIRQ == 0 )
                {         
                        //NIRQ = 1;
                        //disable the receiver chain
                        SpiWriteRegister(0x07, 0x01); //write 0x01 to the Operating Function Control 1 register
                        //read interrupt status registers
                        ItStatus1 = SpiReadRegister(0x03);                                                                                                //read the Interrupt Status1 register
                        ItStatus2 = SpiReadRegister(0x04);                                                                                                //read the Interrupt Status2 register
                                                
                        if((ItStatus1 & 0x02) == 0x02)
                         {         //ItStatus1 = SpiReadRegister(0x03);                                                                              //read the Interrupt Status1 register
                                 //      ItStatus2 = SpiReadRegister(0x04);                                                                              //read the Interrupt Status2 register
                                                               
                                  //Read the length of the received payload
                                 length = SpiReadRegister(0x4B);                                                                                          //read the Received Packet Length register
                                 //check whether the received payload is not longer than the allocated buffer in the MCU
                                 //Get the received payload from the RX FIFO
                                        for(temp8=0;temp8 < length; temp8++)
                                        {
                                                payload = SpiReadRegister(0x7F);                                                                //read the FIFO Access register
                                        }
                                        for(i=0;i<length;i++)
                                        {
                                                rd1 = payload;
                                                rd1 = rd1<<1;
                                        }               
                                                                                                                     
                                 //check whether the acknowledgement packet received
                                 successful_flag = 1;
                               timeout=0; //check whether an expected packet received, this should be acknowledged
                                 //}
                                 //if( length == 8 )
                               //{         
                                        if(successful_flag)
                                        {            
                                                led1();   
                                          //lcd_printf_string("      ", ROW(0x00)|LEN(0x08)|COL(0x00));
                                                //lcd_printf_string("ok      ", ROW(0x01)|LEN(0x08)|COL(0x00));                        
                                        }
                                        else
                                        {
                                                //lcd_printf_string("      ", ROW(0x00)|LEN(0x08)|COL(0x00));
                                                //lcd_printf_string("fail    ", ROW(0x01)|LEN(0x08)|COL(0x00));
                                        }
                                        rd = AdpcmDecode(rd1);
                                 //}
                  }      
                        //reset the RX FIFO
                     SpiWriteRegister(0x08, 0x02);                                                                                                      //write 0x02 to the Operating Function Control 2 register
                  SpiWriteRegister(0x08, 0x00);                                                                                                      //write 0x00 to the Operating Function Control 2 register
                        //enable the receiver chain again
                        SpiWriteRegister(0x07, 0x05);                                                                                                      //write 0x05 to the Operating Function Control 1 register
                }               
      }      

mute 发表于 2013-7-18 15:02:07

你好,请问这个问题能不能给点提示呢?
我也碰到了类似情况。楼主解决了吗?
我用中断方式接收的,进入 【包有效中断】0x02 ,收取数据包,重新设置寄存器0x07为 XTON | RX 模式(0x05)。但是经常就停止接收了。

后来在主循环里,一直轮询这个模式寄存器,发现中断设置成0x05后(中断里设置后05后,再读取,确认是0x05,正常的),在主循环里轮询会发现有一半几率会从自动从0x05变回0x01。
看手册里是只有【包有效中断】才会变回0x01。

Am-PCB 发表于 2013-7-18 15:55:22

mute 发表于 2013-7-18 15:02 static/image/common/back.gif
你好,请问这个问题能不能给点提示呢?
我也碰到了类似情况。楼主解决了吗?
我用中断方式接收的,进入 【 ...

这个问题最后貌似解决了,因为这个是帮同学做的,后来就交给他本人处理了,加上时间太长,至于问题到底出在哪里确实记不清了,不过当时好像是加了一段LED程序,放在原来程序不同的位置之处,来判断哪里没执行到,再有针对性地修改,是这样做的。没帮到你,非常不好意思,功能强大的芯片往往不太容易控制,希望你能早日解决问题!!!

喷嚏成风 发表于 2013-7-19 14:49:12

唉,我连初始化都看不懂

金美祖 发表于 2013-9-1 17:30:12

现在我也也是貌似这样的问题,IRQ脚跟不上节拍,

Am-PCB 发表于 2013-9-1 22:06:50

功能强大的芯片往往不容易控制,多点耐心,一定能做出来。

豆豆上将 发表于 2013-9-10 16:37:06

楼主解决了吗?

pen245760036 发表于 2014-5-6 15:05:49

{:sad:} 也在研究这个问题中
页: [1]
查看完整版本: SI4432 接收数据 好像有问题,不知道是什么原因?