
3. The external uC must wait for the SPI IRQ signal to become high and then start to transfer the five bytes of
the header that includes the control field with the intended operation. In addition, the external uC reads five
bytes from the BlueNRG-2N, which include information about the actual size of the read and write buffer.
4. The external uC, after checking the five bytes of header, performs data transaction.
5. The BlueNRG-2N lowers SPI IRQ signal after the five byte headers are transferred, but due to internal
processing, this could be done also during the data transfer phase.
6. The external uC must wait for the SPI IRQ to be low before raising the SPI CS signal to mark the end of the
communication.
Some important notes are:
• Setting the SPI CS signal low wakes up the BlueNRG-2N if the device is asleep
• If the SPI IRQ signal is low before setting the SPI CS signal low, the BlueNRG-2N has no data events for the
external uC, so the read buffer size is zero (RBUF=0)
• The time t1 is the time between wake-up (point a in Figure 14. Generic SPI transaction) and the
BlueNRG-2N ready to perform the SPI transaction (point b in Figure 14. Generic SPI transaction). The t1
time range is from minimal value (the BlueNRG-2N already awakes when the SPI CS is asserted), to a
maximum value that involves wake-up sequence and software boot
• Even if there are events pending after the end of the transaction, the SPI IRQ signal goes low to allow the
BlueNRG-2N to update five byte headers and to re-arm the SPI for the next transaction (after this delay the
SPI IRQ signal goes high again if events are pending)
• The SPI CS signal marks the beginning and end of the transaction
• The SPI CS high marks the end of the transaction and must be set to high only when IRQ line is low
• The gap between the header and the data is not mandatory, but it is normally required by the external uC to
process the header and check if there is enough space in the buffers to perform the wanted transaction
• When the SPI IRQ signal is high, the five byte headers are locked and cannot be modified by the
BlueNRG-2N firmware
Figure 15. SPI header format
• The header of the external uC (the SPI master) is on the MOSI line, which is composed of one control byte
(CTRL) and four bytes 0x00. CTRL field can have only the value of 0x0A (SPI write) or 0x0B (SPI read). The
BlueNRG-2N returns the header on the MISO line at the same time. When the BlueNRG-2N asserts the SPI
IRQ signal, it is ready. Otherwise, the BlueNRG-2N is still not initialized. The external uC must wait for the
IRQ line to become high and perform a five bytes transaction.
The five bytes in the MISO line gives one byte of starting frame, two bytes with the size of the write buffer
(WBUF) and two bytes with the size of the read buffer (RBUF). The endianness for WBUF and RBUF is LSB
first. The value in WBUF means how many bytes the master can write to the BlueNRG-2N. The value in
RBUF means how many bytes in the BlueNRG-2N are waiting to be read by the external uC
Read transaction
A read transaction is performed when the BlueNRG-2N raises the SPI IRQ line before the SPI CS signal is
lowered by the external uC.
BlueNRG-2N
SPI communication protocol
DS13280 - Rev 1 page 21/47