Thanks, Dave. I implemented all of your suggested changes to my 18F2550 adaptation of your example code and the MiniSocket module still doesn't connect to my wireless router/PC. I also tried to use the iChip Config Utility to setup and test the module, but discovered you have to have a serial interace that connects directly to the WiFi module to use it... which I don't have on my PCB implementation. So I looked for another way to setup and test my MiniSocket module and discovered in the Programmers Manual the Easy Configuration method (pg 142 of Programmer's Manual). Per that method, I programmed the MCU to send an AT+iFD command to the module to reset it to Factory Default settings, which will supposedly search for and link up with any AD-HOC AP in range so that you can use this method to get your PC connected to the module to setup the desired configuration for your application. What I discovered leads me to believe that my particular MiniSocket module is a bad one. Take a look at this code and the embedded and commented WRITE EEPROM test and please tell me if you concur with that conclusion.
Code:
'<FL_PIC18F2550>' ' Set MCU type for FineLine Editor
'**************** Configure MCU and set port registers ********************
DEFINE OSC 48 ' Using 8 MHz crystal
@ __CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
@ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
@ __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H
@ __CONFIG _CONFIG4L, _LVP_OFF_4L &_XINST_OFF_4L
TRISA = 0 ' Reserve PortA as outputs for LCD use
TRISB = %00011100 ' RB2 & RB3 reserved as RTC Alarm1 & Alarm2 inputs
' PORTB.2 is also an interrupt from manual switch GND
' PORTB.4 is set as A/D Channel 11 input
TRISC = %10000000 ' Set PortC to all outputs except PortC.7 which is
' reserved as RX input.
' PortC.1 is output for MSEL to WiFi module
' PortC.2 is used for the LCD R/W connection when
' LCD present..otherwise as _RES_PD to Wifi Module.
' PortC.4 is output to LED_RED
' PortC.5 is output to LED_GRN
'********************* Declare Variables and Aliases **********************
WRITE 2,2 'EEPROM test to see if program executes to here..it does
LED_RED VAR PortC.4 ' Red LED
LED_GRN VAR PortC.5 ' Green LED used to indicate Routine entries
MSEL VAR PORTC.1 ' iChip Mode Select
_RES_PD VAR PORTC.2 ' iCHIP RESET/Power-Down
TX VAR PORTC.6 ' ports used for WiFi module serial interface
RX VAR PORTC.7
'X_TEMP VAR BYTE 'not used in new temperature routine
WRITE 3,3 'EEPROM test to see if program executes to here..it does
PAUSE 2000 'FOR SOME REASON PROGRAM DOESN'T EXECUTE PAST HERE IF STATEMENT IS UNCOMMENTED
WRITE 4,4 'EEPROM test to see if program executes to here..it doesn't if above statement uncommented!
' Blink LED_GRN 2X times to indicate iChip test started
FOR I = 0 TO 1
HIGH LED_GRN
PAUSE 500
LOW LED_GRN
PAUSE 500
NEXT
'***************** SETUP FOR USING iWiFi MiniSocket Module ***************
BOOT: 'iCHIP SET UP
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
PAUSE 500
SEROUT2 TX,16390,[ "AT+iFD",$d ,$a] ' Reset iChip to factory defaults
WRITE 5,5 'EEPROM test to see if program executes to here..it does
SERIN2 RX ,16390,2500,BROKE,[ WAIT("I/OK")]
WRITE 6,6 'EEPROM test to see if program executes to here..it doesn't!
' ABOVE TEST INDICATES Interface to iChip is NOT working!
BROKE:
WRITE 16, "B" 'Record in EEPROM as test shows iChip broke
WRITE 7,7 'EEPROM test to see if program executes to here..it doesn't!
' Blink LED_RED 2X times to indicate iChip not working
FOR I = 0 TO 1
HIGH LED_RED
PAUSE 500
LOW LED_RED
PAUSE 500
NEXT
GOTO BOOT
Bookmarks