I am newbie in ChibiOS, I would like learn it. I have own board with MCU STM32F407VG, I tried write some functions for communication with AT25SF128ASHBT throught SPI.
When I tried comunicate with memory with lib from STM32Cube the memory comunicate well, when I try write similar code for Chibi, I get system halt with reason DMA failure code. How can I fix it?
My code looks like this
Code: Select all
SPIConfig config;
config.circular=false;
config.ssport=GPIOA;
config.sspad=SPI3NSS;
config.end_cb=NULL;
config.cr1 =SPI_CR1_BR_0|SPI_CR1_BR_1; // memory comunicate in SPI mode 0 or 3
config.cr2 =0;in while i call:
Code: Select all
uint8_t UID[8];
AT25SF128ASHBT_ReadUniqueID(&SPID3,&config,UID);
chThdSleepMilliseconds(1000);I have similar functions for works with memory.
Code: Select all
void AT25SF128ASHBT_ReadUniqueID(SPIDriver *spip,SPIConfig *config,uint8_t *id)
{
uint8_t dataTx[5];
memset(dataTx,0,sizeof(dataTx));
dataTx[0]=MEM_READ_UNIQUE_ID;
spiAcquireBus(spip);
spiStart(spip,config);
spiSelect(spip);
spiStartSend(spip,5,dataTx);
spiStartReceive(spip,8,id);
spiUnselect(spip);
spiStop(spip);
spiReleaseBus(spip);
}