Shop OBEX P1 Docs P2 Docs Learn Events
Im setting up Multi uController board (Arduino/Propeller), need design advice. — Parallax Forums

Im setting up Multi uController board (Arduino/Propeller), need design advice.

rwgast_logicdesignrwgast_logicdesign Posts: 1,464
edited 2013-03-16 14:12 in Propeller 1
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?

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-03-04 16:26
    The Propeller should have at least a 3K resistor when used as an input to a 5V signal. I generally use 10K.

    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.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-04 16:37
    Im not sure what you mean by the prop cant move bytes around much faster than 115200baud, with PASM serial drivers you can get serial connection at 1Mbaud plus. Are you saying the prop itself cant keep up with a pipe that big?

    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
  • jmgjmg Posts: 15,173
    edited 2013-03-04 17:12
    .... 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?

    ? 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..
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-04 17:54
    Oh wow.... I even called parallax and they told me the plug was designed for 3.3v systems and I would probably have to to use an amplifier to boost the TX signal
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-03-04 19:30
    Im not sure what you mean by the prop cant move bytes around much faster than 115200baud, with PASM serial drivers you can get serial connection at 1Mbaud plus. Are you saying the prop itself cant keep up with a pipe that big?

    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:
    jmg wrote: »
    the bits may have that timing, but the gap between bytes grows at those settings..



    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,

    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.


    jmg wrote: »
    ? 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.

    That's good to know. I hadn't ever noticed that part of the description. Thanks.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-04 20:01
    Hmmm ok that makes sense, I probably do not need over 115200 baud anyways, but that is just a bit disheartening to know the propeller is capable of serial connections of over 1Mbaud but it cant fully utilize that speed :/. I guess like you said if you wrote some PASM it could probably push your data out on the line a lot faster than spin.

    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.
  • KyeKye Posts: 2,200
    edited 2013-03-04 20:32
    About serial comm speeds...

    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,
  • jmgjmg Posts: 15,173
    edited 2013-03-04 20:57
    Duane Degn wrote: »
    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.
    Hmmm ok that makes sense, I probably do not need over 115200 baud anyways, but that is just a bit disheartening to know the propeller is capable of serial connections of over 1Mbaud but it cant fully utilize that speed :/.

    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:
    FT232RL     
      Baud     Freq Counter Av
    500k      250.062KHz
    1MBd      500.116KHz
    

    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 }.
  • Mike GMike G Posts: 2,702
    edited 2013-03-05 05:34
    I'd take Kye's advice to heart. And I'll add, just wire the thing up and get it working. Then report your finding on this thread.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-05 06:43
    Absolutely Mike, I made this little set up last night:

    IMG_20130305_055617.jpg


    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.
    1024 x 768 - 85K
  • blittledblittled Posts: 681
    edited 2013-03-05 07:02
    I did a similar setup with a Propeller and a 3.3V Arduino Pro Mini. I found the serial communications could only go to 56K since that was the limit of the Pro Mini. A 5V Arduino should be able to do 115K. Also do not wire the Arduino's hardware serial to pins 30 and 31 of the Propeller. If you do you cannot program either micro controller without some isolation from each other. It is best to use the SoftSerial library in the Arduino and pick pins other that 0,1 and pick pins other than 30 and 31 on the Propeller to communicate between the 2 microcontrollers.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-05 08:06
    Thanks for the tip blittled, I never use the Arduino hardware UART for anything besides programming. It is a nightmare to share that port, once, I hooked blue tooth up on the hardware serial pins and I couldnt get the thing to send data, only recive. Then I used soft serial and everything just worked. I was also reading that soft serial is can do 1Mbaud.

    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!
  • tritoniumtritonium Posts: 543
    edited 2013-03-05 10:45
    Hi
    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....

    The Chameleon(TM) AVR 8-Bit is the evolution of the high performance, small footprint, application development board. Similar to the BASIC Stamp(TM) and Arduino(TM) in concept, the Chameleon takes these products to the next level with a huge leap in computational performance as well as I/O interfaces. Simply put, the Chameleon is a credit card sized computer with (2) processors, (9) processing cores, 1 MByte of on board FLASH, 64K of EEPROM, and over 170 MIPS of processing power! If that wasn't enough, the numerous I/O interfaces include composite video for NTSC/PAL generation, VGA, audio out, PS/2 for keyboards and mice. Additionally, the Chameleon has a number of digital I/Os and Analog inputs making the Chameleon perfect for industrial controllers, experimentation, education, wearable computing, or hobbyist use.
    The real power of the Chameleon is based on its dual processor design. The Chameleon uses an Atmel AVR ATMega 328P as the main master processor (client) and Parallax multicore Propeller chip as the media processor (server). Thus, instead of taxing a single processor system to do everything, the Chameleon offloads all the heavy lifting to the multicore Propeller chip which has 8 processing cores to perform tasks such as generate video, audio, read keyboards and mice, etc. The AVR simply sends commands to the Propeller chip over a high speed SPI interface to command the Propeller to execute various operations all with a simple API that usually consists of a few lines of code to perform any task. Thus, the AVR programming is very easy and with simple APIs, you can develop very complex and rich media applications that leverage the incredibly powerful Propeller chip's media rendering abilities and huge software library. For example, you can generate TV signals, VGA, read keyboards and mice with a few lines of code.

    Dave
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-05 13:19
    I have seen the Chameleon board, although I don't know much about it. I had hoped that it had detailed free documentation online like the c3, so when I was ready I could look at how Andre implemented SPI, I have a feeling if there is anyone I would want to copy it would be him ;)
  • Mike GMike G Posts: 2,702
    edited 2013-03-05 19:52
    I was drinking beers with my buddies at a local brewery. On the way home this thread pooped into my head. I wondered why is level translation and serial COM between a Prop and Arduino an issue at all.

    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.
    CON
      _clkmode = xtal1 + pll16x     
      _xinfreq = 5_000_000
    
    OBJ
      pst           : "Parallax Serial Terminal"
      com           : "Parallax Serial Terminal"
    
    
    DAT
      buffer  byte  $0[$400]
      
    PUB Main | cog
      pst.Start(115200)
      pause(500)
      
      'StartRxTx(rxpin, txpin, mode, baudrate)
      com.StartRxTx(0, 1, %0010, 9600)
      pause(500)
          
      repeat
        com.StrIn(@buffer)
        pst.str(@buffer)
        pst.char($0D)
        pause(250)
        com.char("A")
        
    
    PRI pause(Duration)  
      waitcnt(((clkfreq / 1_000 * Duration - 3932) #> 381) + cnt)
      return
    

    It just worked...
    600 x 487 - 33K
  • jmgjmg Posts: 15,173
    edited 2013-03-05 20:18
    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.

    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.
  • blittledblittled Posts: 681
    edited 2013-03-06 09:31
    I have the Chameleon-PIC and it is a good 2 micro controller based board. The only reason the Chameleon-AVR didn't catch on is because it couldn't use the Arduino shields. You can find more info on them at http://www.chameleon-dev.com/. The Chameleons are no longer being sold by Parallax but you can buy them at XGameStation http://www.xgamestation.com/view_product.php?id=51 and the Chameleon-PIC is also available at MicroChip http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en547558.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-06 16:30
    Do you know how fast the AVR talks to the Prop over the SPI bus?: Do you have Arduino burned on to the AVR?

    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.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-09 18:56
    @blittled

    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 AbshierJohn Abshier Posts: 1,116
    edited 2013-03-09 19:07
    In the AVR source code zip file, and probably also in the PIC version, is a directory named propeller_driver with all the Propeller code.

    John Abshier
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-09 19:24
    Ohhhhh thank you, I wouldn't have stumbled on that for a while as I was looking mainly for prop stuff and didn't plan on reviewing the AVR code till much later!
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-15 16:34
    Ok so iv'e been working on this board for a few day's and I am mostly done with the propeller side of things, about to plop the AVR in. Iv'e got the prop plug programming Arduino chips, so I have been trying to think of the best way to use one 4 pin header to program either the propeller or Arduino based on the push of a button. Basically I need to switch 4 lines at once between two separate paths, Im not sure how to do this mechanically. I also had the idea of maybe using a push button to send a signal to the prop, when it recives that signal it could then funnel everything it receives on it's RX and TC lines to the Arduinos RX and TX. Does anyone know of a simple way to achieve this?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-03-16 09:23
    Do you really need to switch four lines? Don't the two devices share the ground connection?

    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?
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-16 12:38
    Thanks for the input Duane, the quad pole switch would work nice but as you said it is just way to big! I have thought about soldering the tips of a female header together to use a a four pole jumper, this would be comparable to the DIP switch solution but that seems kind of tacky looking.

    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.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-03-16 12:53
    I don't understand your concern about the ground. The Prop and Arduino have to have a shared ground connection to communicate with each other using a normal serial connection.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2013-03-16 13:43
    Ok a while back when I set up my switching supply I asked for a little bit of help on the eevblog forums, I was concerned about the noise from the switching regulators and digital lines getting in to the analog circuits. So based on some advice, I did my best to keep all power rails isolated from each other. Yes the 5v and 3.3v rail do have a common ground, on the battery's negative terminal, but this is it, after the the battery the 3.3v and 5v grounds never touch each other again in the whole system this is suppose to help make sure the noise in each power rail stays in it's own rail. Basically it is the same procedure one would use to isolate an analog ground. If I were to connect the two grounds again at the programmer this would kill the isolation, I could also just pick one ground and use it which would only cause two common ground points in the system when the chips are being programmed and this is not a huge issue.

    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
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-03-16 14:12
    Yes, that makes sense and I've also read it's a good idea to have the grounds connected in only one place.

    I guess I usually don't worry about it much myself.
Sign In or Register to comment.