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

    With 8 MHz in and wanting to run the chip at 48 MHz
    Code:
    @ __CONFIG    _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    And the "level" converter should not be used with mode 6, with the converter in place try mode 16390.
    http://melabs.com/resources/ser2modes.htm

    The iChip config utility might help make sure the module is setup correctly
    http://www.connectone.com/support.asp?did=30
    They say vista is not supported by I run it on win 7. Set a restor point just to be safe...

    Thats what I see....
    Dave
    Always wear safety glasses while programming.

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

    Default Re: mackrackit's ConnectOne example code

    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

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

    Default Re: mackrackit's ConnectOne example code

    CORRECTION TO CODE. Please ignore the code in previous post in favor of this one. Would really appreciate opinion as to whether this test code is telling me the MiniSocket has failed or not.
    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
        I        VAR BYTE         ' For-Next Loop index
        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
               WRITE 5,5   'EEPROM test to see if program executes to here..it does
                   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
      WRITE 6,6   'EEPROM test to see if program executes to here..it does
      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
      SERIN2 RX ,16390,2500,BROKE,[ WAIT("I/OK")]
    WRITE 7,7   'EEPROM test to see if program executes to here..it doesn't!
         ' ABOVE TEST INDICATES Interface to iChip is NOT working!
    END
    BROKE:
            WRITE 16, "B"     'Record in EEPROM as test shows iChip broke
    WRITE 8,8   '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

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

    Default Re: mackrackit's ConnectOne example code

    This part really has me baffled
    Code:
    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!
    Obviously pointing to a larger problem but I can not think what it is. Need to get this fixed first.

    Anyone see what I am missing?
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869

    Default Re: mackrackit's ConnectOne example code

    I don't see any reason for it not to be, but are you able to verify the PIC is actually running at 48Mhz? It seems there can only be 3 reasons to get stuck on a pause: Just taking forever because the clock is wrong, PIC is resetting - WDT maybe? or something is corroupting system variables causing PAUSE to mess up. I don't think it's the last option, no interrupts shown so what else could corrupt it? WDT and MCLR are both turned off. so that seems like it takes option 2 out. Leaves us to clock. The configs look correct, Maybe the crystal is not working/connected/...
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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

    Default Re: mackrackit's ConnectOne example code

    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:
    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
    Here is the BOOT subroutine where the execution stops. I can't figure out why communication with the module isn't established.

    '*********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
    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.
    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
    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!

    Last edited by jellis00; - 10th October 2011 at 05:05.

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

    Default Re: mackrackit's ConnectOne example code

    I am not familiar with Sparkfun stuff, that module converts 5 to 3? Why not just run the whole thing from a 3 volt supply and be done with it?

    Is your router set for DCHP? Does it see a new device?

    I have always used the ConnectOne software to set the passkey and baud rate.

    When I get back to the shop I will look at this closer.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Nov 2011
    Posts
    26

    Default Re: mackrackit's ConnectOne example code

    i was just confuse of what PIC should i use to interface the WizFi210-EVB sir...i'm a beginner sir so any suggestion of wat PIC should i use?...tnx...i want to design a PIR sensor like john design nw but i use WizFi210-EVB instead of connectone ant PIR instead of ultrasonic.and iwant to interface to PC unit with an application of Visual Basic as my GUI...i want to monitor my sensor through wireless..

  9. #9
    Join Date
    Dec 2005
    Posts
    1,073

    Default Re: mackrackit's ConnectOne example code

    The WizFi210-EVB is designed to connect to a PC via its DB-9 connector. How do you plan to connect the PIR sensor? It will get awfully expensive if you plan to use another WizFi210-EVB to provide it with WiFi.

    Does your LAN have a WiFi router? If so, you only need a WiFi interface for the sensor but the WizFi210-EVB is both costly and poorly suited for that as you would have to un-covert the RS232 levels/polarity (or use Debug/DebugIn). You would be better off designing your own PCB for the WizFi210 plus whatever PIC you wish to use which really depends on what else you need the PIC to do.

    The WizFi210/220 have several pins (ADC, DIO) that you can probably use to connect directly with the sensor w/o need of a PIC. Download the documentation from the page I referenced earlier in the thread. One of the application notes appears to show getting data from the module using HTTP although it does not provide sufficient detail to be sure. You probably should be communicating with WizNET rather than posting questions here.

  10. #10
    Join Date
    Nov 2011
    Posts
    26

    Default Re: mackrackit's ConnectOne example code

    thank you very much sir...

  11. #11
    Join Date
    Nov 2011
    Posts
    26

    Default Re: mackrackit's ConnectOne example code

    can i see your whole schematic if its okay to u sir..because i want to use the WizFi210-EVB module sir.its more alike in connectone sir..tnx

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

    Default Re: mackrackit's ConnectOne example code

    It will be tomorrow before I can post it as I do not have it with me.
    Dave
    Always wear safety glasses while programming.

  13. #13
    Join Date
    Dec 2005
    Posts
    1,073

    Default Re: mackrackit's ConnectOne example code

    Quote Originally Posted by kenruizal View Post
    ... i want to use the WizFi210-EVB module sir.its more alike in connectone sir..tnx
    The WizFi210-EVB bears no resemblance to the Connect One module. It has a DB-9 connector for the serial connection and uses RS232 levels and polarity. You'll just confuse yourself looking at Dave's schematic. Refer, instead, to the WizFi210-EVB schematic and their other documentation.

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