RN 171 WiFi module


+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2006
    Location
    Brasil, Sao Paulo, Campinas
    Posts
    54

    Default RN 171 WiFi module

    Hi all,

    Somebody alread used the RN171 wifi module with PBP?
    I am working with this module but using a C code for while. I would like of to use basic to config it. I will apreciate some example code about it to use as basis.

    Thanks

    Pimentel

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    1,913

    Default Re: RN171 wifi module

    a search with "rn-171 " gets a few hits

  3. #3
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305

    Default Re: RN171 wifi module

    Rather than starting a new thread, I'll tack on to the bottom of this one.

    I have a RN 171 connected to a 18F2550. I can receive commands via usb and serout them to the RN 171 but I'm not getting a response. I can see data to and from the RN 171 but I cant get it to load in to a variable using serin. I've seen a few examples of this issue on the forum but no one documented how they fixed it.

    Code:
    serout  PORTC.6,2,[text, text1, text2]
    serin PORTC.7,6,2000, main1, [wifi]
    WRITE 50, wifi.0
    write 51, wifi.1
    write 52, wifi.2
    write 53, wifi.3
    write 54, wifi.4
    write 55, wifi.5
    write 56, wifi.6
    write 57, wifi.7
    ARRAYWRITE USBTXBuffer, [wifi]
    GOSUB WaitToSend
    Note that I used mode 2 for serout and mode 6 for serin. If I use mode 2 for serin, it times out and jumps to my "didnt get any data" routine at main1. Currently, using mode 6, wifi is full of 0's and it repeats the loop sending text1, text2, text3 again.

  4. #4
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333

    Default Re: RN171 wifi module

    Do not include [ ] for serin item as these are used around a qualifier.

  5. #5
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305

    Default Re: RN171 wifi module

    Nice catch.

    However I only get 1 byte so in looking at the manual I need to use SERIN2 with the STR qualifier. Awesome I think, then I modify the code to the following and now I get nothing again. It hangs at SERIN2 until the time is up then it jumps to my loop again. Wifi is defined as BYTE[16]


    Code:
    serin2 portc.7,84,250, main1, [STR wifi\16]
    WRITE 50, wifi.0
    write 51, wifi.1
    write 52, wifi.2
    write 53, wifi.3
    write 54, wifi.4
    write 55, wifi.5
    write 56, wifi.6
    write 57, wifi.7
    write 58, wifi.8
    write 59, wifi.9
    write 60, wifi.10
    write 61, wifi.11
    write 62, wifi.12
    write 63, wifi.13
    write 64, wifi.14
    write 65, wifi.15

  6. #6

    Default Re: RN171 wifi module

    Code:
    serin2 portc.7,84, [STR wifi\16]    'wait here till 16 total bytes rcvd
    
    'now, 16 bytes are in wifi array starting at wifi[0]
    'toggle led or something to tell you got 16 new bytes
    
    continue on....................

  7. #7
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333

    Default Re: RN171 wifi module

    Quote Originally Posted by jmgelba View Post
    Nice catch.

    However I only get 1 byte so in looking at the manual I need to use SERIN2 with the STR qualifier. Awesome I think, then I modify the code to the following and now I get nothing again. It hangs at SERIN2 until the time is up then it jumps to my loop again. Wifi is defined as BYTE[16]


    Code:
    serin2 portc.7,84,250, main1, [STR wifi\16]
    WRITE 50, wifi.0
    write 51, wifi.1
    write 52, wifi.2
    write 53, wifi.3
    write 54, wifi.4
    write 55, wifi.5
    write 56, wifi.6
    write 57, wifi.7
    write 58, wifi.8
    write 59, wifi.9
    write 60, wifi.10
    write 61, wifi.11
    write 62, wifi.12
    write 63, wifi.13
    write 64, wifi.14
    write 65, wifi.15
    Serin2 is waiting for 16 characters to be received if you do not send 16 characters it will eventually time out. This is a common issue with serial communication however SERIN2 gives you the "tools" to overcome this.

    I use a start character to indicate the start of a command string and an end character as a termination, which is not unusual. A commonly used start character is "!" and end character is $0D (CR). You could follow the LCDOUT protocol and use $FE as the start character the choice is yours.

    Having decided which start and end characters to use modify your code and obviously include the start and end characters in the string you are sending.


    Code:
    serin2 portc.7,84,250, main1, [WAIT("!"),STR wifi\16\%0D]
    WRITE 50, wifi.0
    write 51, wifi.1
    write 52, wifi.2
    write 53, wifi.3
    write 54, wifi.4
    write 55, wifi.5
    write 56, wifi.6
    write 57, wifi.7
    write 58, wifi.8
    write 59, wifi.9
    write 60, wifi.10
    write 61, wifi.11
    write 62, wifi.12
    write 63, wifi.13
    write 64, wifi.14
    write 65, wifi.15

  8. #8
    Join Date
    Sep 2009
    Posts
    716

    Default Re: RN171 wifi module

    jmgelba,
    It's not clear to me what you are trying to do with write command....
    WRITE 50, wifi.0 - this will write only one bit, just 0 or 1
    WRITE 50, wifi[0] - this will write only byte from array

  9. #9
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166

    Default Re: RN171 wifi module

    I was going to say the same thing. Misuse of the indexing modifier. Byte indexing should use "[x]" and bit indexing should use ".x"
    Dave Purola,
    N8NTA
    EN82fn

  10. #10
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305

    Default Re: RN171 wifi module

    I cant assign a start and end character because the module returns many different responses depending on circumstance and they can be different lengths.
    I did indeed screw up the bit vs byte indexing, and this is what is causing my issue with this test code. I made the changes and I can now write the bytes to EEPROM which I can read. I now have to figure out how to send those bytes as a string out the USB port, unless I do they byte to text conversion on the PC side.

  11. #11
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333

    Default Re: RN171 wifi module

    Quote Originally Posted by jmgelba View Post
    I cant assign a start and end character because the module returns many different responses depending on circumstance and they can be different lengths. I now have to figure out how to send those bytes as a string out the USB port, unless I do they byte to text conversion on the PC side.
    Can you give examples of the responses is there a common termination character?. On the PC side ASCII characters are usually the default. So I guess you are sending ASCII characters from the PC to the PIC over USB which is then transmitted to the wifi module. Does the wifi module respond with ASCII characters?

Similar Threads

  1. New WiFi Module
    By dhouston in forum WiFi
    Replies: 14
    Last Post: - 15th February 2017, 09:27
  2. Serial WiFi module
    By Art in forum WiFi
    Replies: 12
    Last Post: - 6th December 2015, 03:50
  3. PIC with WIFI module
    By JAWORSKI in forum Schematics
    Replies: 2
    Last Post: - 3rd December 2008, 03:19

Posting Permissions

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