mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
Sansa AMS i2c : fix 2 problems identified by Jack Halpin & Bertrik Sikken
i2c clock frequency uses pclk as reference, not plla i2c clock divider is only 10 bits, not 16 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20929 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1123115559
commit
49c25816f0
2 changed files with 3 additions and 3 deletions
|
|
@ -72,8 +72,8 @@ void ascodec_init(void)
|
|||
|
||||
/* prescaler for i2c clock */
|
||||
prescaler = CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ);
|
||||
I2C2_CPSR0 = prescaler & 0xFF;
|
||||
I2C2_CPSR1 = (prescaler >> 8) & 0xFF;
|
||||
I2C2_CPSR0 = prescaler & 0xFF; /* 8 lsb */
|
||||
I2C2_CPSR1 = (prescaler >> 8) & 0x3; /* 2 msb */
|
||||
|
||||
/* set i2c slave address of codec part */
|
||||
I2C2_SLAD0 = AS3514_I2C_ADDR << 1;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
#endif
|
||||
|
||||
#define AS3525_I2C_FREQ 400000
|
||||
#if (CLK_DIV(AS3525_PLLA_FREQ, AS3525_I2C_FREQ)) >= (1<<16) /* 2*8 bits */
|
||||
#if (CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ)) >= (1<<10) /* 2+8 bits */
|
||||
#error I2C frequency is too low : clock divider will not fit !
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue