Nano Every Micro USB to RS232 Port on DAQ

Hardware:
Arduino Nano Every
NI PCIe-8430/2

Hello all,
This is my first post on the forum, greetings!

Background:
I am working on a project that involves control of BLDC motors using several of this ESC. Telemetry (namely RPM) can be extracted from the programming port of the ESC in the form of Serial, which I have successfully done. I have hacked my Nano Every boards to have 4 hardware serial ports enabled as per this post. From this, I can get RPMs from 3 ESCs per Nano Every (Serial is tied to the micro USB). As a part of my project, many other data are being collected from other sources, but these will all interface with a data acquisition (DAQ) computer.

Goal:
As far as BLDC motor control goes, I want the Nano Every to communicate to the DAQ computer the RPM of each motor. The DAQ computer has the control laws and is responsible for sending control inputs (as PWM pulse width values) to the Nano Every. Since I have more motors than I have analog output channels on the DAQ system, I am looking to send motor-specific commands to the Nano Every via serial, which is a RS232 port on the DAQ computer.

Question:
Is it possible to use just a micro USB to RS232 cable to establish 2-way communication between the Nano Every and the DAQ computer? As an example, will I be able to read from the RS232 port the data transmitted from doing

String data = "032400,"; // ID:0 RPM:32400 Termination Character: ','
Serial.print(data);

I am hoping to eliminate the need for a daughter board like TTL to RS232 converter, which would restrict my setup to just 2 ESCs per Nano Every (if I understand the connections correctly) and add to the complexity of the system. However, using a TTL to RS232 converter is the most popular solution, though I have my suspicion that this is to do with USB being a master/slave design.

Thanks in advance. I hope I have provided enough detail on what I am trying to do. I think serial communication is my best option, but please do tell of better alternatives. I also did not see it necessary to post any code for this type of question, but if I've missed something that needs attention to my code, just ask and I will share.

Have a look at MCUdude's MegaCoreX for the atmega4809 on the Nano Every, it is possible to have all four serial ports brought out to the available pins because of the peripheral pin swapping option on the atmega4809. (I see the post you linked for enabling all the ports does have information on this, but using MCUdude's boards package makes it a lot easier to do).

2 Likes

USB on Every can't be a USB host device

Thanks for the pointer. This will let me preserve the 3 ESC per Nano Every configuration with use of a TTL to RS232 level shifter.

The Nano Every not being able to be a USB host device I am aware of. I don't know much in the way of communications, but I have a DAQ computer that acts as the brain of my whole system. It will be sending instructions to the Nano Every and also polling it for RPM information. I am wondering if this is possible using a micro USB to RS232 cable as I hope to avoid using a TTL to RS232 converter.

You can connect a TTL Serial->USB adapter to a serial port on the 4809 and plug the USB connector into your host system. Your host system should then see an additional standard serial port and can communicate via it to your 4809.

You would need both of those devices if you wanted an actual RS232 link. The TTL-RS232 converter would be connected to the 4809 serial port and generate RS232 voltage levels. You would feed those into your RS232-USB converter for your host system to then be able to communicate with your 4809.

Instead, just use a TTL Serial->USB adapter - assuming that your 4809 is within around 6ft of your host system.

I guess you have to try. in theory it should work, but you will have a
DAQ RS232 -> USB converter -> SAMD11 as USB to UART -> 4809 UART
instead of DAQ RS232 -> MAX232 -> 4809 UART

Thanks for the info everyone. I just wanted to clarify that we are all on the same page.

The Nano Every has a micro USB port connected to RX TX as Serial. If I understand, then I cannot plug in a micro USB to RS232 cable to connect my Arduino with the DAQ. Instead, I have to switch Serial to live on hardware pins and use a TTL to RS232 to interface with the DAQ.

I want to make clear that the DAQ uses a RS232 port, not USB.

Edit: I was not precise. RX and TX are the pins associated with Serial1. But the point is, Serial currently lives on the connection to micro USB.

That would imply an intelligent converter that can act as a USB host.

As far as I can know (can'tcheck now), the RX/TX pins of the Nano Every are Serial1, not Serial.

That's correct. I'm not sure how to explain exactly, but yes, Serial is whatever the micro USB is tied to. I have gained access to Serial2 and Serial3 in addition to Serial1 hardware serials. And by MCUdude's MegaCoreX, I should have Serial on actual pins too.

Is this where the issue lies then with USB being host/slave? I was originally thinking the DAQ was the host. But if its output is RS232, then it means nothing as far as USB is concerned?

Your DAQ is not an USB host; it can't be with RS232 :wink:

Thanks community! I think I have what I need to know.

Edit: A nice answer I found on Quora in addition to the discoveries made in this thread.

right. my mistake. the cable is meant to be used with USB side on host.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.