Comments (9)
I'm going to close this.
Before you ask more questions here, could you spend some time reading up on serial ports and serial communication? I think this will help quite a bit.
from circuits_uart.
Nerves doesn't ship with the device drivers for the USB serial cables that you're using. It has drivers for cables with these chips in them: https://github.com/nerves-project/nerves_system_rpi4/blob/main/linux-5.10.defconfig#L466-L469.
"ttyS0"
goes to the GPIO header's UART pins. "ttyAMA0"
goes to the Bluetooth module on the board. It looks like "ttyS0"
is working for you. You specified active mode, so everything sent over the serial port will be turned into an Elixir message. Run flush
to get those. UART.read/2
returns an error since you specified active mode.
from circuits_uart.
Nothing was received on the UART. I'm not sure what you're expecting to be received, so maybe it's working just fine?
from circuits_uart.
Circuits.UART
also works on MacOS, so you could try it out there as well.
from circuits_uart.
Can you connect a wire from the UART's TX pin to the UART's RX pin? Then you can send strings to yourself.
from circuits_uart.
Thank you, @fhunleth, it is hard to understand for me, and I am very sorry I am trying to figure out how it works.
iex(1)> {:ok, uart} = Circuits.UART.start_link
{:ok, #PID<0.1124.0>}
iex(2)> Circuits.UART.open(uart, "ttyS0", speed: 9600,active: true)
:ok
iex(3)> Circuits.UART.write(uart, "Hello there\r\n")
:ok
iex(4)> flush
:ok
iex(5)> Circuits.UART.read(uart, 60000)
{:error, :einval}
I saw many topics and when they run flush
they could see the outputs, but I just got a :ok
atom. I just need something to test and see result to continue with what I receive. Furthermore, I changed active: true
to flase
and run Circuits.UART.read(uart, 60000)
it took a 2 or 3 min to show {:ok, ""}
iex(6)> Circuits.UART.open(uart, "ttyS0", speed: 9600,active: false)
:ok
iex(7)> Circuits.UART.write(uart, "Hello there\r\n")
:ok
iex(8)> flush
:ok
iex(9)> Circuits.UART.read(uart, 60000)
{:ok, ""}
Again I am very sorry, I just want to create an open-source project for analysing cars Which is based on a thesis.
Thank you
from circuits_uart.
@fhunleth would you mind suggesting me a device or something exists in home to test its USB? I do not know how to send a file or something to my Raspberry Pi and get this with your library, it shows me {:ok, ""}
because no device is connected to it.
If I find a device and connect with its USB, I think I can find a way to connect to a car. I tried my mobile, but I didn't know how to send a file or receive it.
from circuits_uart.
I think I can't, I do not know event these name ;), but I relay want to say thank you for all your efforts.
I should find a device to connect.
I have a question, when we want to write or receive, we should know some specialized String like AT, AC
to connect a device, for example every device needs? And every company has the own String or Integer?
For example:
If I run Circuits.UART.write(uart, "AT")
, It gives me back the number of passengers, for example?!! If yes, what should I search about it? What is this keyword?
from circuits_uart.
@fhunleth, yes sure. May you suggest me a reference?
Before taking your time, I want to prepare a car ECU and OBD
cable and test them, because I think I can't test it with my mobile or some devices exist in my home.
Thank you very much
from circuits_uart.
Related Issues (20)
- Bad Match in `find_pids/0`
- Possible option to set timeout on Open ? HOT 2
- Circuits.UART.enumerate no work on Ubuntu 20.04 HOT 3
- Connection opens without errors, but I can't neither read or write HOT 2
- Fix kIOMasterPortDefault deprecation on macOS 12 and later
- Should we monitor/link to the `controlling_process`? HOT 1
- Error compiling with BeagleBone based target HOT 7
- `:enotty` when attempting to open a port with RS485 options on Linux HOT 1
- Compile error in Fedora 38 HOT 6
- HOWTO: connect to 2 or more Serial Ports at the same time HOT 2
- Cannot compile for windows (have the windows driver SDK and mingw installed with chocolatey
- Latency HOT 3
- Can't close connection to unopened device HOT 1
- Cannot set parity to :mark HOT 2
- ENOTTY error setting custom speed on linux HOT 4
- UART.read timeout clarifications HOT 3
- Mingw 10.2 compilation is failing HOT 2
- [Question] Is it possible to read a specific but dynamic amount of bytes? HOT 3
- Issues with Fona 808 on Raspberry Pi Zero W HOT 8
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 circuits_uart.