Hi Joe,
thanks again for your fast answer.
I tried to run spi_loopback/spi.c
on nrf52840_pca10056 but i am still running into problems.
I will explain the problem, if someone has the time to take a short glimpse over it, i would very much appreciate it.
The idea/goal is just to send data via spi_transceive.
To do so i changed the main method to setup the tx and rx buffers
as well as struct device *spi_fast.
The spi_config is setup before with:
struct spi_config spi_cfg_fast = {
.frequency = FAST_FREQ,
.operation = SPI_OP_MODE_MASTER | SPI_MODE_CPOL |
SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE,
.slave = SPI_SLAVE,
.cs = SPI_CS,
};
I also added CONFIG_SPI=y in the nrf52840_pca10056.conf file.
The main method is:
void test_main(void)
{
//setup the buffers here
const struct spi_buf tx_bufs[] = {
{
.buf = buffer_tx,
.len = BUF_SIZE,
},
};
const struct spi_buf rx_bufs[] = {
{
.buf = buffer_rx,
.len = BUF_SIZE,
},
};
const struct spi_buf_set tx = {
.buffers = tx_bufs,
.count = ARRAY_SIZE(tx_bufs)
};
const struct spi_buf_set rx = {
.buffers = rx_bufs,
.count = ARRAY_SIZE(rx_bufs)
};
//finishesd setting buffers
//setup the device
struct device *spi_fast;
spi_fast = device_get_binding(SPI_DRV_NAME);
//finished setting up device
//check parameters
printk("%s\n",SPI_DRV_NAME);
printk("%i\n",SPI_SLAVE);
printk("%i\n",SLOW_FREQ);
printk("%i\n",FAST_FREQ);
//finished checking parameters
int ret;
ret= spi_transceive(spi_fast, &spi_cfg_fast, &tx, NULL);
if (ret) {
SYS_LOG_ERR("Code %d", ret);
}
printk("Still alive and trying.\n");
}
The problem is, that if i flash the board i get the following output:

The program hangs at spi_transceive and never reaches printk("Still alive and trying.\n");
However if i set ret= spi_transceive(spi_fast, &spi_cfg_fast, &NULL, &NULL); so output is set to NULL i get:

Does someone have an idea what is going wrong?
Thanks again.