SPI problems on the Concept Board (EHS6) | Telit Cinterion IoT Developer Community
October 16, 2015 - 3:54pm, 3951 views
Hi Gemalto,,,
I can't get SPI to work on the Concept Board with AT commands or from Java.
Here's what I've done:
1. On the 'right-hand' switchbank (The one that has only 4 switches), I have switch 3 low and switch 4 high. According to the 'Concept_Board_Hardware_Interface_Description.pdf' page 13, this will send all the SPI signals to the shield interface (That's where I am looking for data output or at least a clock output).
2. Here's basically my java code:
try {
SpiConnection spiConn = (SpiConnection) Connector.open("spi:0;baudrate=100;clockMode=1");
int baudrate = spiConn.getBaudRate();
InputStream inStream = spiConn.openInputStream();
OutputStream outStream = spiConn.openOutputStream();
while (true) {
System.out.println("Sending Spi again...");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String data = "<dummy>";
outStream.write(data.getBytes(), 0, data.length());
outStream.flush();
}
}
catch (Exception e) {System.out.println(e);}
I expect to measure some data or clock signals on the SPI output on the shield interface (labelled 'SCK' and 'MOSI' on the concept board). I don't have a slave connected, but I assume it should work anyway.
3. I've tried to use the AT command 'AT^SCFG="Gpio/mode/SPI","std" and I get the 'OK' response. My AT^SCFG? is pasted below:
AT^SCFG?
^SCFG: "Call/ECC","0"
^SCFG: "Gpio/mode/ASC1","rsv"
^SCFG: "Gpio/mode/DAI","gpio"
^SCFG: "Gpio/mode/DCD0","std"
^SCFG: "Gpio/mode/DSR0","rsv"
^SCFG: "Gpio/mode/DTR0","std"
^SCFG: "Gpio/mode/FSR","gpio"
^SCFG: "Gpio/mode/HSIC","rsv"
^SCFG: "Gpio/mode/PULSE","gpio"
^SCFG: "Gpio/mode/PWM","gpio"
^SCFG: "Gpio/mode/RING0","std"
^SCFG: "Gpio/mode/SPI","std"
^SCFG: "Gpio/mode/SYNC","gpio"
^SCFG: "GPRS/AutoAttach","enabled"
^SCFG: "Ident/Manufacturer","Cinterion"
^SCFG: "Ident/Product","EHS6"
^SCFG: "MEopMode/SoR","off"
^SCFG: "MEShutdown/Fso","0"
^SCFG: "Radio/Band","511"
^SCFG: "Radio/OutputPowerReduction","4"
^SCFG: "Serial/Interface/Allocation","1","1"
^SCFG: "Serial/USB/DDD","0","0","0409","1E2D","0058","Cinterion Wireless Modules","EHx",""
^SCFG: "Tcp/IRT","3"
^SCFG: "Tcp/MR","10"
^SCFG: "Tcp/OT","6000"
^SCFG: "Tcp/WithURCs","on"
^SCFG: "Trace/Syslog/Otap","0"
^SCFG: "Userware/Autostart","0"
^SCFG: "Userware/Autostart/Delay","0"
^SCFG: "Userware/DebugInterface","0.0.0.0","0.0.0.0","0"
^SCFG: "Userware/DebugMode","on"
^SCFG: "Userware/Passwd",
^SCFG: "Userware/Stdout","asc0",,,,"off"
^SCFG: "Userware/Watchdog","0"
OK
4. My AT^SSPI? output only produces the following: '+CME ERROR: Unknown'.
Thanks for reading and please let me know if you have any advice.
Hello,
I can see in the AT^SCFG output that the global userware autostart is disabled. You should enable this because this setting also affects the factory JRC MIDlet which implements some of the module's functionality. So if JRC is not running SPI may also not work.
Regards,
Bartłomiej
Hi Bartłomiej,
Thanks very much for the fast reply =]
I set "Userware/Autostart" to 1, but still can't get any data or clocks out on the SCK or MOSI lines.
CS and MISO remain high when I install the code posted above. I get the "Sending Spi Again..." repeating every second as expected, but no change in CS, MOSI or SCK.
Some thoughts:
1. Do I need to manually pull CS low in the code somehow? Is the rest of my code OK?
2. Do I absolutely need to connect my slave up to these lines for it to work? (I don't see how that would be needed).
3. Running AT^SSPI=1000,0000,1000 before installing my JAD results in "CONNECT". I input a message like "<aHello>#" and get the "OK" afterwards but still: Nothing comes on the output to either SCK, CS or MOSI. It's like the SPI is somehow not enabled in hardware... but the switches on the board seem correct...
What about the dip4 switch on the board? Number 4 is for ASC1/SPI. Position OFF/down makes SPI usable. You should see MISO and CS LEDs changing from HIGH to LOW.
Hi Michał,
Tried switch 3 high and switch 4 low and still couldn't get a spi output from using AT commands or java. Think I absolutely need a slave?
You don't use any slave, so how do you know that you don't have any output? Do you use osciloscope?
I have just check these settings and with dip4 switch set UP/UP/UP/DOWN I can communicate with the sensor.
Best regards
Michał
Hi Michał,
Yes I am checking with an oscilloscope. Are there any obvious problems in my code?
I feel like I should at least be able to get clock pulses on SCK when I do AT^SSPI=1000,0000,1000 and then enter "<aHello>#". But I still get nothing...
Hello,
The code seems OK. I think that you should connect some SPI device first and then try to communicate and measure with oscilloscope.
Regards,
Bartłomiej