I don’t know how it is supposed to work on arduino, but on the Photon you only have to call SPI1.begin once (and every time you close it with SPI1.end). The library I wanted to port calls “SPI1.begin” rather generously. I forgot that little but important difference. C++ doesn’t work like C# and objects are copied by value rather than by reference. Connect to your Arduino or other microcontroller using the common four-pin SPI interface (MISO, MOSI, SCK and CS/SSEL) plus a 5th GPIO pin for interrupts (to let the Arduino know when data or a response is ready). I wanted to save the SPI object into a variable so I could easily switch between SPI and SPI1. The Bluefruit LE SPI Friend makes it easy to add Bluetooth Low Energy connectivity to anything that supports SPI communication. It’s a little while since I developed in C++ and I forgot a few basics. If anyone has a similar problem porting an arduino library, here is what was wrong in my case: I’d be happy to make the port available to the community, if by some miracle I’ll manage to make it work The library, I’m trying to port, can be found here: I am using the latest firmware on both, the photon and the module. The module should indicate, that there is data available, by setting the IRQ pin to hight, but the pin is never high (so no data available). After sending a command, the photon expects an answer. While looking for answers I came across the “SETCLOCKDIVIDERREFERENCE” function, but I don’t think I need to use it since I don’t call the SetClockDivider function anywhere. While porting the library, I used the same settings: SPIClass UsedSPI = SPI1 The library initially set the SPI settings to 4MHz, MSBFIRST and SPI_MODE0: SPISettings bluefruitSPI(4000000, MSBFIRST, SPI_MODE0) I am using hardware SPI, however, I also tried to use software SPI, there was no difference. I double checked the connections, all pins are connected correctly. While triggering the factory reset of my module works just fine (using the RST pin, sending the “AT+FACTORYRESET” command doesn’t work), there doesn’t seem to flow any information from the photon to the module or vice versa. I connected the module to the SPI1 pins, the IRQ pin is connected to D6 and the RST pin is connected to D7 and the CS pin of the module is connected to D5 (I am also defining D5 as the SS pin). There is port available yet for the photon, but porting the arduino library was relatively simple (or so I thought). I recently got my hands on an Adafruit Bluefruit LE SPI Friend module. Is a reference to the extension saved in my AI2 companion which might explain why the app worked on one phone and not the other because each companion had a reference to a different extension.Īnyway, hopefully I can now move forward.I have compatibility problems with the above mentioned module and I hope any of you guys will be able to help. So I am not sure what is going on, I assumed that because I had downloaded and installed the latest BluetoothLE extension at the beginning of my developments that it was always applied in any future or past app I developed but when I start a new app I have to go through the process of installing the BluetoothLE extension again. From this point everything has been working ok. This obviously didn’t work so I deleted and reinstalled the app again but this time I selected import extension and then it showed updating. ![]() I then deleted the BluefruitLEDcontroller.aia app I had been working on and re-installed it but I noticed that the BluetoothLE extension was version 2 so I deleted the extension (without heeding the consequences of the message about all block references being removed) and installed the latest extension. I cant remember all the stages but at some point the BluefruitLEDcontroller.aia app on my phone froze and the only way out was to uninstall then reinstall the MIT companion, is this where things went wrong? ![]() At this stage I switched to a second phone and both apps work on that. I then went back to my first app and that had now stopped functioning as well. All went well for about a day and half then this app stopped finding BLE devices. The next app I developed by downloading the BluefruitLEDcontroller.aia file and then modifying it. My first MIT app I built following the online instructions which included downloading and installing the latest BluetoothLE extension. I think my problems are associated with updating the BluetoothLE extension but I don’t understand why.Īn explanation of what I did may be of interest:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |