Im setting up Multi uController board (Arduino/Propeller), need design advice.
rwgast_logicdesign
Posts: 1,464
Ok first of all right now im just setting this up on some protoboard along with a few other chips.
So I I know an atmega328p can run at 3.3 v, but I want to keep the mCU at 5v, it will make it much easier to plug and play 5v modules. Originally I was thinking I would just connect the two via a 2 line serial UART connection. Which is what I still intend to do in the beginning, but I would like to set it up later where I can use SPI and make the propeller the master. I figured I would just connect 4 pins from the Arduino to the propeller. Then I would put little jumpers, shunts like on mobos, on the last two connection. This way I would be able to change over to SPI fairly easily, but physically break the connections when using a standard 2 wire serial communication. Where im getting a bit confused is the resistors. Since the Prop is 3.3v and Arduino is 5v, I figure I would need a 2k current limiting resistor on each of the 4 pins correct? The next thing is do I need pull ups for SPI, Ive read differing things about this... I know an SD card has been shown to work with out pull ups... If I had 10k pull ups which lines need them, Im hoping only two MISO and MOSI but im not sure..
The second issue is programming the board. Im looking for a way where I could just have one programming port that I can slide a usb to serial device on, set a jumper for prop or Arduino and start programming. I would like to use a prop plug for this, Im pretty sure you can change the Arduino reset to use DTR. But im afraid of blowing the prop key by interfacing it to a 5v TTL signal. Is there a way I could use a prop plug to program both chips safely, assuming I can work out the reset issues?
So I I know an atmega328p can run at 3.3 v, but I want to keep the mCU at 5v, it will make it much easier to plug and play 5v modules. Originally I was thinking I would just connect the two via a 2 line serial UART connection. Which is what I still intend to do in the beginning, but I would like to set it up later where I can use SPI and make the propeller the master. I figured I would just connect 4 pins from the Arduino to the propeller. Then I would put little jumpers, shunts like on mobos, on the last two connection. This way I would be able to change over to SPI fairly easily, but physically break the connections when using a standard 2 wire serial communication. Where im getting a bit confused is the resistors. Since the Prop is 3.3v and Arduino is 5v, I figure I would need a 2k current limiting resistor on each of the 4 pins correct? The next thing is do I need pull ups for SPI, Ive read differing things about this... I know an SD card has been shown to work with out pull ups... If I had 10k pull ups which lines need them, Im hoping only two MISO and MOSI but im not sure..
The second issue is programming the board. Im looking for a way where I could just have one programming port that I can slide a usb to serial device on, set a jumper for prop or Arduino and start programming. I would like to use a prop plug for this, Im pretty sure you can change the Arduino reset to use DTR. But im afraid of blowing the prop key by interfacing it to a 5v TTL signal. Is there a way I could use a prop plug to program both chips safely, assuming I can work out the reset issues?
Comments
The Prop can't move bytes around much faster than 115,200bps (I think it's limit is just a little higher than this (I measured it once after SLRM told me about the limit)). I'm not sure if SPI will speed things up much unless you're communicating to a cog running PASM.
I haven't heard of a need for pull-ups on SPI lines but I'm still relatively new to this. I2C lines need pull-ups to work properly.
I doubt a Prop Plug would handle 5V well. IMO, Prop Plugs are kind of fragile (I blown at least two myself). You could probably use some sort of level shifter with with Prop Plug and AVR chip. Or you could use a 5V programmer and use a resistor on the Prop side.
One of theasons for looking in to SPI is on the prop side at least you can run up to 10mhz.
EDIT:
Well I just sat down to think about things, and I really do not want to waste a prop chip, but I do have a Quick start I never use, it is just not a convient board for testing projects in my opninon, so I will probably just use this as the propeller set up along with a board that plugs in to the top. I guess since this already has a USB plug on it and a FTDI chip, maybe use an 74VLVC244 buffer line driver to to program the Arduino using the QS's FTDI
? The Prop Plug page says this :
These tiny devices are capable of asynchronous communication at up to 3 M baud with both 3.3-volt and 5.0-volt devices such as the Propeller and BASIC Stamp.
Most USB-Serial chips I've seen are 5V tolerant.
There are some issues around phantom powering, where some USB chips can 'half power' off IO lines, enough to chatter RST.
I think the newer FT231X series are better at split power handling ?
Unless you are using a FT232H/2232H series device, 3MBd is more notional - the bits may have that timing, but the gap between bytes grows at those settings..
Try timing how long a chunk of data takes to send at bauds higher than 115200. While individual bytes will be sent at the specified baud, not all the bytes will be one after the other. Or as jmg said:
Really?1? IMO, the QS is the easiest board for testing projects. You've got power from USB when connected to the computer and you can connect sensors and other devices with either F/F or F/M hook up wire using he QS header.
I have dozens of different Propeller boards. Whenever I want to test something out with the Prop, I almost always grab a QuickStart board. I do add labels to the female header and add a couple of additional headers as can be seen in the cheap bot thread.
That's good to know. I hadn't ever noticed that part of the description. Thanks.
This makes me wonder what happens when you send some 20mhz SRAM data.,, And access SD cards, even though SPI can be much faster you still would have the problem of I guess SPIN not being able to fill the bandwith?
As far as the QS goes, I just feel like my home made boards and the BOE are much more handy. If got one of those pin finder things it might make the QS a bit more friendly, I just really dont like that header without labels on it its time consuming to look at the chart, and I feel like its much to cramped. Although I feel like it is a nice compact bored if you want to mount a project to the top of it, and thats why Im going to use it for this.
Think more about what you want to send over the comm. I can make the propeller chip output garbage at 1M all I want. If I want it to send useful data then I need to have a source that can generate it at that speed...
It's not really like the Arduino can actually handle data being sent at 1M. Yes, the hardware can receive the data, but, by the time the next byte comes in you have only managed to execute 16 instructions (Arduinos run at 16 MHz).
Thanks,
It is not all bad, I said at 3Mbd they struggle, but at 500K, 750K and even 1MBd you can sustain packed baud speeds on FT232R/FT230X, provided you take good care of the Buffer sizes and packets, and use most of the PC resource....
At 2Mbd, it becomes very dependent on PC usage (ie what else you have running ) and if you are trying duplex, or not.
A good simple test for Continual sending, is to create large test files of 55H ('U') and send those, and measure with a Frequency Counter.
Packed bytes will be exactly half the Baud rate, and then as you go above the chips flow limit, it adds 2,3 & more stop bits...
Example:
If you really want to go well over 1MBd, then use a FT232H up to 6MBd and a FT2232H is better for 12MBd
{ FTDI rather shortchanged the FT232H - it has smaller buffers than the Dual FT2232H }.
Along with burning the Arduino boot loader to an Atmega328p. When I get get home today I intend to hook the Arduino up after I get the power situation sorted out. Actually Im hoping some one can tell me the best way to do this. I hadn't planned on using a QS board, so I already made a switching regulator board with a 3.3v and 5v Rail. Now both rails can only handle 500mA, so I would rather not plug the 5v rail in to pins 39/30 or VIN of the QS board. What I would like to do is directly power the QS with my 3.3v rail. The only thing I can think of is to cut the LDO off the QS then connect my +/- 3.3v wires where the LDO was. I really don't want to mess up my QS though and im not sure if that would cause problems for the FTDI chip.
For my application I probably don't need anything over 9600 baud. Im mostly going to use the AVR to connect sensors too, and save propeller I/O. The thing is when I send a command to the Arduino to flip a pin I want it to happen as fast as possible, a PLC would be a better choice for this but that involves money and time to learn. Once everything is hooked up I intend to hook the bus up to a LA and see just how fast I can go with a serial connection, a lot of the time i may only need to send 1 byte so sending consecutive bytes is not a huge issue. After thats all worked out I am then going to do a little reading on SPI and repeate the same test.
Like I said im sure 9600 baud will do just fine but I would really like to test this out. I have an STM32 F4 board with with gyro/compass/accelerometer that would make a great inertial navigation unit and could probably benefit from a fast connection more so than an Arduino. I also want to eventually hook a RasPI ans camera up, so this is really just a precursor to all that good stuff!
I expect you know all about this? but just in case....
http://www.xgamestation.com/view_product.php?id=51
Circuit diags are available I think....
Dave
When I got home, I connected a inline 10k between the Arduino Tx and Prop Rx. I had a 1k sitting on my bench so I connected that between the Arduino Rx and Prop Tx. I uploaded the SerialCallResponseASCII sketch that comes with the Arduino download. Then I wrote a very simple Prop app... see below.
It just worked...
I think the QS went for absolute-cheapest 1117 class Regulators, but one trend I've seen with slightly better regulators, is their Vin(min) is falling, and their RDs in Sat, is also falling, so with a regulator like that, with 1-2 ohms of dropout loss, and a PGood Trip of 92% of Nominal, you could power from a 3.3V in, and still be ok. [50-100mV of drop, is still above the 264mV PGood trigger point.]
If you do not use PGood in your design, you have even more margin.
I still haven't gotten a chance to start getting this bored together yet. I keep having to deal with other hard ware issues and mechanical things. Im hoping to start experimenting tonight.
I think powering the QS is going to be the biggest PITA, im thinking about just setting up a 5v switcher to plug in to VIN and power the AVR. But at the same time im trying to figure out what actually needs to go on the board, besides the AVR. I have a few chips I want to add some i2C some SPI, would there be an issue with putting those on a separate PCB and running maybe 3 to 6 inches of cable between them? From what I understand SPI/i2C is really meant to sit as close to the master as possible.... Would using 74xx244 and 74xx245 help me extend signals farther, thats what there made for correct? I plan on getting the AVR on there tonight but I really need to know what all im going to have to fit on this board so I lay it out correctly.
I have been looking a lot at the AVR Chameleon, Andre implemented A LOT of the same features i am after in my own board. I found this site
http://www.chameleon-dev.com
Very helpful, it has the schematics, along with all the software for the chameleon and tutorials on how to use the SPI communication etc. From what I understand the chameleon is a completely open source project. I have been looking at all the information I can find on the site above and X-Game Station, and what I cant find is the propeller code, if there is any. From what I understand the propeller has a bunch of functions written for it that make it a SPI slave and allow the AVR to access its I/O pins along with the A/V peripherals, is this correct? If so do you know where I can get a copy of the stock EPROM code for the propeller? Like I said it seems as though all the AVR and PIC code for these boards is right out in the open but the Propeller stuff is hidden away some where...
John Abshier
For three line you could use a triple pole double throw switch. If you really need four lines then you could use a quadruple pole double throw.
The problem with the above switches is they are big. When I wanted to do something similar I used little DIP switches and resigned myself to moving all three switches (not hard). At the time I hadn't found a source of 3PDT switches.
I've since purchase one (I probably have both) of the above switches and I've been reluctant to use them since they are so massive. I imagine there should be some nice small 3PDT switches somewhere made for signal lines but I haven't found them.
An alternative is to use a couple of relays. One switch powers two or three relays (depending on how many poles the relays have).
I wonder if you could get away with just a normal DPDT switch on the tx and rx lines and just let both devices be reset as you program the one?
Let me clarify some of the issues that make me think I should be switching at all four lines at once, if I could get away with switching TX and RX only that would be ideal! As far as the the ground line goes, I have gone through a fair amount of work to keep the 5v and 3.3v rails isolated from each other, the only place they are connected is on the input of my switching regulation board. I guess I could use either ground on the programmer and it wouldn't really matter, it would only break the rail isolation when the chips are being programmed. I think the reset line is the bigger issue though... The Arduino needs an RC circuit on it's reset line to work with the prop plug properly, I'm not sure how this would effect the Propeller if at all. Now I could share the reset line by running it straight to the propeller and running a separate parallel leg off to the RC circuit and Arduino. The problem with that solution is that, when micro is being programmed they will both be reset.
I'm almost thinking two headers may be the most practical solution. As I said I could definitely make a set up where the prop programs the Arduino, by monitoring a button and if pressed presses it would transparently pass the RX and TX signals on to the Arduino. I m not sure if this would work with the DTR line though, I also think it may be a lot more work than it is worth.
I'm sorry if that does not make a whole lot of sense. Like I said sharing a reset line seems to be the bigger problem, since it would always reboot both micros at once, I can work around the ground system. I looked at the chameleons schematic but i am still unclear on how Andre set up the shared programming system. It looks like to me he is sharing the reset line.... and only swapping the TX and RX.. the problem with this is if I want to program the Prop but I don't want the AVR to reboot while I'm doing it or vice versa.
Here is a chameleon schematic,
http://www.chameleon-dev.com/pub/uploads/Community/avr_schem_v1.png
I guess I usually don't worry about it much myself.