Does anyone have any sample code or suggestions to help me to interface my 100 pin uc3a1512to a device via RS-485? [closed] - atmel

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I am attempting to connect and control a device which only accepts RS-485 input. I wish to communicate to this device via my existing UC3A1512. Does anyone have any existing source code or examples that may help me to create this interface?
I need a method of outputting data via RS-485 format.
I do not need to establish round trip communication, I simply need the ability to send commands to the device.
I have looked at Atmel's website and also on AVRFreaks and I see nothing of value to my project.
Please review page 10 of this Adobe PDF from Lin Engineering to understand more about the device I need to communicate with.

RS-485 is just the electrical specification for a differential serial bus. There are many different data formats that can be used. To connect RS-485 to a microcontroller you need some hardware driver IC, there are plenty to choose from (a quick search at Farnell found 39).
The low level serial format may be 9600 8N1, if page 13 of the driver manual is any indication.
The higher level format (how to send commands to the motor) is not specified in the document, and I didn't find it elsewhere.
In the UC3A1512 you need to configure one of the USARTs to RS-485 operation, see Chapter 26 of the data sheet. Once the interface is configured the operation may be similar to RS-232, if a simple command format is used.

RS485 is a simple symmetrical serial bus. The data that you need to send over that serial link must be specified in the reference data sheet for your UC3A1512 device.
To create and debug your application (probably on an emulator it is useful that you can send it from your host PC before you try it from the embedded controller. This is easy, as RS485 allows multiple connections in contrast to RS232 which is point to point.
RS485 can be converted to regular serial RS232.
If your computer has no RS232 port anymore (most don't) you can get an USB to RS232 converter.

So far the most relevant answers have come from my question posted on electronics.stackexchange.com
Had I known this existed prior to posting my question on Stack I would have limited my question to Electronics & Robotics ONLY. As I had already asked the question and receive answers, I have opted to keep both questions open.
Thanks for your responses!

Related

How to Write/Read arduino flash memory with a selected address on arduino-due [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I need to know if we can write to or read from an Arduino Due's Flash memory, without EEPROM, at a selected address. I know we have PROGMEM, but I am unable to write two strings at two different addresses.
When I write Hello into the Flash memory at address IFLASH0_ADDR, and Hi into address IFLASH0_ADDR.
I am unable to read these strings back out because the library DueFlashStorage doesn't work with those selected addresses.
Please, I really want to know how can i do this.
Try this library: https://github.com/sebnil/DueFlashStorage.
Most basic use (copied from the above library's readme):
// write the value 123 to address 0
dueFlashStorage.write(0,123);
// read byte at address 0
byte b = dueFlashStorage.read(0);
It emulates EEPROM using Flash memory pages.
Here's the concept of EEPROM emulation explained in Application Note AN2594, for STM32 microcontrollers, for instance. It explains the concept of how to use two flash memory pages for EEPROM emulation. A similar paper may exist for the AT91SAM3X8E microcontroller (1459 pg. datasheet here) used by the Arduino Due.
Related:
Arduino Stack Exchange: How to read/write variables persistenly on Arduino Due (no EEPROM/shield)?
AN4894 Application note: EEPROM emulation techniques and software for
STM32 microcontrollers
[my question and answer] Arduino Stack Exchange: Is it possible to use extra AVR Flash memory as non-volatile EEPROM-like Flash memory storage?

Monitoring CANBus into PC - RS232 - Touch Encoder [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I purchased this device for a hobby project
http://www.grayhill.com/touch-encoder/
It outputs as CANBus (via DB9 connector). I'm not very savvy with these types of serials, but I just want to be able to just sniff/monitor the data packets from this device into my PC.
I bought myself a PCI Serial COM (RS232), and hooked it all up, and downloaded multiple monitoring software, however no data appears to be coming from the Bus.
Again, I'm not too savvy with this, so I don't know if I have configuration correct? Such as Baud rate, Data bits, Parity, etc.
The software I'm using is 'Device Monitoring Studio 8.30' (trial version). The software can see my PCI Card with the Ports; Monitoring does not return anything.
Am I missing something here? My understanding is that CANBus works with RS232.
Thanks
CAN bus and RS232 don't understand each other at the physical level, they use different voltages. And they are not compatible at the higher network layers either.
You need to get yourself a CAN to RS232 converter.
There are some options but all I know of are expensive +100$ US.
I would rather go for one of these which you can plug directly on a USB port on your computer.
Note that I'm not affiliated with the developers and I have not tested this product myself. You should do your own research to make sure you're buying the product that fits your needs best.
You seem to be on Windows so you might want to check cangaroo.

CAN low speed to CAN high speed adaption [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
I wonder if is possible to adapt a low speed fault tolerant CAN network (100kbps) to a high speed CAN network. I need this to connect a newer infotainment board (CIC) to my K-CAN inside my BMW e60 car. I already managed to wake up and control (on a workbench) the CIC via Arduino and MCP2515 shield.
Do you have any idea if is possible ?
Thanks!
The easiest thing to do is probably to simply replace the CAN transceiver IC on the infotainment board you're putting into the car, to one that matches the bus type you already have in the car. The different transceiver ICs are usually drop-in replaceable, so no problem with that.
However, even with a matching transceiver, the data bit rate needs to match as well, so you need to determine the bit rate used by the board and the one used by the vehicle's bus.
If the bit rates don't match, there's no point in replacing the transceiver IC - in this case the only solution is probably to create a bidirectional store-and-forward adapter/gateway.
One may construct such a gateway using an Arduino, but it'd have to have two CAN bus "shield" daughter boards - one for each bus, where each daughter board carries a CAN transceiver appropriate for the bus it'd connect to, and its CAN controller configured to the appropriate bit rate.
Each of the CAN controllers connects to the Arduino via SPI. It is very much possible for multiple slave devices to share a single SPI bus, with the master device (e.g., the Arduino microcontroller) selecting the device it wishes to communicate with using the chip/slave select (CS/SS) lines. For more information about SPI communication, including multi-slave, see here and here.
For off-the-shelf Arduino "shields" relying on SPI, additional shields (beyond the first) might requires physical rerouting of their CS/SS line to a different control line coming from the Arduino microcontroller, to allow slave selection. Consult the boards' pinouts and/or schematics to determine which modifications are required. Specifically, if using seeed's CAN bus circuit, check the "CS pin" section of its Wiki.
In terms of software, the gateway would basically need to constantly copy messages received in one bus to the other, with a small FIFO buffer to keep a few messages in case the target bus is busy.
Some modifications to the CAN bus library's source code might be required, to support multiple CAN controllers and switching between them using the CS/SS lines.
BTW, Stack Overflow is probably the wrong place for this question, as it's not really a programming question.

Using a PC for communication via GSM - not possible? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
While wondering what phone to buy after my current one died I came across the idea to use my PC and some kind of "GSM Dongle" to make phone calls and use sms. With my rather limited knowledge of computer systems and the GSM network I thought this should be a realistic possibility. A freely available GSM chipset, a valid sim card, a usb interface and some drivers should be sufficient.
But googling the topic yielded next to no results: Some obscure alibaba sites offer no name gsm dongles, and no one in any forum, blog etc even seems to consider making phone calls via PC.
Since I can't imagine me being the first one to have such an idea, I figured that what I want to achieve is simply not possible. But again, I fail to understand why that would be the case.
Anyone cares to enlighten me on this topic?
A GSM dongle is designed for making a data connection (internet connection) to a gateway in the operator's network. The exact technology used won't actually be GSM by the way, it will be GPRS, UMTS or LTE.
SIMs supplied with GSM dongles are typically on data tarifs only, i.e. don't support voice calls. As you pointed out however, GSM does support voice calls. To make a voice call, you would need a SIM with a voice call tarif. Then you need to send commands (e.g. AT commands) to the dongle to dial a voice call, and also have some software to connect the input/output of the voice call to your computer's headphones/speakers.
Probably a simpler way to make calls, is to make a standard internet connection with the dongle, and then use a service like Skype as you would over any IP connection.
You can send SMSes from any GSM dongle with a typical data SIM. You just need to be on a mobile network, and SMSes are usually included in data tarifs. You can send SMSes via entering AT commands (write a small program to send them to a COM port, or use some application like Hyperterminal that lets you enter the commands), or programmatically using the Windows Mobile Broadband API (if the dongle appears as a network adapter on your computer). Some standard Mobile Broadband dashboards from the operators have a GUI for sending SMS.

I want to establish a TCP/IP connection over a UART connection (Windows XP/7) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I want to connect two computer via serial but for each to see each other via a TCP/IP connection. Ie, create new network device on the computers that are in actual fact serial ports.
The reason for this is that I am actually testing the medium in which the serial connection is made (wireless), and part of the experiment will be to use TCP/IP.
The radio being tested is a telemetry radio for use in low power applications. It polls once a second, sending data out on the wireless channel every poll when something has been received via the serial port. It uses a Modbus RTU delimiter to determine the end of data coming in on the serial port.
slip and ppp are more suitable for use with actual serial modems from what I understand.
This is actually a very hard problem. TCP/IP is a very chatty protocol and you will have problems with the radio system you have described because of the pattern of packets and ACKs you will have. In the past for some similarly unsuited applications I worked on a system that fibbed about the TCP/IP connection by faking some packets while pushing the data over a link like you have.
It is a pain, but we were doing it to support sshing over a totally inappropriate channel (high loss and high latency with moving endpoints) but it worked.
SLIP (Serial Line IP) sounds like something you might want to look into for this project.
you may use Simple TCP/IP, UDP connection by using UART using a software like this:
http://www.serialporttool.com/CommTunnel.htm

Resources