mackrackit's ConnectOne example code


Closed Thread
Results 1 to 40 of 92

Hybrid View

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

    Default mackrackit's ConnectOne example code

    Here's a link to his ConnectOne example.

    Pros: The ConnectOne modules have a complete set of internet protocols and all the coding is similar to that in the mackrackit example. Configuration can be done via the ethernet or serial connection. The modules do all of the heavy lifting. IMO, these are the easiest to use.

    Drawbacks: Their modules take up more real estate than some others and mounting them to a mainboard is problematic in some cases. They do not fit breadboards. The code burden of the AT commands can add up quickly.
    Last edited by dhouston; - 25th May 2011 at 15:59.

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

    Default Re: mackrackit's ConnectOne example code

    Another drawback with the ConnectOne is it can not be setup to use "non-standard" ports when using it as a web server. Port 80 and 443 are it.

    About a year ago I asked them about it and they told me they were working on new firmware. Maybe the new firmware is out but I have not seen it..
    Dave
    Always wear safety glasses while programming.

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

    Default Re: mackrackit's ConnectOne example code

    Quote Originally Posted by dhouston View Post
    Here's a link to his ConnectOne example.

    Pros: The ConnectOne modules have a complete set of internet protocols and all the coding is similar to that in the mackrackit example. Configuration can be done via the ethernet or serial connection. The modules do all of the heavy lifting. IMO, these are the easiest to use.
    Dave, I am considering using a ConnectOne MiniSocketWiFi Module for a battery operated wireless application because it has a shutdown mode that only consumes 40 uA...which is lowest consumption that we have found in any other wireless module.

    We intend on sending it data via its asynchronous serial interface (no flow control) for WiFi transmission. However, after reviewing the data sheet for the MiniSocketWiFi module we are confused as to whether it requires use of the DTS and DSR handshaking interfaces. Your posting here doesn't say which ConnectOne module you are using, but I would very much like to see a reference design if you have one and an explanation of how you are wiring the serial interface...maybe even a schematic?

    Would also like to know from your example the delay time from AT message transmission to the ConnectOne until the WiFi message is actually transmitted via WiFi if you by chance have measured it or can estimate it?
    Last edited by jellis00; - 21st June 2011 at 18:37.

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

    Default Re: mackrackit's ConnectOne example code

    Just tie the handshaking lines (nCTS,nRTS) together if you are not using them.

    In the ethernet shields, I bring them out to a point where you can solder a wire jumper between them.

    I've put up a web page with the shields and some other related things here...
    All the connections are shown on the shields.

    I don't have the iWiFi but only the SocketLAN so I cannot answer about the delay. Maybe the other Dave can.

    In general I've found that the translation delay between serial and other protocols isn't noticed until you try something intensive like updating firmware over the link where the translation time and handshaking for error checking become a larger factor.

    As for the current draw, the various serial-to-WiFi adapters are all over the map. I was considering a shield using a WIZNet module (which I do have) until I saw it used about twice as much current when transmitting than others.

    BTW, look into BR type batteries if you haven't already.
    Last edited by dhouston; - 21st June 2011 at 20:43.

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

    Default Re: mackrackit's ConnectOne example code

    I have only used the Nano LANReach, Nano SocketLAN, and Nano Socket iWiFi modules. The only data connections used are the TX and RX from MCU to the ConnectOne module.

    I never noticed a delay and have not taken the time to measure what it is, has to be some. For what it is worth, the
    SERIN2 RX ,BAUD,2500,EMAIL_SET,[WAIT("I/OK")]
    has to be the very next line of code after an "AT+Ixx" command is sent. The "I/OK" will be missed if the SERIN command is placed in a sub routine, so the ConnectOne seems pretty fast.
    Dave
    Always wear safety glasses while programming.

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

    Default Re: mackrackit's ConnectOne example code

    Quote Originally Posted by mackrackit View Post
    I have only used the Nano LANReach, Nano SocketLAN, and Nano Socket iWiFi modules. The only data connections used are the TX and RX from MCU to the ConnectOne module.
    Dave,
    I have been reviewing the data sheet for the MiniSocket WiFi module and can't find ansers to following questions. Can you or anyone else on this thread answer them??
    1)When using a UART serial interface from the MCU to the MiniSocket to perform asynchronous data transfer, should the TXD pin of the MiniSocket be connected to the RX pin of the MCU? Similarly, should the RXD pin of the MiniSocket be connected to the TX pin of the MCU? I ask this because the Nano WiReach reference design sent to me by ConnectOne has TXD to TX and RXD to Rx, which is contrary with most MCU serial interfaces I have seen.
    2)We are not going to use flow control on the serial interface so we are tying the -CTS and –RTS pins together. However, we can’t determine from the MiniSocket data sheet whether we need to use the handshaking interfaces with DTR and DSR or not when performing asynchronous serial data transfer with the MiniSocket from the MCU. I notice the ConnectOne reference design for the Nano WiReach did show the DTR and DSR interfaces implemented, yet in most asynchronous serial interfaces we have seen with a PIC MCU they are not used. Please clarify??
    3) It is my understanding that the MiniSocket (which is a 3.3 v device) is not tolerant to 5v logic signals. Our application is all 5v circuits. Any suggestions on how to convert the 5v logic of the MCU to 3.3v logic for the MiniSocket with minimum hardware....our board is already very densely populated and can't afford a lot of additional components.

    Really appreciate any comments/answers to these questions.

    John
    Last edited by jellis00; - 23rd June 2011 at 02:35.

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

    Default Re: mackrackit's ConnectOne example code

    I'm the other Dave but I'll give you my responses to your questions, anyway.

    1. Cross-connect them.

    2. The Mini Socket iWiFi datasheet explicitly says to connect CTS/RTS if they are not used but says nothing about DTR/DSR so I don't think you need to connect them but you probably should ask this of Connect One Support.

    3. I dropped my intent to make the shield work with 5V and 3.3V because it was just to complicated with all the SPI lines on the other modules. However, with the Mini Socket iWiFi, we are only dealing with two inputs and one output. The way I prefer to handle this is with a transistor and two resistors for each line. You can see example circuits in FIG 15 of AN213.
    Last edited by dhouston; - 23rd June 2011 at 03:50.

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

    Default Re: mackrackit's ConnectOne example code

    Mackrackit, I know your ConnectOne example code is for a Nano Socket iWiFi module configurtion, whereas I am working with a iWiFi MiniSocket module, but I am trying to interpret some of your code to help me figure out how to program my 18F4550 as the embedded host for the MiniSocket. Without your schematic I am confused as to what connections on the iWiFi module are used with the PortC.4 and PORTC.3 connections on the MCU. Could you please post a schematic to help understand the purpose of the different connections between your 16F873A/iWifi module?

    Am also confused by some of your code:
    Are you using the sequential HIGH and then LOW statements for PORTC.4 to perform somekind of reset of the iWiFi module?
    When you use the SEROUT2 statements with PORTC.3, what are you doing when you send ["iChipO OK"] and ["TEST_",DEC3 CNT, 13, 10]?
    I also don't understand the purpose of the DIP subroutine??

    Can you please explain these statements to me?

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

    Default Re: mackrackit's ConnectOne example code

    The DIP routine is for parsing the address that the router assigned to the iChip.
    When you use the SEROUT2 statements with PORTC.3, what are you doing when you send ["iChipO OK"] and ["TEST_",DEC3 CNT, 13, 10]?
    PORTC.3 goes straight to a terminal for debugging. ["iChipO OK"] is what the iChip returns after a successful operation, I would pass that to a terminal to see if things were working. The code counts to 60 before an email is sent, ["TEST_",DEC3 CNT, 13, 10] is to see what the count is.
    Code:
    HIGH PORTC.4 :PAUSE 250: LOW PORTC.4: PAUSE 500 
    ' Is a crude "heart beat" to see if the MCU is running.
    Below is pretty much the same code but for a 18F4550 along with the hookup.
    I know, I should use more comments...
    Code:
    
    '<FL_PIC18F4550>'
    
    DEFINE OSC 48
    @ __CONFIG   _CONFIG1L, _PLLDIV_1_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 & _ICPRT_OFF_4L &_XINST_OFF_4L
    
        '############################  #
        ADCON1 = 001110
        CNT VAR BYTE
        CNT = 0
        OUT_TEMP VAR BYTE
        ADC_TEMP VAR WORD
        S_TEMP   VAR BYTE
        D_LAY   VAR BYTE
        ADR VAR BYTE [9]
        TX  VAR PORTD.6   ;ORANGE 
        RX  VAR PORTD.7   ;YELLOW 
        X_TEMP   VAR BYTE
        PAUSE 2000
        INTCON.5 = 1    'ENABLE TMR0
        T0CON = 000101  ON INTERRUPT GOTO TLOOP 
    
    
     BOOT:   'iCHIP SET UP
      SEROUT2 PORTC.0,16468,["TEMP OUTSIDE ",DEC OUT_TEMP,$d,$a,$d ,$a]   
      PAUSE 500SEROUT2 TX,6,[ "AT+I",$d ,$a]
      SERIN2 RX ,6,2500,BROKE,[ WAIT("I/OK") ]
      SEROUT2 PORTC.0,16468 , [ "iChip OK",$d,$a ]
      SEROUT2 PORTC.0,16468 , [ "TEST_" , DEC3 CNT , 13 , 10 ]
      SEROUT2 TX ,6 , [ "AT+iIPA?" , $d , $a ]
      SERIN2 RX ,6 , 2500 ,BOOT , [ DEC ADR[0] , DEC ADR[1] , DEC ADR[2] , DEC ADR[3] ]
      GOSUB DIP
      PAUSE 2000
      SEROUT2 TX,6,["AT+iWWW",$d,$a]
      SERIN2 RX,6,1000,BOOT,[WAIT("I/(")]
      ;#############################
        EMAIL_SET:
      SEROUT2 TX,6,["AT+iSBJ:MAC_ETHERNET",$d,$a] 
      SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
      SEROUT2 TX,6,["AT+iTOA:[email protected]",$d,$a]
      SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
      SEROUT2 TX,6,["AT+ito:MACKRACKIT",$d,$a]
      SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
      SEROUT2 TX,6,["AT+iREA:[email protected]",$d,$a]
      SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
      SEROUT2 TX,6,["AT+iFRM:MAC_ETH",$d,$a] 
      SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
      SEROUT2 TX,6,["AT+iSMTP:mail.mf3x3.com",$d,$a]
      SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
      SEROUT2 TX,6,["AT+iSMA=1",$d,$a]
      SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
      SEROUT2 TX,6,["AT+iSMP:booger",$d,$a]
      SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
      SEROUT2 TX,6,["AT+iSMU:[email protected]",$d,$a]
      SERIN2 RX ,6,2500,EMAIL_SET,[WAIT("I/OK")]
       FTP:
      CNT = CNT + 1 
      SEROUT2 TX,6,["AT+i",$d,$a]
      SEROUT2 TX,6,["AT+i!FCLS:000",$d,$a] 'CLOSE SESSION
      SEROUT2 TX,6,["AT+iFOPN:192.168.2.16:mac,999999",$d,$a]'OPEN SESSION
      SERIN2 RX,6,1000,BOOT,[WAIT("I/000")] 
      PAUSE 100
      SEROUT2 TX,6,["AT+iFCWD:000,ichip",$d,$a]
      SERIN2 RX,6,1000,BOOT,[WAIT("I/OK")]  
      SEROUT2 TX,6,["AT+iFSTO:000,",$22,"ichip.txt",$22,$d,$a] 
      SERIN2 RX,6,1000,BOOT,[WAIT("I/OK")]  
      SEROUT2 TX,6,["AT+iFSND:000,19:"," The temperature is",$d,$a]:PAUSE 100
      SEROUT2 TX,6,["AT+iFSND:000,2:",$d,$a]:PAUSE 100
      SEROUT2 TX,6,["AT+iFSND:000,18:",DEC OUT_TEMP," F In the shop.",$d,$a]:PAUSE 100  
      SEROUT2 TX,6,["AT+iFSND:000,2:",$d,$a]:PAUSE 100
      SEROUT2 TX,6,["AT+iFSND:000,12:",DEC CNT," MINUTES.",$d,$a]:PAUSE 100
      SEROUT2 TX,6,["AT+i!FCLS:000",$d,$a] 'CLOSE SESSION
      PAUSE 100
      SEROUT2 TX,6,["AT+i",$d,$a]':PAUSE 100
      SERIN2 RX,6,100,BOOT,[WAIT("I/OK")] :PAUSE 100
      GOSUB GET_TFOR D_LAY = 1 TO 120 
      PAUSE 500 
      NEXT D_LAY
      IF CNT = 2 THEN EMAIL
      IF CNT > 60 THEN CNT = 0  
      GOTO BOOT
      END
      EMAIL:
      SEROUT2 TX,6,["AT+iEMA:",$d,$a]
      SEROUT2 TX,6,["HI, THIS IS FROM MAC_ETH",$d,$a] 
      SEROUT2 TX,6,["SENT EVERY HOUR.",$d,$a]
      SEROUT2 TX,6,["THE TEMPERATURE IS.",$d,$a]
      SEROUT2 TX,6,[DEC OUT_TEMP,"F IN THE SHOP.",$d,$a] 
      SEROUT2 TX,6,["GO TO:",$d,$a]
      SEROUT2 TX,6,["http://mackrackit.com/mac/ichip/ichipw.py",$d,$a] 
      SEROUT2 TX,6,["FOR A ONE MINUTE UPDATE.",$d,$a]
      SEROUT2 TX,6,[$d,$a,".",$d,$a]
      SERIN2 RX,6,60000,BOOT,[WAIT("I/ONLINE")] 
      PAUSE 1000
      SEROUT2 PORTC.0,16468,["EMAIL SENT ",$d,$a]
      HIGH PORTD.0
      PAUSE 1000
      LOW PORTD.0
      GOTO BOOT
    
      DIP:
      IF !ADR[1] AND !ADR[1] AND !ADR[2] AND !ADR[3] THEN SEROUT2 PORTC.3,16780,[" NOT "]
      SEROUT2 PORTC.0,16468,[" CONNECTED ",$d,$a]
      SEROUT2 PORTC.0,16468,["ADR - " ,DEC3 ADR[0],".",DEC3 ADR[1],".",DEC3 ADR[2],".",DEC3 ADR[3],$d,$a]
      PAUSE 1000
      RETURN
    
      BROKE:
      SEROUT2 PORTC.0,16468,["NOT WORKING",$d,$a]
      PAUSE 500
      GOTO BOOT
    
      GET_T:
      ADC_TEMP = 0
      FOR X_TEMP = 1 TO 20
      ADCON0=00000001
      GOSUB READ_AD
      S_TEMP = ADRESH
      ADC_TEMP = ADC_TEMP + S_TEMP
      PAUSE 250
      NEXT X_TEMP
      OUT_TEMP = ADC_TEMP / 20
      OUT_TEMP = OUT_TEMP * 13/10
      RETURN
    
      READ_AD:
      PAUSE 50
      ADCON0.1=1
      WHILE ADCON0.2=1:WEND
      RETURN
    
      DISABLE
        TLOOP:
        INTCON.2=0:TOGGLE PORTD.0
        RESUME: ENABLE
    Attached Images Attached Images  
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    Nov 2011
    Posts
    26

    Default Re: mackrackit's ConnectOne example code

    Do you have a schematic diagram of your design?...

  11. #11
    Join Date
    May 2004
    Location
    brighton
    Posts
    149

    Default Re: mackrackit's ConnectOne example code

    i am waiting for delivery of Nano Lan Reach
    http://www.connectone.com/media/uplo...each_PB_01.pdf
    but i am not clear as to if i use one of your shelds as belowjust a few questions
    i would be using this with a pic18f452 running at 5v and i know the data sheets for the nano runs at 3v3
    if i do supply if it 3v3 do i need to to anything to the Tx/Rx lines or do they have to be 3v3 as well.
    On you board is this already taken care of

    Regards

    isaac

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

    Default Re: mackrackit's ConnectOne example code

    Yes, if you run the PIC at 5V and the ConnectOne module at 3.3V you will need to do level conversion in both directions.

    My shields have been delayed. I had a bout of atrial fibrillation resulting in a brief (4 day) hospitalization but some not so brief medical bills which have blown holes in my budget. All my projects have been set aside for the time being.

    The Spark Fun level shifter mentioned above should do what you need. (The AN213 link also shows a few different methods.) You need to deal with TX, RX & RESET. Outputs from the module (TX) need to be shifted up to 5V for input to the PIC, inputs to the module (RX, RESET) need to be shifted down to 3.3V.

  13. #13
    Join Date
    May 2004
    Location
    brighton
    Posts
    149

    Default Re: mackrackit's ConnectOne example code

    I hope you get better as quick as possible i now get it clearly

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