Propeller ASC+ and Seeedstudio GPRS Shield 1.0 Serial Communications
jrullan
Posts: 168
Hi all,
I have been recently introduced to the Propeller by a friend and I am quite impressed with it so far. I purchased the Quickstart board from Radio Shack, spent a couple of weeks learning SPIN and very little PASM (enough to make blinking leds in the Quickstart using cores 2-7, turning them on and off by using the touchpads).
Now I decided to move a little ahead and port a working project from Arduino to Propeller. So I naturally purchased the ASC+.
The project uses a Seeedstudio GPRS Shield 1.0 and so far I have been able to somewhat establish serial communications with it (had to solder the bottom of Pins 7 and 8 to make it work). The problem is that I can't receive certain messages from the shield.
For example, using the Parallax Serial Terminal I send the following:
However, every time I issue this command:
But if I load the program into RAM again (Note: The shield is not affected by this, there is no reset involved), I can again send commands and see the responses until I issue that last command.
The behavior is consistent, but I can't pinpoint what is wrong with it.
My take is that some part of the response from the shield is causing a crash on the serial port used to read its responses.
I'm no expert so I am requesting help from the real propeller masters on this forums.
I have been recently introduced to the Propeller by a friend and I am quite impressed with it so far. I purchased the Quickstart board from Radio Shack, spent a couple of weeks learning SPIN and very little PASM (enough to make blinking leds in the Quickstart using cores 2-7, turning them on and off by using the touchpads).
Now I decided to move a little ahead and port a working project from Arduino to Propeller. So I naturally purchased the ASC+.
The project uses a Seeedstudio GPRS Shield 1.0 and so far I have been able to somewhat establish serial communications with it (had to solder the bottom of Pins 7 and 8 to make it work). The problem is that I can't receive certain messages from the shield.
For example, using the Parallax Serial Terminal I send the following:
AT+CMGF=1and the response is
AT+CMGF=1 OK
However, every time I issue this command:
AT+CMGL=?I don't see the response and it stops working from then on.
But if I load the program into RAM again (Note: The shield is not affected by this, there is no reset involved), I can again send commands and see the responses until I issue that last command.
The behavior is consistent, but I can't pinpoint what is wrong with it.
My take is that some part of the response from the shield is causing a crash on the serial port used to read its responses.
I'm no expert so I am requesting help from the real propeller masters on this forums.
Comments
It's a good idea to post your problematic source code.
Also, soldering two pins together sounds a little iffy.
Heres the Spin code
The Parallax Serial Terminal 128 is a modification to the standard version with these changes, Buffer is now 128 and
I added the LF condition, because otherwise it was crashing after the first message was received from the GPRS modem.
This version, at least, works in the consistent manner I specified before.
About the pins, just followed the instructions on the ASC+ wiki for faster communications. I did not solder 7 and 8 together, just the jumpers on the bottom of the board to bypass the 2k resistor.
Thanks for answering so quickly.
The secondary buffer logic does not zero terminate (or have the concept) and therefore you may have garbage from the previous command.
I had not considered, and maybe dont understand, what you mention about the Rx being inverted in the GPRS. That said, does it affects the code?
About the pins, maybe I'm not expressing correctly what I did, so I'm including here a picture of the board and the jumpers. I think is is required for high speed communications, as suggested in the Wiki.
Pins:
Setup picture:
Again, thanks for your interest.
The secondary buffer logic does not zero terminate and can cause unexpected results.
You Re right I do not understand the pin thing. All I can see from the code is pins 7 and 8 on the prop are connected to something.
By secondary logic, are you referring to the second code posted?
If so, I understand it is zero terminating whenever it performs the last line:
It should make byte[#] equal to 0 it is just using the instead of
Does this makes any sense?
I checked and it seems that it is not inverted. So I guess the initialization is correct:
I'm running out of ideas.
PD: The third parameter should read % 0000, but the forum markup removes the first % 00 .
I have not examined your code fully to understand what you are doing at the end of the commands, but here are some thoughts after taking a quick look at the code I used:
- After sending a command, it should be followed by <CR> <NL>.
- The zero terminator of the ASCII string should NOT be sent.
- However, the AT+CMGF=1 command is only followed by a <CR>, because it is immediately followed by another command.
- Some commands return WAY more data than you might expect, make sure you are not overflowing your buffer.
snippet of my code (that requests current time from module)
Well at this point in time the code just listens to the terminal entry then forwards the entry to the GPRS shield.
The other part of the code is listening to the GPRS shield and then relaying the received buffer back to the terminal.
Though I wonder if I need to add the delay? In Arduino I guess it was needed because it is the same code that handles both ports, but in Propeller each is running on a different Cog.
I will anyway try adding the delay just in case.
Thanks for your reply.
Closer examination, getTerminalRxBuffer(bufferT) should be getTerminalRxBuffer(@bufferT). Since you are using SPIN string functions, you NEED to zero terminate the command strings in the secondary buffers, bufferT[128], bufferM[128], if you plan to use the buffers more than once.
PST has been around a long time. I'm not sure you need to update the object...
Nate
I would do as homosapien suggests and simplify the command by sending the AT commands directly without going through the terminal. Once you get that working then sort out the terminal logic.
The good news is that if you are getting a response to the AT+CMGF=1 command (and you are), the hardware is probably fine. I would further investigate how you are terminating your commands.
You need to pass the address of your buffers to the methodes "getTerminalRxBuffer" and "getModemRxBuffer" when you call them.
For example: As you have it now, you pass the undefined content of the first byte in bufferT as an address. So the PST object writes into an unknown position in hub-memory, and may overwrite some Spin code, thats why it stops working.
I only found a schematic for the V2 GPRS shield, but if the the V1 has the same level translater as the V2, you don't need the current limiting resistors, the interface works with a FET for Low and a 4k7 resistor for High, so the current is limited already.
Andy