Skip to content

Commit 202c862

Browse files
ledneczkirleh
authored andcommitted
[I2S] Add pin configuration for I2S DAC
Remove not used parameter from I2S PLL initializer function. Pin setup for the I2S DAC can be done by calling Board::initializeCs43()
1 parent a63b37c commit 202c862

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

src/modm/board/disco_f407vg/board.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct SystemClock {
9292
.pllN = 258, // 1 MHz * N=258 -> 258 MHz
9393
.pllR = 3 // 258 MHz / R=3 -> 86 MHz
9494
};
95-
Rcc::enablePllI2s(Rcc::PllSource::ExternalCrystal, pllI2sFactors, 2048);
95+
Rcc::enablePllI2s(pllI2sFactors, 2048);
9696
// set flash latency for 168MHz
9797
Rcc::setFlashLatency<Frequency>();
9898
// switch system clock to PLL output
@@ -148,7 +148,7 @@ using Scl = GpioB6; // Audio_SCL
148148
using Sda = GpioB9; // Audio_SDA
149149

150150
using I2cMaster = I2cMaster1;
151-
//using I2sMaster = I2sMaster3;
151+
using I2sMaster = I2sMaster3;
152152
}
153153

154154

@@ -200,10 +200,8 @@ initializeLis3()
200200
inline void
201201
initializeCs43()
202202
{
203-
// cs43::Lrck::connect(cs43::I2sMaster::Ws);
204-
// cs43::Mclk::connect(cs43::I2sMaster::Mck);
205-
// cs43::Sclk::connect(cs43::I2sMaster::Ck);
206-
// cs43::Sdin::connect(cs43::I2sMaster::Sd);
203+
cs43::I2sMaster::connect<cs43::Mclk::Mck, cs43::Sclk::Ck,
204+
cs43::Lrck::Ws, cs43::Sdin::Sd>();
207205

208206
cs43::Reset::setOutput(modm::Gpio::High);
209207

src/modm/platform/clock/stm32/rcc.cpp.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ Rcc::enablePll{{id}}(PllSource source, const PllFactors& pllFactors, uint32_t wa
307307

308308
%% if plli2s
309309
bool
310-
modm::platform::Rcc::enablePllI2s(PllSource, const PllI2sFactors& pllFactors, uint32_t waitCycles)
310+
modm::platform::Rcc::enablePllI2s(const PllI2sFactors& pllFactors, uint32_t waitCycles)
311311
{
312312
// Read reserved and don't care values and clear all other values
313313
uint32_t tmp = RCC->PLLI2SCFGR & ~(RCC_PLLI2SCFGR_PLLI2SN | RCC_PLLI2SCFGR_PLLI2SR);

src/modm/platform/clock/stm32/rcc.hpp.in

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,18 +611,25 @@ public:
611611

612612
%% if target["family"] == "f4"
613613
/** TODO: comments
614+
* \code
614615
* input clock is the HSE or HSI divided by M
615616
* f(VCO clock) = f(PLLI2S clock input) × (PLLI2SN / PLLM)
616617
* f(PLL I2S clock output) = f(VCO clock) / PLLI2SR
618+
* \endcode
619+
*
617620
*
618621
* \param pllN
619-
* PLLI2S multiplication factor for VCO
620-
* 50 <= PLLI2SN <= 432
622+
* PLLI2S multiplication factor for VCO
623+
* Caution: The software has to set these bits correctly
624+
* to ensure that the VCO output frequency
625+
* is between 100 and 432 MHz.
626+
* 50 <= PLLI2SN <= 432
621627
*
622628
* \param pllR
623-
* PLLI2S division factor for I2S clocks
624-
* Caution: The I2Ss requires a frequency lower than or equal to 192 MHz to work correctly.
625-
* 2 <= PLLR <= 7
629+
* PLLI2S division factor for I2S clocks
630+
* Caution: The I2Ss requires a frequency lower than
631+
* or equal to 192 MHz to work correctly.
632+
* 2 <= PLLR <= 7
626633
*/
627634
struct PllI2sFactors
628635
{
@@ -632,7 +639,7 @@ public:
632639

633640
/* TODO: comments */
634641
static bool
635-
enablePllI2s(PllSource, const PllI2sFactors& pllFactors, uint32_t waitCycles);
642+
enablePllI2s(const PllI2sFactors& pllFactors, uint32_t waitCycles);
636643
%% endif
637644

638645
// sinks

0 commit comments

Comments
 (0)