我现在被卡在库中。我关闭了项目中的DMA配置参数(删除了定义CFG_SPI_DMA_SUPPORT)并准备了我的'read_register'函数。< / p > < p >图书馆停止的一个无尽的循环在第903行文件spi931.c: < br / > < / p > < pre > <代码> / /等待RX FIFO空(spi_rx_fifo_empty_status_getf () = = SPI_RX_FIFO_IS_EMPTY); < /代码> < / pre > < p >这是我库调用:< br / > < / p > < pre > <代码> 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