• AVR Freaks

Hot!RN4870 Advertisement Package size (Only 30 Byte?)

Author
MirkoL
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2018/02/05 08:04:35
  • Location: 0
  • Status: offline
2018/06/19 05:34:36 (permalink)
0

RN4870 Advertisement Package size (Only 30 Byte?)

Hello,
 
I have the following problem.
When setting the advertisement package manually, I seem to only be able to set 30 byte, even though 31 bytes are allowed.
I use the following in command mode:
"NA,Z" // Reset Advertisement package in permanent memory
"NA,01,06" // Set flag
"NA,06,11111111111111111111111111111111"  // Set custom 16 byte UUID
"NA,FF,1111111111111111" // Manufacturer specific data
Every field I am setting has a header size of 2 byte. The flag field has an actual size of 1 byte, the UUID field 16 byte, the manufacturer field 8 byte:
flag: 2 + 1 = 3
UUID: 2 + 16 = 18
manuf: 2 + 8 = 10
 
total: 3 + 18 + 10 = 31  --> In my opinion this should work.
 
But unfortunately I get an error when setting the last field. If I shorten it by one byte, it works.
I would welcome any tips or help. Maybe I just missed something.
 
Regards,
Mirko
#1

11 Replies Related Threads

    Jim Nickerson
    User 452
    • Total Posts : 6022
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/06/19 06:18:15 (permalink)
    0
    I wonder what code you are sending these strings with ?
     
    #2
    MirkoL
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2018/02/05 08:04:35
    • Location: 0
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/06/19 06:55:19 (permalink)
    0
    What do you mean by that?
    To prove this example I also used a dev board and putty in order to set these advertisement settings.
    I also used the nordic rfConnect app to see and check the resulting advertisement packet.
    #3
    Jim Nickerson
    User 452
    • Total Posts : 6022
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/06/19 07:03:59 (permalink)
    3 (1)
    It was not clear to me if you wrote code in a PIC or some other means to send the strings.
    If you used a terminal like program and typed in the strings maybe a terminating line feed was added to the text.
    #4
    MirkoL
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2018/02/05 08:04:35
    • Location: 0
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/06/19 07:42:00 (permalink)
    0
    Hi,
    thanks for the answer. I discovered this behavior on an embedded system, where there is an actual char array. So the terminating line feed should not be an issue. Also I checked the resulting advertisement field with a receiving android app and in case I use 30 byte, there is no line feed in the advertisement packet byte array.
    Did anyone check if they are able to utilize the 31 byte on a RN4870 or RN4871 (tested both). Because with a custom board and with the PIC it does seem to only accept 30 byte.
    #5
    Jim Nickerson
    User 452
    • Total Posts : 6022
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/06/19 07:54:54 (permalink)
    0
    maybe on the embedded system ( PIC ? ) the char array is declared like "some text".
    This would include a terminating null ( zero byte ).
    #6
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/06/19 08:01:13 (permalink)
    0
    JANickerson
    maybe on the embedded system ( PIC ? ) the char array is declared like "some text".
    This would include a terminating null ( zero byte ).




    Yep, for example old/some PIC C libraries for USART used to send ALSO the trailing null...

    GENOVA :D :D ! GODO
    #7
    MirkoL
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2018/02/05 08:04:35
    • Location: 0
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/06/19 08:04:24 (permalink)
    4 (1)
    Hello again,
     
    no the char array is not declared this way.
    When debugging I can see, that the string which is written to the uart is correct (for example "NS,FF,0000333435003030\r\n", where the terminating line feed is behind the newline and signals the end of the uart transmission. In memory this looks like (4e 53 2c 46 46 2c 30 30 30 30 33 33 33 34 33 35 30 30 33 30 0d 0a 00).
    Thanks again, any other ideas?
     
    #8
    JorgeF
    Super Member
    • Total Posts : 3340
    • Reward points : 0
    • Joined: 2011/07/09 11:56:58
    • Location: PT/EU @ Third rock from the Sun
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/06/19 13:05:43 (permalink)
    4 (1)
    Hi
    MirkoL
    "NS,FF,0000333435003030\r\n", where the terminating line feed is behind the newline and signals the end of the uart transmission. In memory this looks like (4e 53 2c 46 46 2c 30 30 30 30 33 33 33 34 33 35 30 30 33 30 0d 0a 00).

    I supose you mean "the carriage return (\r~0x0d) is behind the line feed (\n ~ 0x0a) aka newline.
     
    In the memory hexdump there is a terminating null like it should. Did you check if it is beeing sent, due to some bug in the function that does the sending?
    Like Dario mentioned, that bug has been around in the old days, maybe you just picked an old lib.
    For most terminal emulator type programs the 0x00 (NUL) is transparent, meaning it is simply ignored in terms of action and display, but it takes its place in the transmition buffer.
    Its a bit far fetched but it wont be nothing new.

    Best regards
    Jorge
     
    I'm here http://picforum.ric323.com too!
    And it works better....
    #9
    MirkoL
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2018/02/05 08:04:35
    • Location: 0
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/06/20 02:03:25 (permalink)
    3 (1)
    Hello,
    thanks again for your time.
    I use a simple hardware access and I am sure there is no trailing zero.
    Here is a small code example where 'str' is the string I posted above ("NS,FF,0000333435003030\r\n" - hexdump: 4e 53 2c 46 46 2c 30 30 30 30 33 33 33 34 33 35 30 30 33 30 0d 0a 00)
     
    uint32_t count = 0U;
    while(str[count] != '\0')
    {
      while(!(USARTx->ISR & USART_ISR_TXE)){}  // Waiting for the uart to finish transferring and going to ready state
      USARTx->TDR = str[count];  // Set the transmit data register

      count++;
    }
     
    With that in mind I am pretty sure, that there is no trailing zero.
    Using tera term I even went ahead and used the hex debug mode to see every character being sent and received --> no zero.
    So I am back to suspecting it is a firmware bug. Can anybody try to reproduce it? Maybe just use a PICtail board and enter the following:
     
    NA,Z    // Delete advertisement package content
    NA,09,5566556655665566556655665566556655665566556655665566556655  // 29 byte of Device Name
     
    After that I always get an error--> One byte less and it works.
    Thanks again for all your help.
    #10
    MirkoL
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2018/02/05 08:04:35
    • Location: 0
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/06/25 01:14:31 (permalink)
    0
    A colleague of mine confirmed the issue to it seems to be a bug.
    #11
    rsocor01
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2009/12/25 15:23:54
    • Location: Miami, Florida
    • Status: offline
    Re: RN4870 Advertisement Package size (Only 30 Byte?) 2018/10/02 16:17:08 (permalink)
    0
    Hmmm, interesting. I've been playing with the rn4020 and the user guide says that it can advertise 25 bytes after the N command. However, only 24 bytes can be sent. If I try to send 25, then it doesn't work.
    #12
    Jump to:
    © 2019 APG vNext Commercial Version 4.5