Comments (4)
你好,因为我用的 Windows ,指定串口号后,listAndSelectPort()
函数返回的是 COM 号字符串,比如 "COM4" ,然后直接传参给:
port = Serial(port_name, baudrate=115200, timeout=1.0)
也就是 :
port = Serial(”COM4", baudrate=115200, timeout=1.0)
就能成功打开 COM4 。
但在你的 Linux 上,listAndSelectPort()
函数返回的是字符串 "ttyUSB2" 。要打开这个串口,必须用绝对路径 "/dev/ttyUSB2" ,而不是 "ttyUSB2" 。也即:
port = Serial("/dev/ttyUSB2", baudrate=115200, timeout=1.0)
因此这里我还需要写一个判断系统类型,并决定是否要在前面加上 /dev/
的逻辑。或者干脆说明该程序只能适用于 Windows 。
另外,请问你那里跑出来的压缩文件都没问题吧?
from fpga-gzip-compressor.
谢谢,明白了。我这里能够跑一个 .gz 文件出来,解压以后我用 vscode 进行比较以后没有发现什么错误,用 check_gz_file 也没有报错。实验的过程我写了一篇文章在知乎上面:https://zhuanlan.zhihu.com/p/633332670 。另外,这个 hex 文件是什么格式呀,我用文本打开以后显示了一团乱码,是只有这种格式才能被 uart 接收吗?
from fpga-gzip-compressor.
hex 就是裸数据文件格式。里面是一个一个的字节,在 Windows 上可以用 Winhex 软件打开并查看,在 Linux 上可以用命令行工具 hexdump 工具查看。
实际上,所有的文件都是一个一个的字节构成的。用不同的程序打开它们,相当于用不同的方式解读这些字节,才能看到不一样的东西。例如一个 .jpg 图片文件也是一堆字节,用画图软件打开就能看到图片,用 Winhex 打开也会看到一堆乱码。
所有格式的文件都能被我的压缩程序压缩,比如输入以下命令来压缩 data.txt 文本文件:
python fpga_uart_gz_file.py data.txt
会得到 data.txt.gz 。把它解压后又会得到 data.txt
另外注意,待压缩的文件必须 ≥32 字节,否则我的 GZIP 压缩器会把它当作不值得压缩的数据而丢弃。
from fpga-gzip-compressor.
明白了,谢谢!
from fpga-gzip-compressor.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fpga-gzip-compressor.