I have devices(more than 3) that I am wanting to connect to an arduino preferably a uno. The device that originally connected(as a Master) to it I thought the serial protocol was i2c. I later found out it connects to pins pb5 and pb6 and pb7. The original device transmits to each device in order 1-8. Can you set up miso mosi to do this with just sclk, mosi,miso,cs1 pins(only 4 pins) plus power and ground of course. Or am i just not getting something? Thanks
E-CarNut.
Can you set up miso mosi to do this with just sclk, mosi,miso,cs1 pins(only 4 pins)
No. SPI doesn't address devices like I2C does. It requires that each device have a chip select input which in your case means using up 8 digital pins (including the CS1 you already mentioned) to separately select each device. If you are short of output pins, you can get away with using three digital output pins and a demultiplexer (or is it decoder?) chip (3 to 8 ).
Pete
I finally got a more clear answer from the manufacturer as the exact type of communication. Thanks for the help
Pete. It helped me narrow down the type of communication protocol. Here is sample of the response. The signaling is half duplex (party line) async like RS232. Undriven, (space), the two lines are between 10 and 15V
apart, and driven, (mark) they are about 2V apart.One advantage of this is that you can use a normal terminal
or terminal emulator program to talk to the Bus devices: 9600
Baud, 8 bits, no parity, 2 stop bits. I assume I can use the tx rx ports on the arduino uno with a hardware interface with fod817d's (optos) between the Arduino bus and the manufacturers bus.
The 2 stop bits might be a problem. There was a recent thread about this - trying to set the serial library so that it would do 2 stop bits. I don't know/remember if there was any resolution.
I assume I can use the tx rx ports on the arduino uno with a hardware interface with fod817d's (optos)
The optos would definitely be a good idea.
Pete
The AVR processor UARTs can do 2 stop bits, so that should be easy but you'll have to write directly into the UCSR0C register. (I just tried that and UCSR0C is not defined though)
Rob
Since I have figured out which communication protocol I have started moving forward. I have the computer hooked up to the usb to the serial converter supplied by the manufacturer. I am using the serial monitor on Arduino 1.0. I can receive data just fine. When I try to send it a command listed by the manufacturer nothing happens. example 01g. nothing happens. Full definition is
gethighv(g.)
full syntax:gethighv
minimum syntax: g.
example:
command: 01g.
reply: 01G 3.792V
The manufacturer states "01g."
followed by a carriage return
If you are sending data using the Serial library, this might work:
Serial.print("01g.\r");
It would help if you post a link to the manufacturer's info and post your code.
Pete
All I'm trying to do for now is just ping the command in the serial monitor send window. I haven't sent commands in this window before. I thought this would be the most straightforward approach since the commands are processed in the manufacturers device. Here is the link to the product I am working with. http://www.manzanitamicro.com/products?page=shop.product_details&flypage=flypage.tpl&product_id=54&category_id=22. The board uses an Atmega 168 chip.
You could get away with only a single pin for all the cs if you use like a decade counter and just clock it and have it reset itself after 8, however you will have to go in order then
I got the communication working between the computer and the battery management cards using the Arduino serial monitor. It was so simple it bothered me. I just changed the tab no line ending to carriage return. Now I receive data and can also transmit data to the cards using the serial monitor. I am new to communication and do not know where to start. Here is a transcript from the manufacturer. The signaling is half duplex (party line) async like RS232, but with a different hardware interface. I previously sent you a schematic of the interface. Undriven, (space), the two lines are between 10 and 15V apart, and driven, (mark) they are about 2V apart. There is no "ground" reference. One advantage of this is that you can use a normal terminal or terminal emulator program to talk to the Bus devices: 9600 Baud, 8 bits, no parity, 2 stop bits. Here are some of the commands. 001mi.001ma.001te.001xt.001re.001ge.001v. When I try to list more than one command in the serial monitor it only reads the first one.
I used the serial monitor to talk to a pic mcu once and it was the same thing it needed the carriage return after everything, took me a while to figure that out too since I was using hyperterminal no problem and didn't realize it was sending that, I guess for ease of use so a person can communicate with it which is really when it would show up in serial comms since ascii isn't a really efficient way of data transfer between devices
I've used this for better serial comm interfacing:
Digi XCTU
It's meant for their digi products, but the serial interface very simple. You can setup a string of bytes before you send it out, ascii or raw hex.