Android 上的蓝牙控制信号(DTR、DSR、RTS、CTS) [英] Bluetooth control signals (DTR, DSR, RTS, CTS) on Android

查看:34
本文介绍了Android 上的蓝牙控制信号(DTR、DSR、RTS、CTS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 Android 通过蓝牙 SPP 远程重新编程我的 Arduino.第一步是复位 ATMEGA 微控制器.这是通过切换 DTR 线在 Arduino 上完成的.是否有任何 API 可以从 Android 环境中控制蓝牙 SPP 控制线?

I would like to remotely reprogram my Arduino via Android over Bluetooth SPP. The first step is to reset the ATMEGA microcontroller. This is accomplished on the Arduino by toggling the DTR line. Is there any API to control the Bluetooth SPP control lines from the Android environment?

推荐答案

一般 SPP 也支持发送或接收控制信号 (DTR, DSR, RTS, CTS) 我不知道任何 API 或库android 知道,但因为你只是想重置你的控制器...

Also it is supported by SPP in general to send or receive the control signals (DTR, DSR, RTS, CTS) I do not know any API or library for android right know, but as you just want to reset your controller...

如果没问题为了更改固件,您还可以创建自己的重置命令,该命令可以在您的 UART(通过 SPP)上接收.

If it is o.k. for you to change your firmware you can also create your own reset-command that can be received on your UART (over SPP).

如果您收到该命令,您可以调用类似

If you receive that command you could call something like

asm("jmp 0x3800");

您必须在其中修改 jmp-address 以指向您的引导加载程序.您可能还想更改中断向量以指向引导加载程序.

where you have to modify the jmp-address to point to your bootloader. You also might want to change your interrupt vector to point to your bootloader.

或者启用您的看门狗并调用

Or enable your watchdog and call

while(1);

这也会自动将中断向量更改为引导加载程序的中断向量并重置所有 SFR.- 但它有点慢,并且必须在熔丝位中选择引导加载程序的中断向量.

This will also automatically change the interrupt vector to the bootloader's interrupt vector and reset all SFRs. - But it is a little bit slower and the bootloader's interrupt vector must be choosen in the Fuse Bits.

这篇关于Android 上的蓝牙控制信号(DTR、DSR、RTS、CTS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆