Arduino与RDA5807M调试

       最近使用基于LGT8F328P-LQFP48MiniEVB调试RDA5807M模块,发现无法接收播放调频广播。

开发板如图:

 RDA5807M模块转接板原理图

 转接板模块PCB图。

基于Arduino的代码

需安装的库

/*
   Test and validation of the circuit.
   This sketch will check the I2C communication bus and try to tune the receiver on a given frequency.
 
   ATTENTION:  
   Please, avoid using the computer connected to the mains during testing. Used just the battery of your computer. 
   This sketch was tested on ATmega328 based board. If you are not using a ATmega328, please check the pins of your board.

   The main advantages of using this sketch are: 
    1) It is a easy way to check if your circuit is working;
    2) You do not need to connect any display device to make your radio works;
    3) You do not need connect any push buttons or encoders to change volume and frequency;
    4) The Arduino IDE is all you need to check your circuit.  
   
    By Ricardo Lima Caratti, 2020.
*/

#include <RDA5807.h>
#define FIX_STATION 10340 //8860  9350 9000  8990  9790  10520 10340
RDA5807 rx; 

void setup() {

  Serial.begin(115200);
  while(!Serial);

  delay(500);
  


  if (!checkI2C())
  {
      Serial.println("\nCheck your circuit!");
      while(1);
  }


  rx.setup();
  rx.setVolume(8);  

  
   delay(500);
  // //****
  Serial.print("\nEstacao 106.5MHz");
  rx.setFrequency(FIX_STATION); // The frequency you want to select in MHz multiplied by 100.
  
  Serial.print("\nCurrent Channel: ");
  Serial.print(rx.getRealChannel());
  delay(500);

  Serial.print("\nReal Frequency.: ");
  Serial.print(rx.getRealFrequency());
  
  Serial.print("\nRSSI: ");
  Serial.print(rx.getRssi());

  
  // Mute test
  Serial.print("\nAfter 5s device will mute during 3s");
  delay(5000);
   rx.setMute(true);
  delay(3000);
  rx.setMute(false);
  Serial.print("\nMute test has finished.");

  
  Serial.print("\nEstacao 106.5MHz");
  rx.setFrequency(FIX_STATION);
  delay(1000);

  
  // // Seek test
  // Serial.print("\nSeek station");
  // for (int i = 0; i < 10; i++ ) { 
  //   rx.seek(1,0);
  //   Serial.print("\nReal Frequency.: ");
  //   Serial.print(rx.getRealFrequency());
  //   delay(5000);
  // }
  
  
}

void loop() {

 

}

/**
 * Returns true if device found
 */
bool checkI2C() {
  Wire.begin();
  byte error, address;
  int nDevices;
  Serial.println("I2C bus Scanning...");
  nDevices = 0;
  for(address = 1; address < 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.print("\nI2C device found at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
      nDevices++;
    }
    else if (error==4) {
      Serial.print("\nUnknow error at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
    return false;
  }
  else {
    Serial.println("done\n");
    return true;
  }
}

 程序下载后通过串口监视器获取如下数据:

  串口数据输出就停留在done处,耳机没有任何声音。开始以为I2C通讯问题,其实不是。后来更换成LQFP32开发板,RDA5807M模块正常工作,耳机有音频输出。注意红圈处是3.3V电压输出。RDA5807M工作电压在1.8到3.3V之间。庆幸的是模块居然没有被烧坏。

         后来查找原因发现是开发板电压与RDA模块电压不一致导致不能接收广播。原先的LQFP48开发板只有5V电压没有3.3V,其上的LDO是5V的。

       正常的串口监视器输出数据:

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

armcsdn

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值