有人知道是否可以通过USB模拟UART(简单的串行发送和接收)?这将如何实现?
我在Microchip网站上找到了这个链接,但它不是即将发布的.
http://www.microchip.com/forums/m522571-print.aspx
有任何想法吗?谢谢.
我想在Intel Galileo板上编写一个"hello world" 裸机应用程序.当然,使用UEFI打印文本(到UART-1)效果很好,但我想"手动"访问UART,而无需UEFI的任何帮助.
在QEMU,我的代码效果很好:
#define COM1_PORT (0x03F8)
#define UART_PORT (COM1_PORT)
enum uart_port_offs_t
{ // DLAB RW
THR = 0, // 0 W Transmitter Holding Buffer
RBR = 0, // 0 R Receiver Buffer
DLL = 0, // 1 RW Divisor Latch Low Byte
IER = 1, // 0 RW Interrupt Enable Register
DLH = 1, // 1 RW Divisor Latch High Byte
IIR = 2, // - R Interrupt Identification Register
FCR = …
Run Code Online (Sandbox Code Playgroud) 我在Raspberry Pi 3上运行了一个python 2.7脚本.
class UIThread(threading.Thread):
def __init__(self, threadID, name, counter, U):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.counter = counter
self.U = U
def run(self):
self.U.run()
def main():
time.sleep(3)
try:
try:
###launch a UI running as background thread#####
U = UIlib.UI()
thread1 = UIThread(1, "UI", 1, U)
thread1.daemon = True
thread1.start()
except:
###if there is no monitor, lanch a fake UI class#######
U = UIlib.nomonitorUI()
thread1 = UIThread(1, "NMUI", 1, U)
thread1.daemon = True
thread1.start()
print "No Monitor …
Run Code Online (Sandbox Code Playgroud) 我搜索了一点 ESC/POS 打印机的仿真,但没有找到更多的东西,然后是像这样的数据解析器。
简而言之,我有 Linux,我的设备通过 UART/RS-232 端口连接到我的 PC。我需要一些软件,它将侦听特定的 COM 端口,并将发送到该端口的数据可视化(例如将其保存为 PDF)。
我闪烁着Sparkfun边缘板与SparkFun串行基本突围- CH340G使用一些的例子是,IDE中提供了公报教程。
尽管它已经正常运行了很多次,主要是针对具有TensorFlow Lite和SparkFun Edge的微控制器上的示例example1_edge_test和AI,有时在闪烁时会收到此消息:
Connecting with Corvette over serial port /dev/ttyUSB0...
Sending Hello.
Received response for Hello
Received Unknown Message
msgType = 0x131
Length = 0x5800
['0x80', '0x6', '0xf0', '0xa5', '0x31', '0x1', '0x0', '0x58', '0x0', '0x3', '0x0', '0x0', '0x0', '0xa0', '0xff', '0x4', '0x0', '0x2', '0x0', '0x0', '0x0', '0x7', '0x0', '0x0', '0x0', '0x1', '0x0', '0x0', '0x0', '0xff', '0xa3', '0x2d', '0xff', '0xff', '0x5f', '0x5', '0x0', '0x1', '0x0', '0x0', '0x0', …
Run Code Online (Sandbox Code Playgroud) 在串行通信链路中,首选的成帧/同步方法是什么?
它是一个嵌入式系统,使用从UART到内存的DMA数据传输.我认为使用SOF的框架方法最具吸引力,但也许另一个方法足够好?
有没有人对这两种方法有利有弊?
我是新编写的8位PIC固件,可以使用我的代码帮助.我将PIC16F1829用于获取RX命令的LED模块.我只是试图获得基本设置,如在RX引脚上接收到某个值时打开LED,但是甚至无法实现.
想让UART通过中断工作,但是甚至无法在主循环中使用轮询.我的中断向量在下面的代码中被注释掉了.
RX引脚:RC5
TX引脚:RB7
用于打开和关闭LED的引脚:RA5
引脚RA5工作正常,可以打开和关闭LED.TX引脚工作正常,但我还没有确认中断TXIF是否也不起作用,就像RCIF不能正常工作一样.
我试过读RCIF和PIR1bits.RCIF.他们都编译了.两个人都没有工作.我在两个不同的LED模块上尝试了两个不同的PIC.它们打开,但读取RX引脚也不起作用.
变量RXIN最初被定义为3,因此由于主循环内的RXIN--循环,灯在启动时闪烁3次,所以我知道它正在进入主循环.但据我所知,RCIF中断在RX引脚接收时没有触发.
我已经在示波器上确认使用相同的波特率将信号送入RX和TX引脚,因此我认为波特率配置正确(300波特,8N1.)我还在示波器上确认RX引脚接收到强而干净的5V信号.到目前为止,轮询RCIF或使用中断服务路由都没有奏效.如果有人能够看到我没有看到的代码问题,我们将非常感谢您的帮助.
我的代码:
#include <stdio.h>
#include <stdlib.h>
#include <xc.h>
// This is for 300 baud rate
#define _BAUD_PRESCALER_LOW_ 0x2A
#define _BAUD_PRESCALER_HIGH_ 0x68
#define _XTAL_FREQ 32000000
#pragma config FOSC = INTOSC // Oscillator Selection->INTOSC oscillator: I/O function on CLKIN pin
#pragma config WDTE = OFF // Watchdog Timer Enable->WDT enabled
#pragma config PWRTE = OFF // Power-up Timer Enable->PWRT disabled
#pragma config MCLRE = OFF // MCLR Pin Function Select->MCLR/VPP pin function is digital …
Run Code Online (Sandbox Code Playgroud) 我无法将USART_1与蓝牙hc-05连接.微控制器是STM32F103RB.这是代码(我没有使用任何库)
#define APB2_FREQ 72000000
void USART1_Send(char* data)
{
unsigned int length = 0;
while(data[length] != '\0')
++length;
int i = 0;
while(i < length)
{
while((USART1_SR & 0x00000080) == 0); // wait if transmit data register is not empty
USART1_DR = data[i];
++i;
}
}
char USART1_Receive()
{
while((USART1_SR & 0x00000020) == 0); //wait for data to arrive
return USART1_DR;
}
void USART1_Init(int baudrate, short parity, short stop)
{
RCC_APB2ENR |= 0x00004004; // enable Port A, enable usart1 clock
GPIOA_CRH …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 QEMU 来模拟一段固件,但我无法让 UART 设备正确更新线路状态寄存器并显示输入字符。
细节:
目标设备:Qualcomm QCA9533(如果您好奇,请在此处查看文档)
目标固件:VxWorks 6.6 with U-Boot bootload
CPU:MIPS 24Kc
板:mipssim(修改)
内存:512MB
使用的命令: qemu-system-mips -S -s -cpu 24Kc -M mipssim –nographic -device loader,addr=0xBF000000,cpu-num=0 -serial /dev/ttyS0 -bios target_image.bin
我必须在这里道歉,但我无法分享我的来源。但是,当我尝试重新调整 mipssim 板时,我只对代码进行了微小的更改,如下所示:
将bios内存区域重新设置为 0x1F000000
将 load_image_targphys ()目标地址更改为 0x1F000000
将 $pc 初始值更改为 0xBF000000(TLB 重映射 0x1F000000)
将mipssim serial_init() ¬call 替换为serial_mm_init(isa, 0x20000, env->irq[0], 115200, serial_hd(0), DEVICE_NATIVE_ENDIAN)。
虽然看起来serial_init()可能是当前接受的标准,但我没有重新映射它的运气。我注意到马耳他板在我给它的 MIPS 测试内核上输出没有问题,所以我试图模仿那里做了什么。但是,我仍然无法理解 QEMU 是如何工作的,而且我无法找到许多解释它的好资源。我对源代码和包含的文档的搜索正在进行中,但与此同时,我希望有人可能对我做错了什么有一些了解。
二进制文件从地址 0xBF000000 加载并正确执行,但在遇到第一个 UART 轮询循环时挂起。在 QEMU 监视器中查看mtree显示 …
我有一个 ESP32 通过 USB 端口连接到计算机。我可以使用 ESP32 使用 print 语句通过串行连接发送数据,我需要定期向 ESP32 写入命令。如何在 MicroPython 中读取 ESP32 上 COM 端口传来的内容?我尝试了以下多种变体,但均未成功:
from machine import UART
uart = UART(115200)
while 1:
if uart.any():
msg = uart.read()
print(msg)
Run Code Online (Sandbox Code Playgroud) uart ×10
emulation ×3
c ×2
bare-metal ×1
bootloader ×1
embedded ×1
escpos ×1
esp32 ×1
firmware ×1
hc-05 ×1
interrupt ×1
keil ×1
micropython ×1
mips ×1
pic ×1
python ×1
python-2.7 ×1
qemu ×1
qualcomm ×1
stm32 ×1
tensorflow ×1
usb ×1
x86 ×1