Is there a difference between Photon and P1 regarding SPI?

We developed our code on a Photon. The SPI connection with a bluetooth chip worked flawlessly. For our first prototypes we decided to use the P1 chip and we use SPI1 instead of SPI. We also changed the code appropriately. The problem is, that now we don’t get any useful data anymore. We checked the connections, the hardware is not the problem.

We tried lowering the frequency, explicitely setting the SS pin (it’s pin 24), nothing worked.
Is there any difference between Photon and P1? Does the framework handle the SPI pins or do we have to handle them manually? The hardware SPI connections are set up correctly, we used the P1 pinout to connect them and checked twice.

Thanks in advance :slight_smile:

Found out a few things for myself. By looking at the P1 pinout I assumed SIP1 is SPI1, but it’s not. So we are using SPI.

The only difference between the development board and P1 is the SS pin, which on P1 is DAC. We tested the connections and the pins connected are indeed A3,A4,A5 and DAC.

Funny thing is, the first reading attempt goes well while the next attempts spit out gibberish. It’s like the SS pin is not being set. Am I missing anything important regarding that? We tried setting the SS pin explicitely (SPI.begin(DAC)), it didn’t work.

I dont know the P1 at all, so i dont know of any differences.

setting the SS pin explicitly using SPI.begin doesn’t set it (high or low) at each SPI transfer, you need to make that call before and after each transfer. the SPI.begin just makes it an “output”

3 Likes

Thanks for the info, but we are setting the SS pin to LOW before each transaction and setting it HIGH again after a transaction. There is no difference, only the first read is ok, the next ones are bad. I had the same problem while learning how SPI works, the only difference is back then I forgot to set the SS pin to high/low, just like you suggested. We did measure the connections, each pin is connected as it should be and both devices (the slave and P1 master) have the correct pins set. I honestly don’t know what could be the problem :S

@itd24, I have a P1 protoboard and I can test with an SPI device like a microSD card. Hopefully, I can test tonight.

1 Like

Thanks for your help, we found out the source of the problem. The slave chip needs an external oscillator to function properly. Apparently the oscillator on the prototypes did not emit the right frequency…
The P1 works just fine, the only difference as far as I know is, the photon uses A2 as the default SS pin and the P1 uses DAC.

1 Like

Not to revive a dead topic but my question would have the same title :smile:

I am finishing up a design using the P1 and noticed after routing everything that the pin map in the P1 data sheet has 2 different definitions for SPI1_SS. Then, after reading this thread I’d like to try to avoid sending a bad board to the fab house.

On the P1 datasheet pin map, the diagram lists SPI1_SS as pin 49 (A2). This also matches what is in the firmware documentation for the default SS on SPI.

The complete P1 module pin listing on the datasheet, the schematic for the module, and this thread all show that pin 24 (DAC) is really SS.

Which information is correct? Can this be updated so it is consistent with itself?