cancel
Showing results for 
Search instead for 
Did you mean: 

SPBTLE-RF dialog over SPI

bastien
Associate
Posted on March 31, 2016 at 11:41

Hi,

I'm currently working on using SPBTLE-RF module with the evaluation board of the KL25Z from Freescale.

After I set up the SPI interface, I tried a byte-communication with the module by sending Write Header ( 0x0a, 0x00, 0x00,0x00, 0x00), some data (supposed to be HCI command, see further) and then the Read Header ( 0x0b, 0x00, 0x00,0x00, 0x00) in order to get something in return . 

Here is what I send/receive :

---- START ----

 

****

 

SLAVE HEADER WRITE

 

0x02    0x7F    0x00    0x07    0x00

 

****

 

Received : 0xFF

 

Sent : 0x01

 

Received : 0xFF

 

Sent : 0x09

 

Received : 0xFF

 

Sent : 0x04

 

Received : 0xFF

 

Sent : 0x00

 

****

 

SLAVE HEADER READ

 

0x02    0x00    0x00    0x00    0x00

 

****

 

---- END ----

Whenever I try to read some data (by sending read header) coming from the module after performing a write operation (by sending write header, even without data), the slave seems to announce that he's ready (CTRL byte = 0x02) but he hasn't anything to offer (W/RBUF_lo/hi = 0x00).

Plus, if I try to read data without sending any write request before, here is what I get :

---- START ----

 

****

 

SLAVE HEADER READ

 

0x02    0x7D    0x00    0x07    0x00

 

****

 

READ RECEPTION BUFFER

 

Received : 0x04

 

Received : 0x0F

 

Received : 0x04

 

Received : 0x01

 

Received : 0x01

 

Received : 0x09

 

Received : 0x04

 

---- END ----

I'm quite new to SPI communications, am I doing this right ? 

About using HCI commands, is there any special formatting step before sending that I could missed ? Is it even possible to send that kind of frame with direct bytes on the SPI bus ?

Thanks,

B.TOMAS

#hci #spi #kl25z #spbtle-rf
4 REPLIES 4
bastien
Associate
Posted on April 04, 2016 at 09:51

I've managed to use some HCI commands provided for the STM32, but I still have the same issue with null buffers :

SLAVE HEADER READ

 

0x02    0x00    0x00    0x00    0x00

 

But thanks to the HCI commands retrying mecanism, I received (randomly) some data from the module (like the BT address), immediatly followed by the HCI event ''Hardware Error'' :

</colgroup>

Received : 0x04 HCI Event

Received : 0x10 Event Code Evt_Hardware_Error

Received : 0x01 Parameter Total Length 1

Received : 0x00

Some posts on this forum mentionned a firmware issue, that an update could resolve some problems, if anyone can confirme ?I'm now trying to integrate a new SPBTLE-RF chip to figure out if I'm facing a factory default or not.
Frank Weissenborn
Associate II
Posted on December 09, 2016 at 13:44

0x02 0x00 0x00 0x00 0x00 means that the controller needs some time to initialize buffers.

Try sending header again until buffers are initialized.

CS_HIgh

Wait(1ms)

CS_Low

Sending header

--> get Buffer Size

if(buffer > 0) {read/write data}

CS_High

Posted on October 27, 2017 at 13:12

I have the same problem interfacing the SPBTLE-RF and a STM32L4 on a custom board. 

I received on the SPI the 0x02 (SPI OK) and then 0x00 for the buffer. 

I tried to send the header several time, but it's not working either... 

Tomas did you figure out what was the problem? 

Thanks 

Posted on October 31, 2017 at 15:06

Hi Jean,

I suggest to refer to the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software-expansion/x-cube-ble1.html

software package, which comes with examples preconfigured for different STM32 Nucleo boards and includes support for STM32L4.

This thread is very old and is related to a completely different setup, as the original poster wasn't using an STM32 microcontroller at all. If you have any issues with your hardware, you'd better start a new discussion where you add more details about your own configuration.

Best regards,

Antonio