You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
非常感谢您使用LibDriver,从您的日志中看,似乎是读取出现问题了,第一个“release power down failed”,有可能是调用w25qxx_interface_spi_qspi_write_read参数不对返回的错误,如果您的芯片只使用或实现了SPI接口,w25qxx_set_dual_quad_spi一定设置为False
Please ask your question
这是w25qxx_interface_spi_qspi_write_read函数
`
uint8_t w25qxx_interface_spi_qspi_write_read(
uint8_t instruction, uint8_t instruction_line, uint32_t address,
uint8_t address_line, uint8_t address_len, uint32_t alternate,
uint8_t alternate_line, uint8_t alternate_len, uint8_t dummy,
uint8_t *in_buf, uint32_t in_len, uint8_t *out_buf, uint32_t out_len,
uint8_t data_line) {
if ((instruction_line != 0) || (address_line != 0) || (alternate_line != 0) ||
(dummy != 0) || (data_line != 1)) {
return 1;
}
SPI2_CS_LOW();
if (in_len > 0) {
for (uint32_t i = 0; i < in_len; i++) {
while (RESET == spi_i2s_flag_get(SPI2, SPI_FLAG_TBE))
;
spi_i2s_data_transmit(SPI2, in_buf[i]);
while (RESET == spi_i2s_flag_get(SPI2, SPI_FLAG_RBNE))
;
(void)spi_i2s_data_receive(SPI2);
}
}
if (out_len > 0) {
for (uint32_t i = 0; i < out_len; i++) {
while (RESET == spi_i2s_flag_get(SPI2, SPI_FLAG_TBE))
;
spi_i2s_data_transmit(SPI2, 0xFF); // Send dummy byte to generate clock
while (RESET == spi_i2s_flag_get(SPI2, SPI_FLAG_RBNE))
;
out_buf[i] = spi_i2s_data_receive(SPI2);
}
}
SPI2_CS_HIGH();
return 0;
}
`
这是总线初始化代码:
` rcu_periph_clock_enable(RCU_GPIOC);
rcu_periph_clock_enable(RCU_SPI2);
gpio_af_set(GPIOC, GPIO_AF_6, GPIO_PIN_12 | GPIO_PIN_11 | GPIO_PIN_10);
gpio_mode_set(GPIOC, GPIO_MODE_AF, GPIO_PUPD_NONE,
GPIO_PIN_12 | GPIO_PIN_11 | GPIO_PIN_10);
gpio_output_options_set(GPIOC, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,
GPIO_PIN_12 | GPIO_PIN_11 | GPIO_PIN_10);
spi_parameter_struct spi_init_struct;
spi_init_struct.trans_mode = SPI_TRANSMODE_FULLDUPLEX;
spi_init_struct.device_mode = SPI_MASTER;
spi_init_struct.frame_size = SPI_FRAMESIZE_8BIT;
spi_init_struct.clock_polarity_phase = SPI_CK_PL_HIGH_PH_2EDGE;
spi_init_struct.nss = SPI_NSS_SOFT;
spi_init_struct.prescale = SPI_PSC_8;
spi_init_struct.endian = SPI_ENDIAN_MSB;
spi_init(SPI2, &spi_init_struct);
spi_enable(SPI2);
rcu_periph_clock_enable(RCU_GPIOA);
gpio_mode_set(GPIOA, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, GPIO_PIN_15);
gpio_output_options_set(GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_15);
gpio_bit_set(GPIOA, GPIO_PIN_15);`
这是日志:
Additional context
No response
The text was updated successfully, but these errors were encountered: