PC-to-Prop Serial Communication
GrendelT
Posts: 23
I recently acquired a PropBOE and absolutely love it. I put atop my BOEBot and found it very easy to integrate. I decided to dive off into a project with the Prop and I'm a bit hung up.
Is it possible to read data from the USB serial port on the PropBOE using something like SERIN from the BS2?
(I understand it's prob a bit more involved than the BS2, but the SERIN and WAIT really made life easy for reading data from the computer.)
Also, I understand P31 is the Rx pin on boot. After bootup, is P31 reset as a plain I/O pin or is it still useful as a serial input from the USB connection?
I'm wanting to listen to a stream of serial data coming from the computer and just at a loss on how to proceed. Thanks for any assistance!
Is it possible to read data from the USB serial port on the PropBOE using something like SERIN from the BS2?
(I understand it's prob a bit more involved than the BS2, but the SERIN and WAIT really made life easy for reading data from the computer.)
Also, I understand P31 is the Rx pin on boot. After bootup, is P31 reset as a plain I/O pin or is it still useful as a serial input from the USB connection?
I'm wanting to listen to a stream of serial data coming from the computer and just at a loss on how to proceed. Thanks for any assistance!
Comments
You can then use a serial terminal program like "Parallax Serial Terminal.exe" as a debug window.
These serial drivers often use pin 31 to 30 to communicate with the PC since they're wired to the USB interface. But the program needs to configure these pins before they can be used to communicate with the PC.
Make sure and check out Parallax's new "Learn" section about the PropBOE. It has lots of useful information on getting started using the Propeller.
The Propeller Tool's "Help" section also has a pdf of the Propeller Education Kit which also has lessons on how to do these type of things.
Take a look at the FullDuplexSerial object that came with proptool. You should find a sample program that uses it. Use 115200 baud (easiest default) and use the Parallax Serial Terminal (PST) (windows terminal program) that came with proptool for the PC end.
Now. Before you download, open PST and ensure it has 115200 baud set. Then switch (click) PropTool and do the download. While this is downloading you can click on PST and it will check the COM port for availability (counts down ~10secs) and when the port is released by PropTool it will take the port. It is best to use a waitcnt instruction of 23 seconds before outputting any messages from your prop. Otherwise, just repeat outputting a character so you can see it on PST on your PC.
If you have problems, check back here for more help. Once you have this working, it is a great debugging aid - I cannot stress this enough !!!
I got PST working and I can send characters to it from Putty. Fine business.
Is there a WAIT directive like that used for SERIN in PBASIC? Or do I need to read in the whole string directly and then parse accordingly?
Keywords:
VB.NET, Visual BASIC, Communication, Serial, Protocol, Packet, PC, QuickStart, P8X32A
Abstract:
Abstract: Many embedded applications share information with external devices, and the preferred connection between devices is asynchronous serial communications. The multi-core architecture of the P8X32A enables the designer to create and deploy device-to-device communications strategies with no impact on the primary application code. In this example a deployed communications support cog manages data between the main application and the serial I/O firmware, usingVB.NET and the P8X32A QuickStart board.
http://www.parallaxsemiconductor.com/an018
I'm just wondering if it's possible to pick only pieces from the data coming in.
Suppose the serial line is receiving this data: P45 V13.6 C0.200 T78.6F U12:05 LAT94.6 LON32.5
How would I pull out just the LAT and LON fields using PST? With PBASIC you could do a WAIT on the SERIN command. Do I need to receive the whole string then parse it out or is there an object that provides this sort of functionality?
If you use the fdx.rx command, just look at each character coming in until you reach the ones you want and assemble them as required. IIRC the rx call waits for a character.
Spin has not such built in functions like PBASIC. Either you find an object that has this functions or you do it by yourself. Here is a possible way to decode the characters while you receive them: Just load this code and start PST (with 115kBaud), then type your example string or parts of it.
Andy