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

nRF8001: interpreting logic data

I'm running the ble_my_project_template example from ble-sdk-arduino, and listening to the ACI lines with a logic analyzer. Here is what I found in the first transmission, in which RDY is pulled low before REQ. One row for each byte transferred.

| MOSI | MISO | Meaning                    |
|------|------|----------------------------|
| 0    | 1    |                            |
| 15   | 4    | (len)                      |
| 180  | 129  | DeviceStartedEvent         |
| 0    | 3    | - Operating mode (standby) |
| 0    | 0    | - HW error                 |
| 1    | 2    | - Data credit available    |
|------|------|----------------------------|

I'm not sure about the first byte (MOSI=0, MISO=1). What does this mean? Secondly, I'm not sure how to interpret what the Master is transmitting (while it's really the Slave who initiated the transmission to give an asynchronous event (?)). Where in the nRF8001 PS can I find this?

  • I would expect the first byte of MOSI to be 5, which is the length of Connect command (15).

    This is the serial output:

    Arduino setup
    Evt Device Started: Setup
    Evt Device Started: Standby
    Advertising started
    

    I'm also puzzled that Evt Device Started happens with mode = Setup. In the decoding done by Logic (with LSBit first, 8 bits per transfer, CPOL = CPHA = 0, Enable line is active low, and using RDY as enable line) there are no 129 followed by 2 that makes this possible. Decoded logic data: bpaste.net/.../252237975ab0

  • Now I see that when I press Reset to start everything again (as I do when I start Logic capture), I get errors in serial output:

    Evt Device Started: Standby
    Advertising started
    Evt Device Started: Standby
    HW error: 572
    ll_ctrl.s0.c�⸮⸮⸮u1 ���
    Advertising started
    Evt Device Started: Standby
    HW error: 572
    ll_ctrl.s0.c�⸮⸮⸮u1 ���
    Advertising started
    Evt Device Started: Standby
    HW error: 572
    ll_ctrl.s0.c�⸮⸮⸮u1 ���
    

    ETC

    But when I restart the arduino by uploading the program it works like in the original post.

  • Doing the logic capture after Uploading the code, the decoded data makes more sense: This time MISO starts with (after the first byte (1)) 4, 129, 2, 0, 2 which is as expected. But MOSI still starts with 0, 15, 180 ... which makes no sense to me.

  • The nRF8001 will always send a device started event after power on reset. Usually with a started in setup mode event, but this could also be a standby event, if the configuration was previously writen to OTP. MOSI will use a lenght of 0 as it doesn't have anything to send to the slave in this case. it should use the length field of the received packet to see how many bytes it needs to clock out. What follow after the 0 depends on what is in the MOSI buffer, as long as the length is zero the nRF8001 doesn't care about this. Of course you could clear the whole buffer as well, but it's not needed.

  • Thanks for the answer. But what does the second value of MOSI mean then (15, in the original post)? Is Master really sending a packet of 15 bytes?

Related