About OCTSPI
I would like to communicate with FLASH using OCTSPI on nucleo l4r5zi.
I am creating a driver for OCTSPI for communication, but I have a question.
I plan to use the regular command mode, INDIRECT_READ and INDIRECT_WRITE.
The driver is designed to store the data to be sent in an internal buffer and send the data in the buffer via SPI on interrupt.
The image is as follows.
static uint8_t buf[256];
static uint8_t send_cnt;
static uint8_t send_num;
/* interrput */
void interrupt(void){
if(check interrput status)
DR register = buf[send_idx];
send_cnt--;
send_idx++;
if(send_cnt==0){
disable interrupt
}
}
}
/* send function */
void send(uint8_t *data, uint8_t size){
send_cnt = size;
send_idx = 0;
/* IR,AR,DLR等�?�設定 */
~
/* Set the datas to be sent to internal buffer */
for(i=0;i<size;i++){
buf[i] = data[i];
}
enable interrupt
}I understand that the number of data to be sent needs to be set in the DLR register when sending/receiving.
In the Data Phase, when sending multiple bytes, the number of times to send (send_cnt) needs to be controlled by the software as described above.
In this case, I do not understand the meaning of the DLR register.
How should DLR be used?
Reference document : dm00310109-stm32l4-series-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf
