0

LE SPI Friend issues
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

LE SPI Friend issues

by gebov on Mon Apr 05, 2021 4:41 am

Hello,

I am trying to use the LE SPI friend. My firmware version is 0.6.5. I tried updating the firmware version because I am struggling with connection issues and thought that might help but every time I try to update, it gets to 43% and fails with the error message DFU Service disconnected. Is that a problem with the Android APP or the module ?

As for the connectivity issues I am hooking it up to a S32K144 dev board from NXP with FLEXIO. However I have failed so far to achieve anything using the samples provided by NXP. I will try with a different MCU as well to confirm if everything is OK with the communication. For now the board seems to answer to the AT commands from the Android APP.

gebov
 
Posts: 7
Joined: Mon Apr 05, 2021 4:37 am

Re: LE SPI Friend issues

by adafruit_support_carter on Tue Apr 06, 2021 3:22 pm

Do you have a board available that would allow you to use the BLE SPI Friend per the guide?
https://learn.adafruit.com/introducing- ... i-breakout

adafruit_support_carter
 
Posts: 20352
Joined: Tue Nov 29, 2016 2:45 pm

Re: LE SPI Friend issues

by gebov on Mon Apr 12, 2021 7:11 am

No sadly, I conducted numerous tests following the guide here https://learn.adafruit.com/introducing- ... -transport
And inspecting the source code for the Arduino module. I am receiving some strange bytes when I send the following message: 0x10 0x01 0x0A 0x01 0xFF which are never consistent - 0x80, 0x7F 0xFF, 0xFE. Some of these are error codes but I cannot see what I am doing wrong. Here is my code. I have based it on the arduiono code in github. I've left comments for reference

PTB->PSOR |= 1<<17; // bring CS high
for(i = 0; i < 4000; i++) // wait a bit
{

}

PTB->PCOR |= 1<<17; // bring CS low

while(1)
{
LPSPI1_transmit_16bits(buffer[0]); // transmit 0x10
LPSPI1_16bits_read = LPSPI1_receive_16bits(); // wait for the reply
if (LPSPI1_16bits_read != 0xFE)
break;
}


for(i = 1; i < 4; i++)
{
LPSPI1_transmit_16bits(buffer[i]); // transmit the rest of the bytes
}

PTB->PSOR |= 1<<17; // set CS high again

I cannot neither receive nor sent any proper response in the Android App. I am starting to think that this board is defective.

gebov
 
Posts: 7
Joined: Mon Apr 05, 2021 4:37 am

Re: LE SPI Friend issues

by adafruit_support_carter on Mon Apr 12, 2021 10:37 am

You would need to find some way to verify the behavior by using it per the guide. It may have something to do with FLEXIO.

adafruit_support_carter
 
Posts: 20352
Joined: Tue Nov 29, 2016 2:45 pm

Re: LE SPI Friend issues

by gebov on Thu May 27, 2021 3:56 pm

Hello,

I succeeded in communicating with the SPI module with a different board than the Arduino.

The question that I now have is that I am successfully able to send the commands AT, ATI AT+HELP from my board to the Adafruit SPI module(and recieve the proper responses), but any other command results in ERROR \n response text. The command I am testing is AT+GATDEVNAME.

Other at commands are resulting in error as welll. My board revision is 0.6.5.

gebov
 
Posts: 7
Joined: Mon Apr 05, 2021 4:37 am

Re: LE SPI Friend issues

by adafruit_support_carter on Thu May 27, 2021 4:09 pm

The command I am testing is AT+GATDEVNAME.

Where are you finding reference to that command?

adafruit_support_carter
 
Posts: 20352
Joined: Tue Nov 29, 2016 2:45 pm

Re: LE SPI Friend issues

by gebov on Thu May 27, 2021 8:44 pm

Sorry, I misspelled it here in the forum. The name is AT+GAPDEVNAME

https://learn.adafruit.com/introducing- ... -2176685-8

gebov
 
Posts: 7
Joined: Mon Apr 05, 2021 4:37 am

Re: LE SPI Friend issues

by gebov on Thu May 27, 2021 8:50 pm

I should mention that the same AT command (AT+GAPDEVNAME) works through the mobile app after sending +++.

gebov
 
Posts: 7
Joined: Mon Apr 05, 2021 4:37 am

Re: LE SPI Friend issues

by adafruit_support_carter on Fri May 28, 2021 10:29 am

That's the mode switching command:
https://learn.adafruit.com/introducing- ... 2176540-11
So for the errors you are getting with the other AT commands, maybe you are in the wrong mode there also?

adafruit_support_carter
 
Posts: 20352
Joined: Tue Nov 29, 2016 2:45 pm

Re: LE SPI Friend issues

by gebov on Fri May 28, 2021 1:40 pm

Actually the AT commands that work do not require a context switch from data to command mode. They just work without me sending the +++ command from my board. They +++ command is required from the mobile app only.

The other strange thing is that when I send +++ from the mobile app i get a response "1 OK" or "0 OK" for entering and exiting command mode respectively. Whereas from my board when sending +++ I always recieve an "OK" and the command itself does not mae a difference for the AT commands that do not work.

gebov
 
Posts: 7
Joined: Mon Apr 05, 2021 4:37 am

Re: LE SPI Friend issues

by adafruit_support_carter on Fri May 28, 2021 2:27 pm

Are you still using flexio?

adafruit_support_carter
 
Posts: 20352
Joined: Tue Nov 29, 2016 2:45 pm

Re: LE SPI Friend issues

by gebov on Fri May 28, 2021 11:31 pm

No, i am no longer using the s32k144 board either. I have a HCS12 mcu that is currently hooked with the SPI port.

I am attaching my code here for reference. My code is based on the code that was provided in github for the arduino.

As you can see I initially attempt to send the at command for reading the device name(atCommandSetDeviceName). It does not matter if i use it in read mode or write mode. The result is the same - i recieve "ERROR".

Placing the command AT or ATI in the place of atCommandSetDeviceName works fine and returns "OK" and the device info respectively. I even tried initially sending +++ before i send any AT command but there is no effect. And like I said, the AT and ATI commands work fine without sending the +++ command
Attachments
main.c
(6.9 KiB) Downloaded 3 times

gebov
 
Posts: 7
Joined: Mon Apr 05, 2021 4:37 am

Re: LE SPI Friend issues

by adafruit_support_carter on Tue Jun 01, 2021 11:36 am

It may be something with your C code? We can only support usage per the product guide.
https://learn.adafruit.com/introducing- ... i-breakout

adafruit_support_carter
 
Posts: 20352
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.