logo

串口发送有问题

2018-03-31 21:33
Y
_15004226107

请问我在做串口发送的时候tx一直是高电平,用的例程,是硬件问题吗?rx没有问题

2018-03-31 23:37
I
网红小智智 星瞳科技

- 程序是什么?需要贴出来。

- 你是怎么确定tx一直是高电平?用示波器还是usb转串口模块?

2018-04-01 09:27
Y
_15004226107

我用的例程,波形是用示波器测的

2018-04-01 09:45
I
网红小智智 星瞳科技

- 把具体的代码贴出来

- 你确定没有测量错引脚?

2018-04-01 13:45
Y
_15004226107

# Hello World Example

#

# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!

import sensor, image, time

sensor.reset() # Reset and initialize the sensor.

sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)

sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)

sensor.skip_frames(time = 2000) # Wait for settings take effect.

clock = time.clock() # Create a clock object to track the FPS.

while(True):

clock.tick() # Update the FPS clock.

img = sensor.snapshot() # Take a picture and return the image.

print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected

# to the IDE. The FPS should increase once disconnected.

Y
_15004226107

绝对没有测错,我检查过了

I
网红小智智 星瞳科技

你的程序并没有操作串口

<http://book.openmv.cc/example/02-Board-Control/uart-control.html>

Y
_15004226107

不好意思我贴错。。。。。。

Y
_15004226107

# UART Control

#

# This example shows how to use the serial port on your OpenMV Cam. Attach pin

# P4 to the serial input of a serial LCD screen to see "Hello World!" printed

# on the serial LCD display.

import time

from pyb import UART

# Always pass UART 3 for the UART number for your OpenMV Cam.

# The second argument is the UART baud rate. For a more advanced UART control

# example see the BLE-Shield driver.

uart = UART(3, 115200, timeout_char = 1000)

while(True):

uart.write("Hello World!\r")

time.sleep(1000)

I
网红小智智 星瞳科技

不清楚你哪里的问题

Y
_15004226107

我这边和电脑发正常,但是和stm32单片机发就有问题,得到的数不对

I
网红小智智 星瞳科技

你不是说你用示波器一直是高电平?怎么和电脑又正常了?

2018-04-01 14:23
Y
_15004226107

现在测也是高电平,但是发数正常,换到32单片机上,单片机可以接受但是接收到的数不对

I
网红小智智 星瞳科技

目测

- 你不会用示波器

- stm32 上程序不对

2018-04-01 15:11
Y
_15004226107

不好意思,我这边的单片机串口引脚坏了,换了个单片机都好用了