mackrackit's ConnectOne example code


Closed Thread
Results 1 to 40 of 92

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Re: mackrackit's ConnectOne example code

    Can you solder a couple of wire onto your board?
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Re: mackrackit's ConnectOne example code

    I finally got back to this.
    To set the iChip up for you network change the below as needed. The config utility is not needed.
    Code:
    TX  VAR PORTC.0    'ICHIP PIN 8
        RX  VAR PORTC.1     'ICHIP PIN 7
        PAUSE 2000
        
        BOOT:   'iCHIP SET UP      
            SEROUT2 TX,84,["AT+iBDRA",$d,$a]        ' FORCE ICHIP TO AUTO BAUD
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]  ' SETTING BAUD TO 9600
            PAUSE 100
            SEROUT2 TX,84,["AT+iRPG=booger",$d ,$a] ' SETS REMOTE PASSWORD
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
            PAUSE 100
            SEROUT2 TX,84,["AT+iWSEC=0",$d ,$a]     ' WPA-TKIP PROTOCAL
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
            PAUSE 100
            SEROUT2 TX,84,["AT+iWLSI=MACLAN2",$d,$a]' SET SSID WE ARE LOOKING FOR
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]  ' 
            PAUSE 100
            SEROUT2 TX,84,["AT+iWLPP=macmac3X3",$d,$a]' SET PASS-PHRASE
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]  
            PAUSE 100 
            SEROUT2 TX,84,["AT+i!RP10",$d,$a]        ' REPORTS CONNECTION PARAMETERS
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]   ' FOR DEBUGGING
            PAUSE 100
            SEROUT2 TX ,84,[ "AT+iIPA?" , $d , $a ]  ' RETURNS IP ADDRESS
            PAUSE 100                               ' FOR DEBUGGING
            SEROUT2 TX,84,["AT+iWWW",$d,$a]         ' STARTS WEB SERVER
            SERIN2 RX,84,1000,BOOT,[WAIT("I/(")]
            PAUSE 100
            GOSUB BLINK                             ' IF WE GET HERE BLINK
            PAUSE 100
       GOTO BOOT
    It may take a minute or two to get a connection and "blink".
    Then look at your router and find a new device address.
    Enter the address into a browser
    http://192.168.2.19/ichip

    You should have the web config page.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default Re: mackrackit's ConnectOne example code

    Does this code actually work with one of your ConnectOne MiniSockets?
    I will try this with mine. If it works with yours and not with mine, this may be a way I can verify whether my module has gone bad or not...which is unforunately one of my increasing suspicions.
    John

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Re: mackrackit's ConnectOne example code

    The code was tested on a ConnectOne Nano Socket. Same chipset as far as I know.

    Yup, I am implying bugging in a DB9.

    I used one of these while debugging the above code on a win7 netbook. But I agree, the converters are not good for everything and I have brands that do not work at all.

    Or you could get a LCD with a serial back-pack to see what is going on. Either way, it will sure make debugging faster.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Nov 2011
    Posts
    26

    Default Re: mackrackit's ConnectOne example code

    hello john is it ok to use the the 16F873A?...uhm sir is it ok to disconnect the PICKIT2 when your are done load it to ur PIC?tnx

  6. #6
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default Re: mackrackit's ConnectOne example code

    Quote Originally Posted by mackrackit View Post
    It may take a minute or two to get a connection and "blink".
    I modified your proven code you inserted above very slightly per below. Because my PCB has the _RES_PD and MSEL interfaces connected to MCU pins for control of the module, I had to insert the "Initialize" statements for those interfaces per programmers manual to supposedly have module in normal AT+i ops for the internal serial interface. I also inserted some WRITE to EEPROM statements with comments and some LED blinking to assist my troubleshooting.

    As you can see from the comments, I never get the first I/OK acknowledgment from the module, which tells me that the internal serial interface from my MCU to the module is not working.

    Next step I guess is to solder 3 wires to my PCB to provision a temporary serial interface to my PC to see if Serial interface is working from MCU. Any other suggestions?

    Code:
    '< FL_PIC16F886 >'  ' First valid PIC found within the first 200 lines will
                        ' highlight AND set device.
    '< FL_PBPW >'       ' OR < FL_PBPL >
    '< FL_MPASM >'      ' OR  < FL_PM >
    ' Set configuration fuses for the MCU
    ' To use standard config include file, comment out below statement
    @ __config   _CONFIG1, _HS_OSC & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF
    ASM
       ERRORLEVEL -306
    ENDASM
    DEFINE OSC 8
    ADCON1 = %00001110
    ' Define variables and aliases
    CNT      VAR BYTE
    CNT = 0
    temp     VAR BYTE     'Already declared in main program as temp
    D_LAY    VAR BYTE
    ADR      VAR BYTE [9]
    MSEL     VAR PORTC.1   ' iChip Mode Select (MSEL)
    _RES_PD  VAR PORTC.2   ' iCHIP RESET/Power-Down (_RES_PD)
    TX       VAR PORTC.6
    RX       VAR PORTC.7
    PAUSE 2000
    'Initialize iWiFi MiniSocket Module
        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      ' Delay 10 sec
        HIGH MSEL        ' Proceed with normal ops
        PAUSE 2000       ' Delay 2 sec
    
    BOOT: 'iCHIP SET UP
        HIGH PORTC.4 :PAUSE 500  ' Short Blink the LED_RED as heart beat
        LOW PORTC.4: PAUSE 500
    WRITE 3,3      'EEPROM test to see if program executes to here..it does.
            SEROUT2 TX,84,["AT+iBDRA",$d,$a]        ' FORCE ICHIP TO AUTO BAUD
    WRITE 4,4      'EEPROM test to see if program executes to here..it does.
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]  ' SETTING BAUD TO 9600
            PAUSE 100
    WRITE 5,5      'EEPROM test to see if program executes to here..IT DOESN'T!
                   ' It just keeps looping to BOOT and blinking LED_RED
            SEROUT2 TX,84,["AT+iRPG=booger",$d ,$a] ' SETS REMOTE PASSWORD
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
            PAUSE 100
            'SEROUT2 TX,84,["AT+iWSEC=0",$d ,$a]     ' WPA-TKIP PROTOCAL
            'SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
            PAUSE 100
            SEROUT2 TX,84,["AT+iWLSI=Buckskin",$d,$a]' SET SSID WE ARE LOOKING FOR
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]  '
            PAUSE 100
            'SEROUT2 TX,84,["AT+iWLPP=macmac3X3",$d,$a]' SET PASS-PHRASE
            'SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
            PAUSE 100
            SEROUT2 TX,84,["AT+i!RP10",$d,$a]        ' REPORTS CONNECTION PARAMETERS
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]   ' FOR DEBUGGING
            PAUSE 100
            SEROUT2 TX ,84,[ "AT+iIPA?" , $d , $a ]  ' RETURNS IP ADDRESS
            PAUSE 100                               ' FOR DEBUGGING
            SEROUT2 TX,84,["AT+iWWW",$d,$a]         ' STARTS WEB SERVER
            SERIN2 RX,84,1000,BOOT,[WAIT("I/(")]
            PAUSE 100
            GOSUB Blink                             ' IF WE GET HERE BLINK LED_GRN
            PAUSE 100
       GOTO BOOT
       Blink:
        HIGH PORTC.5 :PAUSE 500  ' Short Blink the LED_GRN..NEVER GETS HERE!
        LOW PORTC.5: PAUSE 500
       RETURN
    Last edited by jellis00; - 15th October 2011 at 22:35.

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Re: mackrackit's ConnectOne example code

    The only pins used for normal operation are the GND, VDD, RXD0, and TXD0. All others are left floating.

    You are keeping things in reset by playing with the other pins.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default Re: mackrackit's ConnectOne example code

    I understand your point, Dave, but I already built the PCB with hookups to MSEL and _RES_PD from the MCU so have to make them work in the setup.

    This code works! The fix was to set TRISC so that _RES_PD and MSEL were declared as outputs. When this worked I was able to read the EEPROM to see what the IP was for the iChip website that it established and then to got to it via http://xx.xx.x.xxx/ichip and set the parameters I wanted.
    Now on to figure out how to integrate this working code into my application so I can use the iWiFi module to send an email via its connection with my wireless router to the internet.
    Thanks for your help, Dave. I hope this attached code will show others who visit this thread how to setup a iWiFi MiniSocket module to set its parameters without having to use the config utility.
    /s/ John Ellis
    Code:
    ' STATUS:  Works OK!
    '< FL_PIC16F886 >'  ' First valid PIC found within the first 200 lines will
                        ' highlight AND set device.
    '< FL_PBPW >'       ' OR < FL_PBPL >
    '< FL_MPASM >'      ' OR  < FL_PM >
    ' Set configuration fuses for the MCU
    ' To use standard config include file, comment out below statement
    @ __config   _CONFIG1, _HS_OSC & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF
    ASM
       ERRORLEVEL -306
    ENDASM
    DEFINE OSC 8
    ADCON1 = %00001110
    TRISC.1 = 0           ' Make pin output for MSEL
    TRISC.2 = 0           ' Make pin output for _RES_PD
    ' Define variables and aliases
    CNT      VAR BYTE
    CNT = 0
    temp     VAR BYTE     'Already declared in main program as temp
    D_LAY    VAR BYTE
    ADR      VAR BYTE [9]
    MSEL     VAR PORTC.1   ' iChip Mode Select (MSEL)
    _RES_PD  VAR PORTC.2   ' iCHIP RESET/Power-Down (_RES_PD)
    TX       VAR PORTC.6
    RX       VAR PORTC.7
    PAUSE 2000
    
    'Initialize iWiFi MiniSocket Module
        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      ' Delay 10 sec
        HIGH MSEL        ' Proceed with normal AT+i command ops
        PAUSE 2000       ' Delay 2 sec
    
    BOOT: 'iCHIP SET UP
        HIGH PORTC.4 :PAUSE 500  ' Short Blink the LED_RED as heart beat
        LOW PORTC.4: PAUSE 500   ' while disconnected from router.
    WRITE 3,3      'EEPROM test to see if program executes to here..it does.
            SEROUT2 TX,84,["AT+iBDRA",$d,$a]        ' FORCE ICHIP TO AUTO BAUD
    WRITE 4,4      'EEPROM test to see if program executes to here..it does.
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]  ' SETTING BAUD TO 9600
            PAUSE 100
    WRITE 5,5      'EEPROM test to see if program executes to here..it does!
            SEROUT2 TX,84,["AT+iRPG=booger",$d ,$a] ' SETS REMOTE PASSWORD
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
            PAUSE 100
            'SEROUT2 TX,84,["AT+iWSEC=0",$d ,$a]     ' WPA-TKIP PROTOCAL
                     ' Commented out until WPA setup on wireless router
            'SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
            PAUSE 100
            SEROUT2 TX,84,["AT+iWLSI=Buckskin",$d,$a]' SET SSID WE ARE LOOKING FOR
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]  '
            PAUSE 100
            'SEROUT2 TX,84,["AT+iWLPP=macmac3X3",$d,$a]' SET PASS-PHRASE
                     ' Commented out until WPA setup on wireless router
            'SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
            PAUSE 100
            SEROUT2 TX,84,["AT+i!RP10",$d,$a]        ' REPORTS CONNECTION PARAMETERS
            SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]   ' FOR DEBUGGING
            PAUSE 100
            SEROUT2 TX ,84,[ "AT+iIPA?" , $d , $a ]  ' RETURNS IP ADDRESS
                                                     ' FOR DEBUGGING
            SERIN2 RX ,84 , 2500 ,BOOT , [ DEC ADR[0] , DEC ADR[1] , DEC ADR[2] , DEC ADR[3] ]
            PAUSE 100
            WRITE 16,ADR[0]      ' Write the IP to EEPROM for post run identify
            WRITE 17,ADR[1]
            WRITE 18,ADR[2]
            WRITE 19,ADR[3]
    WRITE 6,6      'EEPROM test to see if program executes to here..it does!
            SEROUT2 TX,84,["AT+iWWW",$d,$a]         ' STARTS WEB SERVER
            SERIN2 RX,84,1000,BOOT,[WAIT("I/(")]
            PAUSE 100
            GOSUB Blink                             ' IF WE GET HERE BLINK LED_GRN
            PAUSE 100
       GOTO BOOT
    
       Blink:
        HIGH PORTC.5 :PAUSE 500  ' Short Blink the LED_GRN..IT DOES AFTER ~2 minutes!
        LOW PORTC.5: PAUSE 500
       RETURN

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Re: mackrackit's ConnectOne example code

    Glad you got it working!!!

    But,
    TRISC.1 = 0 ' Make pin output for MSEL
    TRISC.2 = 0 ' Make pin output for _RES_PD

    Would/should not have made a difference because the HIGH/LOW commands do that in the background.

    Must have been another change...
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default Re: mackrackit's ConnectOne example code

    I thought it was working...and it is to a point. However I am seeing an anomaly I can't understand. I hope you can help me figure this out.

    I am programming my application with the below code using a PICKIT2. I have the PICKIT2 set to "VDD Target" so that the PICKIT2 is not providing power...my application has its own power.
    The programming of the device is normal and it starts working and executes the program normally as long as the PICKIT2 is still connected (but not providing power).

    However, when I disconnect the PICKIT2 and power down my application and then reapply the application's power, the code is obviously stopping execution at the point in the code where the AT+i coommand is given to set auto-baud at 9600 baud. I know this from the WRITE 4,4 statement not appearing in EEPROM after the test run and the LED_RED not blinking. However, when I then reconnect the PICKIT2 and load the PICKIT2 software with its screen, my application then works normally and executes the complete program with the LED_RED blinking as a heart beat during the BOOT loop.

    It is almost like the iWiFi module isn't getting power when the PICKIT2 is disconnected and therefore the AT+iBDRA fails...but it is getting power...I checked with a voltmeter.
    I am stumped and can't go any further in integrating this code with my overall application until I resolve this anomaly.

    Do you or anyone have any ideas why the iWiFi module would act this way with this code and this scenario?? At least I was able to use this code when it worked while PICKIT2 was connected to identify the IP address, log into the iChip web server from my PC via the wireless route,r and set parameters on the iChip.

    John


    CODE]
    '< FL_PIC16F886 >' ' First valid PIC found within the first 200 lines will
    ' highlight AND set device.
    '< FL_PBPW >'
    '< FL_MPASM >'
    ' Set configuration fuses for the MCU
    ' To use standard config include file, comment out below statement
    @ __config _CONFIG1, _HS_OSC & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF
    ASM
    ERRORLEVEL -306
    ENDASM

    DEFINE OSC 8
    ADCON1 = %00001110
    TRISC.1 = 0 ' Make pin output for MSEL
    TRISC.2 = 0 ' Make pin output for _RES_PD

    ' Define variables and aliases
    CNT VAR BYTE
    CNT = 0
    temp VAR BYTE 'Already declared in main program as temp
    D_LAY VAR BYTE
    ADR VAR BYTE [9]
    MSEL VAR PORTC.1 ' iChip Mode Select (MSEL)
    _RES_PD VAR PORTC.2 ' iCHIP RESET/Power-Down (_RES_PD)
    TX VAR PORTC.6
    RX VAR PORTC.7
    PAUSE 2000
    CLEAR
    'Initialize iWiFi MiniSocket Module
    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 5000 ' Delay 5 sec
    HIGH MSEL ' Proceed with normal AT+i command ops
    PAUSE 2000 ' Delay 2 sec

    BOOT: 'iCHIP SET UP
    WRITE 3,3 'EEPROM test to see if program executes to here..it does under all conditions.
    SEROUT2 TX,84,["AT+iBDRA",$d,$a] ' FORCE ICHIP TO AUTO BAUD
    SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")] ' SETTING BAUD TO 9600
    PAUSE 100
    WRITE 4,4 'EEPROM test to see if program executes to here..it does when
    'application is connected to PICKIT2
    but DOESN'T when
    'disconnected and then started on application's own power.
    'However when reconnected to PICKIT2 and the PICKIT2 screen
    'is then opened, it executes normally again.
    PICKIT2 is set to
    'VDD target and is not supplying power to the application.
    HIGH PORTC.4 :PAUSE 500 ' Short Blink the LED_RED as heart beat
    LOW PORTC.4: PAUSE 500 ' during BOOT loop. Doesn't Blink when
    ' disconnected from PICKIT2!
    SEROUT2 TX,84,["AT+iRPG=booger",$d ,$a] ' SETS REMOTE PASSWORD
    SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
    PAUSE 100
    WRITE 5,5 'EEPROM test to see if program executes to here..it does!
    'SEROUT2 TX,84,["AT+iWSEC=0",$d ,$a] ' WPA-TKIP PROTOCAL
    ' Commented out until WPA setup on wireless router
    'SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
    PAUSE 100
    SEROUT2 TX,84,["AT+iWLSI=Buckskin",$d,$a]' SET SSID WE ARE LOOKING FOR
    SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")] '
    PAUSE 100
    'SEROUT2 TX,84,["AT+iWLPP=macmac3X3",$d,$a]' SET PASS-PHRASE
    ' Commented out until WPA setup on wireless router
    'SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")]
    PAUSE 100
    SEROUT2 TX,84,["AT+i!RP10",$d,$a] ' REPORTS CONNECTION PARAMETERS
    SERIN2 RX ,84,2500,BOOT,[WAIT("I/OK")] ' FOR DEBUGGING
    PAUSE 100
    SEROUT2 TX ,84,[ "AT+iIPA?" , $d , $a ] ' RETURNS IP ADDRESS
    ' FOR DEBUGGING
    SERIN2 RX ,84 , 2500 ,BOOT , [ DEC ADR[0] , DEC ADR[1] , DEC ADR[2] , DEC ADR[3] ]
    PAUSE 100
    WRITE 6,6 'EEPROM test to see if program executes to here..it does!
    SEROUT2 TX,84,["AT+iWWW",$d,$a] ' STARTS iChip WEB SERVER
    SERIN2 RX,84,1000,BOOT,[WAIT("I/(")]
    WRITE 7,7 'EEPROM test to see if program executes to here..it does!
    PAUSE 100
    GOSUB Blink ' IF WE GET HERE BLINK LED_GRN
    PAUSE 100
    WRITE 16,ADR[0] ' Write the IP to EEPROM for post run identify
    WRITE 17,ADR[1] ' Use PC host to then go to iChip web server at
    WRITE 18,ADR[2] ' http:ADR[0].ADR[1].ADR[2].ADR[3] and set all
    WRITE 19,ADR[3] ' desired iChip parameters for operations
    GOTO BOOT
    Blink:
    HIGH PORTC.5 :PAUSE 500 ' Short Blink the LED_GRN..IT DOES AFTER ~1 minute!
    LOW PORTC.5: PAUSE 500
    RETURN
    [/CODE]

  11. #11
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default Re: mackrackit's ConnectOne example code

    Quote Originally Posted by mackrackit View Post
    Can you solder a couple of wire onto your board?
    a

    I think I know where you are going with this, Dave. Are you implying that if I solder 3 individual wires to the pins on my PCB that are TX, RX and GND and then connect those three wires to a DB-9 connector, I can jurry-rig a serial interface to my PCB?

    I could do this if that is what you are implying, but I also have the problem that none of our computers have a serial interface on them....they are all newer computers and it seems that only older computers have RS-232. I supposed we could try to use a USB to RS-232 converter cable, but we have had very bad experience in trying to use those...they typically don't work well with serial applications.

    John

  12. #12
    Join Date
    Nov 2011
    Posts
    26

    Default Re: mackrackit's ConnectOne example code

    Hello sir john.. i would to know if the minisocket need an external antenna?or is it ok without extrnal antenna?tnx..

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts