Using a BSII to convert RS232 to TTL?
Vern Graner
Posts: 337
I've been using the Rogue Robotics uMP3 unit and have found a need to be able to send data to/from the unit from my PC (i.e. for firmware updates). The uMP3 requires TTL level serial signals which make it fine for connection to the Basic Stamp, but they specifically state that connecting the uMP3 to "Standard" RS-232 levels may damage the unit. They reccomend the use of a MAX232 chip to convert the levels.
What I was wondering was if the BSII could be "programmed" to act like a MAX232, in effect allowing the BSII to accept serial data through the DB9 programming connector on the carrier board, and echo it to a pin, and vice versa. Has anyone done this, and if so is there code somewhere? TIA!
Vern
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
What I was wondering was if the BSII could be "programmed" to act like a MAX232, in effect allowing the BSII to accept serial data through the DB9 programming connector on the carrier board, and echo it to a pin, and vice versa. Has anyone done this, and if so is there code somewhere? TIA!
Vern
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Vern Graner CNE/CNA/SSE | "If the network is down, then you're Senior Systems Engineer | obviously incompetent so why are we Texas Information Services | paying you? Of course,if the network http://www.txis.com | is up, then we obviously don't need Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
Comments
Dare I assume that you could do the same with the uMP3?
The resistor just limits the current going to those pins, and the stamp has clamping/clipping diodes that will chop the voltage level coming in.
BUT, does the uMP3 want TTL levels in an RS232 format -- in RS232, a logical 1 is actually -12 volts (0volts TTL) and a logical 0 is +12volts (5volts TTL)....in regular TTL 1's are 5volts and 0's are 0volts.
So, RS232 is inverted from TTL....what do you require? A MAX232 will take the RS232 and invert and convert it to give standard TTL out.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
·· In theory what you propose could work.· On the other hand, if the PC would be sending, say, MP3 files to the device, this may not work out so well.· The BASIC Stamp has no FIFO buffer.· You would need some flow control, and the transfers would be somewhat slower than what you'd get simply using a MAX232.· Of course, I have no technical details on your device, so this is all just off the top of my head.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
The uMP3 unit just needs commands sent to it and then it spits back result codes, kinda like a modem (i.e. "AT" results in "OK"). Although the firmware of the uMP3 is supposed to be updated this way so would be great if a simple program on the BS2 could sustain a transfer of a binary file. I think I'll experiment with this in the next few days. So, would you suggest I use "SERIN"/"SEROUT" or maybe shiftin? What would you guess would be a good starting point?
Vern
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·· Sustained transfers would only be possible using flow control, but as I said would likely slow things down a bit.· So, how do you get the MP3s on to this device?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
They have a SD/MMC card for the MP3s. You pre-load the card using your PC. The serial interface on the uMP3 is used to tell it what to play, to get status info and to change settings (i.e. play/pause, volume u/down, etc). The uMP3 can also used it to write data to files on the SD/MMC card so it can be used as a data recorder (i.e. record temperature readings over time etc.). It's pretty neat. For details have a look at the manual if you have a few minutes.
Vern
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·· Thank you for the information.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Though I agree it would be a waste to *dedicate* it to this purpose, in this case the BSII is already connected for the purpose of controlling the uMP3 so I was hoping to maybe have it serve "double duty" acting as in I/O interface allowing you to use a terminal program to interact with the uMP3 and/or upgrade the firmware through the BSII without having to remove the uMP3 from the circuit or having an additional Max 232 unit.
If I can just download a small program that would let the BSII act as a MAX-232 long enough to program the uMP3, then load the "real" program back into the BSII, it would save the additional cost in parts and allow "field" reprogramming of the firmware in the uMP3.
Thanks again for the tip on the Kronos unit!
Vern
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (Vern) : 8/29/2005 8:32:26 PM GMT
It would probably be slower than the MAX232 solution -- but would take less hardware. Your choice.