Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/per/spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,16 +788,17 @@ static pin_alt_spi spi5_pins_nss[]
= {pins_none_spi, pins_none_spi, pins_none_spi};

/* ============== spi6 ============== */
static pin_alt_spi spi6_pins_sclk[]
= {{Pin(PORTA, 5), GPIO_AF8_SPI6}, pins_none_spi, pins_none_spi};
static pin_alt_spi spi6_pins_sclk[] = {{Pin(PORTA, 5), GPIO_AF8_SPI6},
{Pin(PORTG, 13), GPIO_AF5_SPI6},
pins_none_spi};

static pin_alt_spi spi6_pins_miso[] = {{Pin(PORTB, 4), GPIO_AF8_SPI6},
{Pin(PORTA, 6), GPIO_AF8_SPI6},
pins_none_spi};
{Pin(PORTG, 12), GPIO_AF5_SPI6}};

static pin_alt_spi spi6_pins_mosi[] = {{Pin(PORTB, 5), GPIO_AF8_SPI6},
{Pin(PORTA, 7), GPIO_AF8_SPI6},
pins_none_spi};
{Pin(PORTG, 14), GPIO_AF5_SPI6}};

static pin_alt_spi spi6_pins_nss[]
= {{Pin(PORTA, 4), GPIO_AF8_SPI6}, pins_none_spi, pins_none_spi};
Expand Down Expand Up @@ -1023,6 +1024,8 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
break;
case SpiHandle::Config::Peripheral::SPI_6:
__HAL_RCC_SPI6_CLK_ENABLE();
HAL_NVIC_SetPriority(SPI6_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(SPI6_IRQn);
break;
}

Expand Down
18 changes: 9 additions & 9 deletions src/per/spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ class SpiHandle
typedef void (*EndCallbackFunctionPtr)(void* context, Result result);


/** Blocking transmit
/** Blocking transmit
\param buff input buffer
\param size buffer size
\param timeout how long in milliseconds the function will wait
\param timeout how long in milliseconds the function will wait
before returning without successful communication
*/
Result BlockingTransmit(uint8_t* buff, size_t size, uint32_t timeout = 100);
Expand All @@ -157,22 +157,22 @@ class SpiHandle
\param tx_buff the transmit buffer
\param rx_buff the receive buffer
\param size the length of the transaction
\param timeout how long in milliseconds the function will wait
\param timeout how long in milliseconds the function will wait
before returning without successful communication
*/
Result BlockingTransmitAndReceive(uint8_t* tx_buff,
uint8_t* rx_buff,
size_t size,
uint32_t timeout = 100);

/** DMA-based transmit
/** DMA-based transmit
\param *buff input buffer
\param size buffer size
\param start_callback A callback to execute when the transfer starts, or NULL.
The callback is called from an interrupt, so keep it fast.
\param end_callback A callback to execute when the transfer finishes, or NULL.
The callback is called from an interrupt, so keep it fast.
\param callback_context A pointer that will be passed back to you in the callbacks.
\param callback_context A pointer that will be passed back to you in the callbacks.
\return Whether the transmit was successful or not
*/
Result DmaTransmit(uint8_t* buff,
Expand All @@ -181,14 +181,14 @@ class SpiHandle
SpiHandle::EndCallbackFunctionPtr end_callback,
void* callback_context);

/** DMA-based receive
/** DMA-based receive
\param *buff input buffer
\param size buffer size
\param start_callback A callback to execute when the transfer starts, or NULL.
The callback is called from an interrupt, so keep it fast.
\param end_callback A callback to execute when the transfer finishes, or NULL.
The callback is called from an interrupt, so keep it fast.
\param callback_context A pointer that will be passed back to you in the callbacks.
\param callback_context A pointer that will be passed back to you in the callbacks.
\return Whether the receive was successful or not
*/
Result DmaReceive(uint8_t* buff,
Expand All @@ -197,15 +197,15 @@ class SpiHandle
SpiHandle::EndCallbackFunctionPtr end_callback,
void* callback_context);

/** DMA-based transmit and receive
/** DMA-based transmit and receive
\param tx_buff the transmit buffer
\param rx_buff the receive buffer
\param size buffer size
\param start_callback A callback to execute when the transfer starts, or NULL.
The callback is called from an interrupt, so keep it fast.
\param end_callback A callback to execute when the transfer finishes, or NULL.
The callback is called from an interrupt, so keep it fast.
\param callback_context A pointer that will be passed back to you in the callbacks.
\param callback_context A pointer that will be passed back to you in the callbacks.
\return Whether the receive was successful or not
*/
Result
Expand Down
9 changes: 5 additions & 4 deletions src/sys/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,10 @@ void System::ConfigureClocks()
PeriphClkInitStruct.PeriphClockSelection
= RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART6
| RCC_PERIPHCLK_USART234578 | RCC_PERIPHCLK_LPUART1
| RCC_PERIPHCLK_RNG | RCC_PERIPHCLK_SPI1 | RCC_PERIPHCLK_SAI2
| RCC_PERIPHCLK_SAI1 | RCC_PERIPHCLK_SDMMC | RCC_PERIPHCLK_I2C2
| RCC_PERIPHCLK_ADC | RCC_PERIPHCLK_I2C1 | RCC_PERIPHCLK_USB
| RCC_PERIPHCLK_QSPI | RCC_PERIPHCLK_FMC;
| RCC_PERIPHCLK_RNG | RCC_PERIPHCLK_SPI1 | RCC_PERIPHCLK_SPI6
| RCC_PERIPHCLK_SAI2 | RCC_PERIPHCLK_SAI1 | RCC_PERIPHCLK_SDMMC
| RCC_PERIPHCLK_I2C2 | RCC_PERIPHCLK_ADC | RCC_PERIPHCLK_I2C1
| RCC_PERIPHCLK_USB | RCC_PERIPHCLK_QSPI | RCC_PERIPHCLK_FMC;
// PLL 2
// PeriphClkInitStruct.PLL2.PLL2N = 115; // Max Freq @ 3v3
//PeriphClkInitStruct.PLL2.PLL2N = 84; // Max Freq @ 1V9
Expand Down Expand Up @@ -501,6 +501,7 @@ void System::ConfigureClocks()
PeriphClkInitStruct.Sai1ClockSelection = RCC_SAI1CLKSOURCE_PLL3;
PeriphClkInitStruct.Sai23ClockSelection = RCC_SAI23CLKSOURCE_PLL3;
PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_PLL2;
PeriphClkInitStruct.Spi6ClockSelection = RCC_SPI6CLKSOURCE_PCLK4;
PeriphClkInitStruct.Usart234578ClockSelection
= RCC_USART234578CLKSOURCE_D2PCLK1;
PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_D2PCLK2;
Expand Down
Loading