GithubHelp home page GithubHelp logo

Comments (9)

fhunleth avatar fhunleth commented on May 24, 2024 2

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.

fhunleth avatar fhunleth commented on May 24, 2024 1

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.

fhunleth avatar fhunleth commented on May 24, 2024 1

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.

fhunleth avatar fhunleth commented on May 24, 2024 1

Circuits.UART also works on MacOS, so you could try it out there as well.

from circuits_uart.

fhunleth avatar fhunleth commented on May 24, 2024 1

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.

shahryarjb avatar shahryarjb commented on May 24, 2024

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.

shahryarjb avatar shahryarjb commented on May 24, 2024

@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.

shahryarjb avatar shahryarjb commented on May 24, 2024

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.

shahryarjb avatar shahryarjb commented on May 24, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.