无法在Arduino屏蔽上打开Sigfox UART(Cannot switch on Sigfox UART on Arduino shield)

编程入门 行业动态 更新时间:2024-10-25 20:25:33
无法在Arduino屏蔽上打开Sigfox UART(Cannot switch on Sigfox UART on Arduino shield)

我想让Arduino Uno通过Sigfox发送数据。 使用Libelium Xbee Shield和Sigfox模块为Arduino(烹饪黑客)。 我尝试使用Arduino库中的示例发送一个字符串。 Arduino草图很简单:

#include <Wire.h> // Cooking API libraries #include <arduinoClasses.h> #include <arduinoUART.h> #include <arduinoUtils.h> #include <arduinoSigfox.h> // Pin definition for Sigfox module error LED: const int error_led = 13; ////////////////////////////////////////////// uint8_t socket = SOCKET0; //Asign to UART0 ////////////////////////////////////////////// uint8_t error; void setup() { Serial.begin(9600); pinMode(error_led, OUTPUT); ////////////////////////////////////////////// // 1. switch on ////////////////////////////////////////////// error = Sigfox.ON(socket); // Check status if( error == 0 ) { //"Switch ON OK" digitalWrite(error_led, LOW); Serial.println("Sigfox Switch ON -> SUCCES"); } else { //"Switch ON ERROR" digitalWrite(error_led, HIGH); Serial.println("Switch Switch ON -> FAILED"); } ////////////////////////////////////////////// // 2. send data ////////////////////////////////////////////// // Send 12 bytes at most error = Sigfox.send("000102030405060708090A0B"); // Check sending status if( error == 0 ) { //"Sigfox sending -> SUCCES" digitalWrite(error_led, LOW); Serial.println("Sigfox sending -> FAILED"); } else { //"Sigfox packet sent ERROR" digitalWrite(error_led, LOW); Serial.println("Sigfox packet sent ERROR"); } } void loop() { ////////////////////////////////////////////// // 3. sleep ////////////////////////////////////////////// }

串口的输出如下:

AT Sigfox Switch ON -> FAILED AT$SF=000102030405060708090A0B Sigfox sending -> FAILED

Sigfox模块和主板之间的连接似乎没问题,因为Sigfox.getID()正在工作,并且检索到正确的ID。 此外,在Sigfox平台上订阅设备似乎还可以。

我该怎么调试呢? 我不知道如何开始诊断:图书馆中有什么东西? 什么东西在发送? 硬件中有什么东西? 对此的所有帮助表示赞赏。

I am trying to get an Arduino Uno to send data via Sigfox. Using a Libelium Xbee Shield and Sigfox Module for Arduino (Cooking Hacks). I tried to send a string using the example found in the Arduino library. The Arduino sketch is simple:

#include <Wire.h> // Cooking API libraries #include <arduinoClasses.h> #include <arduinoUART.h> #include <arduinoUtils.h> #include <arduinoSigfox.h> // Pin definition for Sigfox module error LED: const int error_led = 13; ////////////////////////////////////////////// uint8_t socket = SOCKET0; //Asign to UART0 ////////////////////////////////////////////// uint8_t error; void setup() { Serial.begin(9600); pinMode(error_led, OUTPUT); ////////////////////////////////////////////// // 1. switch on ////////////////////////////////////////////// error = Sigfox.ON(socket); // Check status if( error == 0 ) { //"Switch ON OK" digitalWrite(error_led, LOW); Serial.println("Sigfox Switch ON -> SUCCES"); } else { //"Switch ON ERROR" digitalWrite(error_led, HIGH); Serial.println("Switch Switch ON -> FAILED"); } ////////////////////////////////////////////// // 2. send data ////////////////////////////////////////////// // Send 12 bytes at most error = Sigfox.send("000102030405060708090A0B"); // Check sending status if( error == 0 ) { //"Sigfox sending -> SUCCES" digitalWrite(error_led, LOW); Serial.println("Sigfox sending -> FAILED"); } else { //"Sigfox packet sent ERROR" digitalWrite(error_led, LOW); Serial.println("Sigfox packet sent ERROR"); } } void loop() { ////////////////////////////////////////////// // 3. sleep ////////////////////////////////////////////// }

The output on Serial port is the following:

AT Sigfox Switch ON -> FAILED AT$SF=000102030405060708090A0B Sigfox sending -> FAILED

Connection between the Sigfox module and the board seems to be OK, because Sigfox.getID() is working, and the correct ID is retrieved. Also subscription of the device on the Sigfox platform seems to be OK.

How can I debug this? I have no idea how to start a diagnosis: something in the libraries? something in the sending? something in the hardware?. All help on this is appreciated.

最满意答案

请仔细检查Arduino TX是否连接到Sigfox RX,Arduino RX连接到Sigfox TX另外,模块在引脚1上有VCC,在引脚9上有GND。如果它仍然不起作用,可能是因为有其他东西连接到RX和TX线。 去掉它。 Personnaly,我在这些行上放了一个逻辑分析器来检查对话框。 对于“ON”:发送AT \ r \ n,并回答“OK \ r \ n”。

希望这可以帮助

The problem was relatively simple to solve. It turns out that it is not possible to run the combination Arduino/Xbee/Sigfox with the serial cable connected (I used it for power, and for sending debugging info to my computer). All I had to do was:

put switch to USB upload new code via serial cable unplug the serial cable put switch to Xbee power the arduino via the 12V jacket (or other power input)

Then it works.

更多推荐

本文发布于:2023-07-30 21:52:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1340310.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:屏蔽   Sigfox   Arduino   shield   switch

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!