- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试使用运行 Angstrom(3.8 内核)的 Beaglebone Black 与位于 9600-N-8-1 的半双工 RS-485 网络上的设备进行通信。
我正在尝试使用与此类似的 RS-485 分线板:https://www.sparkfun.com/products/10124 ,除了芯片是MAX3485http://www.maximintegrated.com/datasheet/index.mvp/id/1079 .我购买了预先组装有引脚和端子条的电路板。我的一个 friend 用示波器对其进行了测试,并声称 RS-485 板确实可以工作。该板有五个连接到 BBB 的引脚。 3-5V(电源)、RX-I、TX-O、RTS 和 GND。
我在 BBB 上禁用了 HDMI 支持,以便 UART4_RTSn
和 UART4_CTSn
引脚将可用。
mkdir /mnt/boot
mount /dev/mmcblk0p1 /mnt/boot
nano /mnt/boot/uEnv.txt
#change contents of uEnv.txt to the following:
optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
/*
* Modified version of /lib/firmware/BB-UART4-00A0.dtbo to add RTS so we can reset Arduinos
*/
/dts-v1/;
/plugin/;
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
part-number = "BB-UART4-RTS";
version = "00A0";
exclusive-use = "P9.13", "P9.11", "P9.15", "P8.33", "P8.35", "uart4";
fragment@0 {
target = <0xdeadbeef>;
__overlay__ {
pinmux_bb_uart4_pins {
pinctrl-single,pins = <
0x070 0x26 /* P9_11 = UART4_RXD = GPIO0_30, MODE6 */
0x074 0x06 /* P9_13 = UART4_TXD = GPIO0_31, MODE6 */
/* need to enable both RTS and CTS, if we only turn on RTS then driver gets confused */
0x0D0 0x26 /* P8_35 = UART4_CTSN = lcd_data12, MODE6 */
0x0D4 0x06 /* P8_33 = UART4_RTSN = lcd_data13, MODE6 */
/* 0x040 0x0F /* P9_15 = GPIO1_16 = GPIO48, MODE7 failed attempt to put DTR on gpio */
>;
linux,phandle = <0x1>;
phandle = <0x1>;
};
};
};
fragment@1 {
target = <0xdeadbeef>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <0x1>;
};
};
__symbols__ {
bb_uart4_pins = "/fragment@0/__overlay__/pinmux_bb_uart4_pins";
};
__fixups__ {
am33xx_pinmux = "/fragment@0:target:0";
uart5 = "/fragment@1:target:0"; /* Not a mistake: UART4 is named uart5 */
};
__local_fixups__ {
fixup = "/fragment@1/__overlay__:pinctrl-0:0";
};
};
cd /lib/firmware
dtc -O dtb -o BB-UART4-RTS-00A0.dtbo -b 0 -@ BB-UART4-RTS-00A0.dts
echo BB-UART4-RTS:00A0 > /sys/devices/bone_capemgr.*/slots
3-5V to P9_05 (VDD_5V)
RX-I to P9_13 (UART4_TXD)
TX-O to P9_11 (UART4_RXD)
RTS to P8_33 (UART4_RTSn)
GND to P9_01 (DGND)
import serial
ser = serial.Serial('/dev/ttyO4', baudrate=9600, rtscts=True)
ser.write(list_of_byte_dat)
/dev/ttyUSB0
上使用 USB 到 RS-485 转换器时并设置
rtscts=False
双向通信都很好。但是我无法使用 RS-485 板使通信正常工作。
Temporary solution: I've made a small bone script program that uses UART4_RTSn pin as input. It turns on a different GPIO when the UART4_RTSn pin is off and turns off that same GPIO pin when the UART4_RTSn pin is on. Then hooked up the RTS pin on the rs485 board to the GPIO pin instead of the UART4_RTSn pin.
/dev/ttyO4
时在正确的时间开启。从命令行。UART4_RTSn
的极性通过调整硬件配置或通过更改pyserial中的配置来固定?UART4_RTSn
当像这样向 tty 端口回显值时,pin 将自动(但向后)为我工作:echo -en '\x02\xFD\xCD......' > /dev/ttyO4
UART4_RTSn
正在传输数据时 LED 闪烁。如果我在没有上面提到的骨骼脚本的情况下设置它,那么它会正常打开并在传输时闪烁。如果我使用我的 bonescript hack 那么它会正常关闭并在传输时闪烁(这是我想要的)。但是,这仅在从命令行使用 echo 时有效。当我使用 python 并设置串口时 UART4_RTSn
引脚变为非事件状态。传输时不会闪烁。一旦我在 python 中声明:ser = serial.Serial('/dev/ttyO4', baudrate=9600, rtscts=True)
UART4_RTSn
销关闭并保持关闭。使用ser.write(stuff)
发送信息时不闪烁.因此,rs485 板无法进行传输。我如何获得 UART4_RTSn
pin在pyserial中自动工作?我试过设置 rtscts=False
它没有用。ser.setRTS(True)
或 ser.setRTS(False)
手动切换 pin 值,以便我知道我使用的是正确的 pin 并且它正在被识别。但我不想直接切换 UART4_RTSn 引脚。我希望它在串行端口传输数据时自动工作,并且在使用 echo 时自动工作,但在 Python 中不工作。 最佳答案
RTS 通常是低电平有效信号,我怀疑您看到数据通过 echo
传输的原因是它不使用 RTS/CTS(保持高位),因此只能传输数据。
根据 http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=29408 上的帖子
If you enable hardware flow control (CRTSCTS in "man termios", or "stty crtscts -F /dev/ttyAMA0", or pySerial rtscts=True), then sending will take place only when CTS is asserted. RTS will be asserted except when the kernel input buffer is full. The kernel input buffer is about one page or 4KB, so your application has to get well behind with its reads before RTS actually changes.
rtscts=False
)并使用
setRTS(1)
手动控制 RTS之前写和
setRTS(0)
然后。
关于使用 Beaglebone Black Angstrom 通过半双工 RS-485 分线板实现自动 RTS 的 Python PySerial,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21148655/
来自 JSR-339: For simplicity, JAX-RS implementations are NOT REQUIRED to support processing groups oth
JAX-RS 提供了 StreamingOutput 接口(interface),我们可以实现它来对我们的响应主体进行原始流处理。 public interface StreamingOutput {
有没有办法获得java.lang.reflect.Method为给定的 @Path 调用的方法(用 HttpServletRequest 注释) ? 这是我的用例:我在 Java EE 中 Filte
我接到了一家公司的任务,该任务向我发送了一台已完成所有设置的虚拟机。任务是我必须创建一个 API 来从数据库中检索人员详细信息并显示它。 问题是,当我运行应用程序时,服务器返回一个包含 hello w
我有一个 POST 方法调用,它接受很少的表单参数。我希望 JAX-RS 能够处理不存在特定表单参数的情况。 示例: @POST @Produces (MediaType.APPLICATION_JS
我有 JAX-RS 网络应用程序,我想记录从获取请求到响应的时间量。在带有 servlet 过滤器的 Spring Boot 中很容易。但是我的应用程序中的过滤器无法正常工作: @Provider p
使用以下网址。 http://doma.in/context/resource/some/.../undefined 我想获取 ../resource 之后的路径名,即 /some/.../undef
Closed. This question is off-topic。它当前不接受答案。
我花了几个小时在嵌入式 Jetty 9.1.0.v20131115 和 RESTEasy 3.0.5.Final 中安装自定义登录服务。我的登录服务将在数据库中查找用户并为他们分配角色。它看起来像这样
RESOURCE_STALLS.RS的说明Intel Broadwell 的硬件性能事件如下: This event counts stall cycles caused by absence of
我想从 java 服务器 (Restful Jax-rs) 发送图像。我的客户是安卓。 @GET public Response getUserImage() { byte[] image =new
(特别是 RESTeasy) 具有如下方法签名会很好(对于单个文件): public void upload(@FormParam("name") ..., @FormParam("file") fi
RESTEasy (JAX-RS) 允许通过子资源进行动态调度。例如: POST /customers/create {"name":"Smith","country":"jp"} 我们可以有一个根资
假设有一个 ResultSet rs 和 n 对象。 这段代码: while(rs.next()) { // do something on rs } 在算法上等于此代码(即两者给出相同的结果)
我正在使用 Visual Studio 2005 和 mysql 4.0,我有一个表,其中包含一个字段(十进制 16,4),用于存储发票金额和另一个表,其中包含对该发票的付款(这些字段也是十进制的)
我正在使用 JAX-RS、Microprofile 和 Payara 5 构建 REST 服务。我的方法返回类型为 Response 的对象。响应本身包含一个 MyClass 列表。实现看起来像这样:
我已经使用 Mock MVC 成功地为 Spring MVC REST 服务构建了无需部署的集成测试框架。我正在努力对 JAX-RS 服务做同样的事情。 REST Assured 看起来很有希望,但它
我有一个使用JAX-RS 2.0的Jersey实现的Java应用程序,并且我想在客户端启用gzip压缩。服务器已启用它,并且通过在Chrome中的开发人员工具中的“大小/内容”中查找客户端正在使用的特
我正在尝试与 Tomcat7 一起使用 RESTful Web 服务 (JAX-RS)。我尝试了 3 种不同的实现(Jersey、RESTeasy 和 ReSTLet),但都没有成功。这应该很容易,但
swagger-api有什么区别和 JAX-RS ? 是swagger-api仅用于文档? (例如 @ApiOperation ) 最佳答案 根据 API 文档,JAX-RS是用于 RESTful W
我是一名优秀的程序员,十分优秀!