Delay of this reply was due to me having to get a new ConnectOne iWiFi Mini Socket Module. I fried the other one.
Also spent time while waiting for new module to get the application code working to requirements up to integration of the iWiFi. My application works perfectly up to the point of integration of the module, which I got yesterday. Spent today trying to get it to work with my application. Here is how my applications works.
1) My application receives a periodic RBC_INT interrupt from the Alarm1 (_INTA) signal sent from a DS1337 RTC.
2) Upon receipt of the interrupt the service routine measures a temperature and depending on the temperature initiates an email via iWiFi.
Everything is working up to here. I hope you guys will help me figure out why the iWiFi and email process isn't working. If you need to see the full schematic of the application it is in a post I made in the Schematic forum regarding a question I had on Oring the backup battery with the Vcc supply for the RTC.
I adapted Dave's ConnectOne example code by breaking it into a set of subroutines to integrate the iWiFi function into my application. My appliction is running on a 16F886 MCU that has a serial interface to the module via a SparkFun serial level converter (MCU is at 5 v....module is at 3.2v). I have double checked the pin/trace interfaces on the PCB and I think they are correct. I will list the subroutines and explain how I intended the process to work below. You will notice I use a lot of WRITE statements to EEPROM for post run evaluation/testing and also a lot of RED and GREEN LED blinking codes for run-time testing. I have annotated each write statement as to whether the code works to that point or not.
Here is the routine called by the interrupt service handler to initiate the Email process...every thing works up to here:
Here is the BOOT subroutine where the execution stops. I can't figure out why communication with the module isn't established.Email:
' Blink Green LED 1x long at start of Email routine
TOGGLE LED_GRN
PAUSE 1000
TOGGLE LED_GRN
PAUSE 2000
GOSUB BOOT ' Setup WiFi module for ops if installed
' Executuon fails in BOOT and never gets to this point...see WRITE statement notes in BOOT routine below
EMAIL_SET:
SEROUT2 TX,6,["AT+iSBJ:iChip ADC TEMPERATURE",$d,$a] 'Permanently sets Email header s Subject field
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iTOA:[email protected]",$d,$a] 'Permanently sets Email addressee
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+ito:jellis00",$d,$a] 'Permanently sets Email header s =To: description
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iREA:[email protected]",$d,$a] 'Permanently sets the RETURN EMAIL Address
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iFRM:iChip",$d,$a] 'Permanently sets Email header =From: description.
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iSMTP:mail.comcast.net",$d,$a]'Sets the SMTP Server Name or IP.
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iSMA=1",$d,$a] 'Permanently sets SMTP authentication method
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iSMP:Kevin111",$d,$a] 'Permanently sets authenticated SMTP login
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
SEROUT2 TX,6,["AT+iSMU:[email protected]",$d,$a]'Permanently sets Authenticated SMTP login User Name.
SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
' Put code here to email low temperature warning via WiFi
SEROUT2 TX,6,["AT+iEMA:",$d,$a] 'Defines a plain text e-mail body
SEROUT2 TX,6,["HI, THIS IS FROM 206 N Veterans.",$d,$a]
SEROUT2 TX,6,["SENT EVERY 2 minutes.",$d,$a]
SEROUT2 TX,6,["THE TEMPERATURE IS.",$d,$a]
SEROUT2 TX,6,[DEC temp," F Inside.",$d,$a]
SEROUT2 TX,6,["GO TO:",$d,$a]
SEROUT2 TX,6,["http://www.lodestarassoc.com/ichip/ichip.html",$d,$a]
SEROUT2 TX,6,["FOR A ONE MINUTE UPDATE.",$d,$a]
'After successfully sending the e-mail, IF the stay online flag (!) IS specified.
SEROUT2 TX,6,[$d,$a,".",$d,$a]
SERIN2 RX,6,[WAIT("I/ONLINE")]
PAUSE 1000
'SEROUT2 PORTC.0,16468,["EMAIL SENT ",$d,$a] 'test not used
WRITE 5,$01 ' Write 1 to EEPROM as test if Email sent
' Blink Green LED 2x long after email sent
FOR I = 0 TO 1
TOGGLE LED_GRN
PAUSE 1000
TOGGLE LED_GRN
PAUSE 1000
NEXT
PAUSE 2000
RETURN
For completeness, here is the code for the BROKE segment that is used in BOOT when communication fails. I do see the character B written int EEPROM at the point in this code that confirms the failure in BOOT.
'*********SETUP FOR USING ConnectOne Mini Socket iWiFi module**********
BOOT: 'iCHIP SET UP
' Blink Green LED 2x short at start of BOOT routine
FOR I = 0 TO 1
HIGH LED_GRN
PAUSE 250
LOW LED_GRN
PAUSE 250
NEXT
PAUSE 2000
HIGH _RES_PD ' Set high for normal ops
PAUSE 500 ' Delay to stabilize coming out of power down mode
LOW MSEL ' Exit SERIALNET mode and return iChip to normal AT+i mode
PAUSE 10000
HIGH MSEL ' Set high for normal AT+i ops
'SEROUT2 PORTC.0,16468,["TEMP OUTSIDE ",DEC temp,$d,$a,$d ,$a] 'test not used
PAUSE 500
WRITE 4,4 'EEPROM test to see if program executes to here..it does
SEROUT2 TX,6,[ "AT+I",$d ,$a]
WRITE 5,5 'EEPROM test to see if program executes to here..it does
SERIN2 RX ,6,2500,BROKE,[ WAIT("I/OK")]
WRITE 6,6 'EEPROM test to see if program executes to here..IT DOESN"T!
' ABOVE TEST INDICATESInterface to iChip is NOT working! Execution doesn't to this point!
'SEROUT2 PORTC.0,16468 , [ "iChip OK",$d,$a ] 'test not used
'SEROUT2 PORTC.0,16468 , [ "TEST_" , DEC3 CNT , 13 , 10 ] 'test not used
SEROUT2 TX ,6 , [ "AT+iIPA?" , $d , $a ]
SERIN2 RX ,6 , 2500 ,BOOT , [ DEC ADR[0] , DEC ADR[1] , DEC ADR[2] , DEC ADR[3] ]
WRITE 10, ADR[0] ' Write the received IP address to EEPROM as a test..NEVER HAPPENS!
WRITE 11, ADR[1]
WRITE 12, ADR[2]
WRITE 13, ADR[3]
GOSUB DIP
PAUSE 2000
'SEROUT2 TX,6,["AT+iWLWM=1",$d,$a] ' Sets WEP enabled with 64bit key
'SERIN2 RX ,6,2500,BROKE,[ WAIT("I/OK") ]
'SEROUT2 TX,6,["AT+iWLKI=1",$d,$a] ' Sets the Wireless LAN transmission WEP-Key index
'SERIN2 RX ,6,2500,BROKE,[ WAIT("I/OK") ]
'SEROUT2 TX,6,["AT+iWLKn1=xxxxxxxxxx",$d,$a] ' Sets the Wireless LAN WEP key
'SERIN2 RX ,6,2500,BROKE,[ WAIT("I/OK") ]
SEROUT2 TX,6,["AT+iWLSI=Buckskin",$d,$a] ' Sets the destination Wireless LAN SSID
SERIN2 RX ,6,2500,BROKE,[ WAIT("I/OK") ]
SEROUT2 TX,6,["AT+iWWW",$d,$a] ' Activates iChip's internal web server
SERIN2 RX,6,1000,BOOT,[WAIT("I/(")]
RETURN
Can you see anything in this that would cause failure other than a broken module? I can't believe that this brand new module is broken. I took extra precautions with it after breaking the previous one. Used static sensitive protection measures and never exposed it to wrong voltage. Please take a look and give me your observations and recommendations. Your help is GREATLY appreciated!BROKE:
'SEROUT2 PORTC.0,16468,["NOT WORKING",$d,$a] 'Commented out for now
WRITE 16, "B" 'Record in EEPROM as test if Broke...it does this!
' Blink LED_RED 3X long to indicate iChip not working
FOR I = 0 TO 2
TOGGLE LED_RED
PAUSE 1000
TOGGLE LED_RED
PAUSE 1000
NEXT
PAUSE 2000
Bookmarks