Merge pull request #2526 from kwagyeman/kwabena/fix_vospi_phase
Some checks are pending
🔎 Check Code Formatting / formatting-check (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_GIGA) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_NANO_33_BLE_SENSE) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_NANO_RP2040_CONNECT) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_NICLA_VISION) (push) Waiting to run
🔥 Firmware Build / build-firmware (ARDUINO_PORTENTA_H7) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV2) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV3) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV4) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV4P) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMVPT) (push) Waiting to run
🔥 Firmware Build / build-firmware (OPENMV_RT1060) (push) Waiting to run
🔥 Firmware Build / code-size-report (push) Blocked by required conditions
🔥 Firmware Build / stable-release (push) Blocked by required conditions
🔥 Firmware Build / development-release (push) Blocked by required conditions

common/vospi: Set vospi bus CPOL=1 and CPHA=1.
This commit is contained in:
Ibrahim Abdelkader 2024-12-01 18:48:28 +02:00 committed by GitHub
commit 33eb5f9f14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 8 deletions

View File

@ -187,7 +187,6 @@
// FIR Lepton // FIR Lepton
#define OMV_FIR_LEPTON_I2C_BUS (OMV_FIR_I2C_ID) #define OMV_FIR_LEPTON_I2C_BUS (OMV_FIR_I2C_ID)
#define OMV_FIR_LEPTON_I2C_BUS_SPEED (OMV_FIR_I2C_SPEED) #define OMV_FIR_LEPTON_I2C_BUS_SPEED (OMV_FIR_I2C_SPEED)
#define OMV_FIR_LEPTON_RX_CLK_DIV (8)
#define OMV_FIR_LEPTON_SPI_BUS (OMV_SPI3_ID) #define OMV_FIR_LEPTON_SPI_BUS (OMV_SPI3_ID)
#define OMV_FIR_LEPTON_MOSI_PIN (&omv_pin_LPSPI3_MOSI) #define OMV_FIR_LEPTON_MOSI_PIN (&omv_pin_LPSPI3_MOSI)

View File

@ -179,6 +179,8 @@ int vospi_init(uint32_t n_packets, void *buffer) {
spi_config.bus_mode = OMV_SPI_BUS_RX; spi_config.bus_mode = OMV_SPI_BUS_RX;
spi_config.datasize = 16; spi_config.datasize = 16;
spi_config.baudrate = VOSPI_CLOCK_SPEED; spi_config.baudrate = VOSPI_CLOCK_SPEED;
spi_config.clk_pol = OMV_SPI_CPOL_HIGH;
spi_config.clk_pha = OMV_SPI_CPHA_2EDGE;
spi_config.dma_flags = OMV_SPI_DMA_CIRCULAR | OMV_SPI_DMA_DOUBLE; spi_config.dma_flags = OMV_SPI_DMA_CIRCULAR | OMV_SPI_DMA_DOUBLE;
if (omv_spi_init(&vospi.spi_bus, &spi_config) != 0) { if (omv_spi_init(&vospi.spi_bus, &spi_config) != 0) {

View File

@ -254,15 +254,13 @@ int fir_lepton_init(omv_i2c_t *bus, int *w, int *h, int *refresh, int *resolutio
omv_spi_config_t spi_config; omv_spi_config_t spi_config;
omv_spi_default_config(&spi_config, OMV_FIR_LEPTON_SPI_BUS); omv_spi_default_config(&spi_config, OMV_FIR_LEPTON_SPI_BUS);
#if OMV_FIR_LEPTON_RX_CLK_DIV
spi_config.baudrate = VOSPI_CLOCK_SPEED / OMV_FIR_LEPTON_RX_CLK_DIV;
#else
spi_config.baudrate = VOSPI_CLOCK_SPEED; spi_config.baudrate = VOSPI_CLOCK_SPEED;
#endif
spi_config.datasize = 16; spi_config.datasize = 16;
spi_config.bus_mode = OMV_SPI_BUS_RX; spi_config.bus_mode = OMV_SPI_BUS_RX;
spi_config.nss_enable = false; spi_config.nss_enable = false;
spi_config.clk_pol = OMV_SPI_CPOL_HIGH;
spi_config.clk_pha = OMV_SPI_CPHA_2EDGE;
spi_config.dma_flags = OMV_SPI_DMA_CIRCULAR | OMV_SPI_DMA_DOUBLE; spi_config.dma_flags = OMV_SPI_DMA_CIRCULAR | OMV_SPI_DMA_DOUBLE;
omv_spi_init(&spi_bus, &spi_config); omv_spi_init(&spi_bus, &spi_config);

View File

@ -114,8 +114,8 @@ typedef LPI2C_Type *omv_i2c_dev_t;
#define OMV_SPI_BUS_RX (1 << 1) #define OMV_SPI_BUS_RX (1 << 1)
#define OMV_SPI_BUS_TX_RX (OMV_SPI_BUS_TX | OMV_SPI_BUS_RX) #define OMV_SPI_BUS_TX_RX (OMV_SPI_BUS_TX | OMV_SPI_BUS_RX)
#define OMV_SPI_CPOL_LOW (kLPSPI_ClockPolarityActiveLow) #define OMV_SPI_CPOL_LOW (kLPSPI_ClockPolarityActiveHigh)
#define OMV_SPI_CPOL_HIGH (kLPSPI_ClockPolarityActiveHigh) #define OMV_SPI_CPOL_HIGH (kLPSPI_ClockPolarityActiveLow)
#define OMV_SPI_CPHA_1EDGE (kLPSPI_ClockPhaseFirstEdge) #define OMV_SPI_CPHA_1EDGE (kLPSPI_ClockPhaseFirstEdge)
#define OMV_SPI_CPHA_2EDGE (kLPSPI_ClockPhaseSecondEdge) #define OMV_SPI_CPHA_2EDGE (kLPSPI_ClockPhaseSecondEdge)

View File

@ -313,7 +313,7 @@ int omv_spi_default_config(omv_spi_config_t *config, uint32_t bus_id) {
config->spi_mode = OMV_SPI_MODE_MASTER; config->spi_mode = OMV_SPI_MODE_MASTER;
config->bus_mode = OMV_SPI_BUS_TX_RX; config->bus_mode = OMV_SPI_BUS_TX_RX;
config->bit_order = OMV_SPI_MSB_FIRST; config->bit_order = OMV_SPI_MSB_FIRST;
config->clk_pol = OMV_SPI_CPOL_HIGH; config->clk_pol = OMV_SPI_CPOL_LOW;
config->clk_pha = OMV_SPI_CPHA_1EDGE; config->clk_pha = OMV_SPI_CPHA_1EDGE;
config->nss_pol = OMV_SPI_NSS_LOW; config->nss_pol = OMV_SPI_NSS_LOW;
config->nss_enable = true; config->nss_enable = true;