This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF51 dk 16 bit spi runtime error

Hi guys I'm sending data from an nexys 4 fpga through an spi to my nRF51 (pca10028) I have the fpga set as the master and I'm able to read data sent to the nRF51 through my tera term when I have my spi.format set to (8,2)... but for some reason when I set the format to (16,2) I'm getting a runtime error. Or at least the (led1,led3) and (led2,led4) are flashing in an alternating pattern which I think is a runtime error. I have my fpga actually set to 16 bits and running on mode 2 as well so I find it odd that it's giving me this error. They also are running at the same frequency as well.

////////// Here's the simple code I have on my Nordic 

// Reply to a SPI master as slave
 
#include "mbed.h"
 
SPISlave spi(P0_16, P0_15, P0_14, P0_13); // mosi, miso, sclk, ssel
Serial pc(USBTX, USBRX);

int main() {
    
    spi.format(8,2);
    spi.frequency(100000);
    pc.baud(9600);
    spi.reply(0x00);              // Prime SPI with first reply
  
    while(1) { 
        if(spi.receive()) {
            int v = spi.read();   // Read byte from master
           // v = (v + 1) % 0x100;    
            spi.reply(v);         // Make this the next reply
       pc.printf("Received Data = 0x%X\n\r",v);
       }
    }
}

Has anyone run into something similar?

Parents
  • Hi Martin , Thanks for the reply. I'm wondering when you mean the nRF51 only supports 8 bit you are talking about the Bluetooth? I should still be able to send 16bit frames to the board right? What I have coming from the FPGA is in 16 bit but I really only need to broadcast a certain portion of that 16 bits. This should be possible right? Sorry for the vague question.

Reply
  • Hi Martin , Thanks for the reply. I'm wondering when you mean the nRF51 only supports 8 bit you are talking about the Bluetooth? I should still be able to send 16bit frames to the board right? What I have coming from the FPGA is in 16 bit but I really only need to broadcast a certain portion of that 16 bits. This should be possible right? Sorry for the vague question.

Children
No Data
Related