Hello,
I am developing a custom board with DA14531 and a NXP chip, attached via SPI. As development environment I use the Pro Deveopment board, with the DA14531 daughter.
I pulled the jumpers for SPI, in order to connect my target, residing within it's own board environment.
The NXP chip expects a simple protocol. On a read, the 7 upper bits are the register address and bit 0 decides about a read or write.
Consequently, I guess, have to transfer 2 bytes on a read, the second is ignored, but MISO is driven by the NXP chip.
I am now stuck within the library. I switched off the DMA configuration parameter in the project (removed the define CFG_SPI_DMA_SUPPORT) and prepared my 'read_register' function.
The library stops by an endless loop at line 903 of file spi931.c :
// Wait while RX FIFO is empty while (spi_rx_fifo_empty_status_getf() == SPI_RX_FIFO_IS_EMPTY); Here is my library call:
unsigned char getRegister(unsigned int reg_address) { unsigned char reg_addressv = reg_address; for(int i=0; i<sizeof(recv_buffer); ++i) { recv_buffer[i] = (unsigned char) 0xaa; } reg_addressv = reg_addressv << 1; reg_addressv |= 0x01; // marker for read trx_buffer[0] = reg_addressv; trx_buffer[1] = 0; // dummy spi_transfer(recv_buffer, trx_buffer, 1, SPI_OP_BLOCKING); return recv_buffer[0]; }The line of interest is, where spi_transfer() is called.
The SoC initialisation is taken from the spi_flash project, the interface is set to byte transfer.
In fact, I took that spi_flash example as code base and modified it. All initialisation is kept as is - except for removal of DMA support.
I do not handle with interrupts.
What might be wrong ?
Why is the rx fifo empty ?
It should be nonempty, even if there is nothing attached to the SPI port pins, am I wrong?
Thanks for help and hints,
Joachim