March 29, 2014 - 1:51pm, 47076 views
We have a concept board and are trying to figure out how to communicate with an at command driven shield from arduino over rx and tx. Would it be possible to point us in the right direction?
Hi, RX and TX are available on shield interface. These are first 2 pins in right bottom corner of the board marked as ASC. Serial can be configured with 3rd and 4th pins of on-board 4-pin micro switch. As the module offers two serial interfaces (ASC0 and ASC1) you can choose which one you wish to use:
- 3 up, 4 up - ASC1 available on TX/RX pins,
- 3 down, 4 up - ASC0 available on TX/RX pins.
Independently on which serial interface you pick, RX and TX pins remain the same. Please notice that if you're using ASC1 you have to correctly configure the module. Use following commands:
AT^SCFG="Gpio/mode/ASC1","std" - to reserve pins for serial interface
AT^SCFG="Serial/Interface/Allocation","1" - to have AT command interpreter available on ASC1
After that you can talk to the module over AT or even implement Java MIDlet that uses serial interface to communicate with external devices.
I had indeed switched the serial to asc1 already but did not know you had to allocate in order to use the atcommand interpreter. However it is still unclear to me how these atcommands are seperated. So on one side you have the ehs6 and on the other side the arduino shield which both use atcommands. How does the switching between work?
EHS6 has two serial interfaces available: ASC0 and ASC1.
On Concept Board dependently on selector position you have following options to use them:
- connect ASC0 to USB to serial FTDI chip and ASC1 to RX, TX pins (3 up, 4 up)
- connect ASC0 to RX, TX pins and disconnect ASC1, FTDI chip not used (3 down, 4 up)
- connect ASC0 to USB to serial FTDI chip and disconnect ASC1 (3 up, 4 down)
So RX TX pins aren't directly accessible from PC. If you have an external device connected to RX TX pins, you can only communicate with it only from the module, it's not reachable directly from PC.
As far as I understand your shield works as an endpoint device controlled over serial interface. You can setup the board for ASC1 to be available on shield interface RX, TX pins, then implement Java MIDlet to control the shield over serial from Java using CommConnection interface (see Java API reference for details). I would recommend following setup:
PC -- usb -- asc0 --> EHS6 -- asc1 -- rx,tx pins --> SHIELD
For testing and learning purposes you can for example implement serial tunneling to make EHS6 transparent and communicate with the shield from PC.
I managed to get the shield up and running with CommConnection. I can't get it to work with ATCommand interpreter. From what I read I should make 2 instances of the ATCommand interpreter to be able to switch between SHIELD and EHS6. The 2 instances I can make but the SHIELD doesn't respond, only the EHS6 does.
Also is it possible to make the EHS6 output faster. It is set to autobaud, but I can not change it to 115200 manually.
Please note that AT command interpreter is the part of module's firmware that parses incoming characters and invokes called commands. Several instances of AT interpreter are working simultaneously - one instance per each serial interface and extra for Java. Generally it doesn't matter if the data comes from serial or usb or from Java.
According to API reference ATCommand class "provides a simple manner to send strings directly to the AT-Interpreters of the device". As the data flows directly to AT interpreter when ATCommand.send method is called no serial device is used. ATCommand is always connected to AT interpreter internally and it cannot be routed to external device.
So in your application you should create one ATCommand object to call EHS6's command and one CommConnection to communicate with the SHIELD.
You can't change the baudrate when accessing ATCommand interpreter from Java. As I've mentioned above the data doesn't flow over serial interfaces and it isn't transmitted with fixed speed.
I hope my clarification will help you. Feel free to ask in case of further questions.
© 2013-2014 Gemalto M2M GmbH