Skip to content

Commit 1b014ba

Browse files
mif1-nordicnashif
authored andcommitted
drivers: spi: nrfx_spim: Add support for non standard frequencies
Disabled frequency set approximation algorithm for spim's with prescaler. Signed-off-by: Michal Frankiewicz <michal.frankiewicz@nordicsemi.no>
1 parent d6420d2 commit 1b014ba

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/spi/spi_nrfx_spim.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,14 @@ static inline void finalize_spi_transaction(const struct device *dev, bool deact
170170

171171
static inline uint32_t get_nrf_spim_frequency(uint32_t frequency)
172172
{
173+
if (NRF_SPIM_HAS_PRESCALER) {
174+
return frequency;
175+
}
173176
/* Get the highest supported frequency not exceeding the requested one.
174177
*/
175-
if (frequency >= MHZ(32) && (NRF_SPIM_HAS_32_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) {
178+
if (frequency >= MHZ(32) && NRF_SPIM_HAS_32_MHZ_FREQ) {
176179
return MHZ(32);
177-
} else if (frequency >= MHZ(16) && (NRF_SPIM_HAS_16_MHZ_FREQ || NRF_SPIM_HAS_PRESCALER)) {
180+
} else if (frequency >= MHZ(16) && NRF_SPIM_HAS_16_MHZ_FREQ) {
178181
return MHZ(16);
179182
} else if (frequency >= MHZ(8)) {
180183
return MHZ(8);

0 commit comments

Comments
 (0)