This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF8001 Configuration in nRFgo Studio

Hello!

I have some problem to generate the right service.h file with nRFgo Studio. I used the help in nRFgo Studio and tried several configurations. Sometimes I could connect with Nordic's "nRF Connect" app but when i try to use the "nRF UART" app it says "uart is not supported".

I tried the setup commands from the Hello World Program from the Arduino SDK and I can connect with both apps, send data in both directions, from the phone to the nRF8001 and from the nRF8001 to the phone.

Now I would like to change the connection intervall as it changes the current consumption (nRFgo Studio --> current consumption).

First approach: I use the service.h file from the Hello World program and change the connection intervall with a command. There is no command to change the connection intervall, it can just changed with the setup generate in nRFgo Studio. Is that right? With the connect(0x0F) command just the advertising intervall can be defined, right?

Second approach: I use the same configuration in nRFgo Studio as used with the Hello World program, change the connection intervall and generate the service.h file. But for this approach I need to know which configuration is used in the Hello World program.

Would be great if you tell me the services I have to use and the GAP settings. I just want to send some data in the same way as it is done in the Hello World demo. I am new to BLE and and could miss something important in nRFgo studio.

Thank you very much.

Parents
  • There are two ways to generate a connection parmater update request using the nRF8001.

    lib_aci_change_timing and lib_aci_change_timing_GAP_PPCP.

    GAP PPCP uses the timing parameters configured in nrfgo studio.

    If you are not able to generate the correct URAT service in nRFgo studio you probably have the wrong uuid. Check the configuration files for the sdk example.

  • Thank you for the hint with the uuid. I could generate my own service where I can send 20 bytes. I receive the data correct on the phone.

    To change the connection interval I tried to change the maximum/minimum connection interval in the nRFgo studio before generating the service.h file. I tried min/max: 7.5ms/20ms and 1000ms/1100ms but it seems that it has no effect.

    Sending 20 times 20Bytes takes about 1.94 seconds with both connection interval settings.

    I added a shunt resistor in the power supply line and measured the voltage (supply current) with a scope. I see peaks every ~48ms. I assume that the peaks in the supply current indicates that the nRF8001 is sending? Does this mean the connection interval is 48ms?

    See the voltage on the resistor:

  • Yes, this looks like the connection interval. Please note that the connection interval is set by the central device. The nRF8001 can only send a connection parameter update request, but it is up to the central if it wants to update the parameters or not.

    As mentioned in my previous answer there are to functions you can use to tell the nRF8001 to send a conn param update request. One of these has to be called after the connection has been established.

    Note that the ConnectedEvent (0x85) will contain the connection interval set by the master. If the timing is changed later on you will receive a TimingEvent (0x89). Please refer to the product specification for the event format.

Reply
  • Yes, this looks like the connection interval. Please note that the connection interval is set by the central device. The nRF8001 can only send a connection parameter update request, but it is up to the central if it wants to update the parameters or not.

    As mentioned in my previous answer there are to functions you can use to tell the nRF8001 to send a conn param update request. One of these has to be called after the connection has been established.

    Note that the ConnectedEvent (0x85) will contain the connection interval set by the master. If the timing is changed later on you will receive a TimingEvent (0x89). Please refer to the product specification for the event format.

Children
  • I am using an Android phone and I read that the connection interval cannot be changed on Android. A connection parameter update request has to be sent from the nRF8001 to change it, is this right? I am using a simply serial bluetooth terminal app and there is no options to change the connection parameters.

    After connection between the phone and the nRF8001 the MCU receives following data: 0x1 0xF 0x85 0x3 0x9A 0x30 0xB5 0xC7 0xEF 0x4D 0x27 0x0 0x0 0x0 0xD0 0x7 0x5 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 

    Then I send the ChangeTimingRequest: 0x09,0x13,0x60,0x00,0x08,0x00,0x00,0x00,0x01,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

    Data has to be LSB first:

    Interval min = 6 (=7.5ms) = 0000.0000.0000.0110 --> 0110.0000.0000.0000 = 0x6000
    Interval max = 16 (=20ms) = 0000.0000.0001.0000 --> 0000.1000.0000.0000 = 0x0800
    Slave latency = 0x0000
    Timeout = 3200 = 0000.1100.1000.0000 --> 0000.0001.0011.0000 = 0x0130

    After the ChangeTimingRequest I receive a CommandResponseEvent with status=succes:

    0x1 0x3 0x84 0x13 0x0 0x8 0x0 0x0 0x0 0x1 0x30 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0

    The TimingEvent I receive after the CommandResponseEvent shows still the same connection parameters as in the ConnectedEvent:

    0x1 0x7 0x89 0x27 0x0 0x0 0x0 0xD0 0x7 0x1 0x30 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0

    Is this the right sequence to change the timing parameters? Why does the TimingEvent still show the same parameters?

    Thank you very much for your help.

  • Unfortunately there us no way to force the master to update the connection interval. It might be that you will not be able to get an interval within the given range with this master. It looks like the sequence is correct to me, but you could try to ask for a longer interval instead, as that is more likely to be accepted. This is just to see that you are using the correct sequence. Then use the intervals above and slowly increase the values until you get something the master accepts, hopefully that will be fast enough for your application

  • I tried different connection intervals on 2 different phones but unfortunately the result is always the same.

    Interval min = 80 (=100ms) = 0000.0000.0101.0000 --> 0000.1010.0000.0000 = 0x0A00
    Interval max = 160 (=200ms) = 0000.0000.1010.0000 --> 0000.0101.0000.0000 = 0x0500
    Slave latency = 0x0000
    Timeout = 3200 = 0000.1100.1000.0000 --> 0000.0001.0011.0000 = 0x0130

    Data send: 0x09,0x13,0x0A,0x00,0x05,0x00,0x00,0x00,0x01,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

    Interval min = 40 (=50ms) = 0000.0000.0010.1000 --> 0001.0100.0000.0000 = 0x1400
    Interval max = 80 (=100ms) = 0000.0000.0101.0000 --> 0000.1010.0000.0000 = 0x0A00

    0x09,0x13,0x14,0x00,0x0A,0x00,0x00,0x00,0x01,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

    Interval min = 16 (=20ms) = 0000.0000.0001.0000 --> 0000.1000.0000.0000 = 0x0800
    Interval max = 40 (=50ms) = 0000.0000.0010.1000 --> 0001.0100.0000.0000 = 0x1400

    0x09,0x13,0x08,0x00,0x14,0x00,0x00,0x00,0x01,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

    Interval min = 6 (=7.5ms) = 0000.0000.0000.0110 --> 0110.0000.0000.0000 = 0x6000
    Interval max = 16 (=20ms) = 0000.0000.0001.0000 --> 0000.1000.0000.0000 = 0x0800

    0x09,0x13,0x60,0x00,0x08,0x00,0x00,0x00,0x01,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

    The CommandResponseEvent shows in all cases the same data:

    0x1 0x3 0x84 0x13 0x0 0xA0 0x0 0x0 0x0 0x1 0x30 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0

    And the TimingEvent is also the same for all connection intervals:

    0x1 0x7 0x89 0x27 0x0 0x0 0x0 0xD0 0x7 0x1 0x30 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0

    What is the right interpretation of the connection interval 0x27 0x00? The datasheet says MSB first. This would be 0x2700=9984 and out of the valid range? LSB/MSB in the datasheet means least significant byte or bit first?

    The used phones are Honor6 and LG L90, bot support Bluetooth 4.0. This should be ok?

    Thank you for your help!!!

  • I was able to solve the problem with the PCA10000 USB dongle. The problem was the wrong data format I used. The bytes has to be switched, not the bit order. For example to set the min/max value to 100ms, the value has to be set to 80 (80*1.25=100ms). 80=0x0050 --> the right data I had to send was 0x50 0x00.

    It seems that my phone doesn't support connection intvals lower than 48.75ms. I could change the connection interval down to 7.5ms when connected to the USB dongle. When the nRF8001 is connected to the phone to minimum connection interval is 48.75ms.

    I have another question: I want to send 20 x 20bytes and it takes 300ms. I assume that 2 connection events are needed to send 20 bytes (2 x 20 x 7.5ms = 300ms). Is that right? Why are 2 connection events needed to transmit 20bytes? Is there a way to send more data in one connection event/interval to reduce the time it takes to send the data?

    Thanks for your help!!

  • If you use notifications you should be able to send one data packet per connection event. This is the maximum supported by the nRF8001. If you use indications you will need 2-3 connection events per data packet as this requires application layer acknowledgement.

Related