SAMA5: Barebones TWI driver implementation

This commit is contained in:
Gregory Nutt
2013-09-11 16:48:56 -06:00
parent 382a066eae
commit b5eed8c9cb
4 changed files with 431 additions and 94 deletions
+7 -6
View File
@@ -368,14 +368,15 @@
/* Peripheral Control Register */
#define PMC_PCR_PID_SHIFT (0) /* Bits 0-5: Peripheral ID */
#define PMC_PCR_PID_MASK (63 < PMC_PCR_PID_SHIFT)
#define PMC_PCR_PID_MASK (63 << PMC_PCR_PID_SHIFT)
# define PMC_PCR_PID(n) ((n) << PMC_PCR_PID_SHIFT)
#define PMC_PCR_CMD (1 << 12) /* Bit 12: Command */
#define PMC_PCR_DIV_SHIFT (16) /* Bits 16-17: Divisor Value */
#define PMC_PCR_DIV_MASK (3 < PMC_PCR_DIV_SHIFT)
# define PMC_PCR_DIV1 (0 < PMC_PCR_DIV_SHIFT) /* Peripheral clock is MCK */
# define PMC_PCR_DIV2 (1 < PMC_PCR_DIV_SHIFT) /* Peripheral clock is MCK/2 */
# define PMC_PCR_DIV4 (2 < PMC_PCR_DIV_SHIFT) /* Peripheral clock is MCK/4 */
# define PMC_PCR_DIV8 (3 < PMC_PCR_DIV_SHIFT) /* Peripheral clock is MCK/8 */
#define PMC_PCR_DIV_MASK (3 << PMC_PCR_DIV_SHIFT)
# define PMC_PCR_DIV1 (0 << PMC_PCR_DIV_SHIFT) /* Peripheral clock is MCK */
# define PMC_PCR_DIV2 (1 << PMC_PCR_DIV_SHIFT) /* Peripheral clock is MCK/2 */
# define PMC_PCR_DIV4 (2 << PMC_PCR_DIV_SHIFT) /* Peripheral clock is MCK/4 */
# define PMC_PCR_DIV8 (3 << PMC_PCR_DIV_SHIFT) /* Peripheral clock is MCK/8 */
#define PMC_PCR_EN (1 << 28) /* Bit 28: Enable */
/* Oscillator Calibration Register */
+1
View File
@@ -137,6 +137,7 @@
#define TWI_MMR_MREAD (1 << 12) /* Bit 12: Master Read Direction */
#define TWI_MMR_DADR_SHIFT (16) /* Bits 16-22: Device Address */
#define TWI_MMR_DADR_MASK (0x7f << TWI_MMR_DADR_SHIFT)
# define TWI_MMR_DADR(n) ((uint32_t)(n) << TWI_MMR_DADR_SHIFT)
/* TWI Slave Mode Register */
File diff suppressed because it is too large Load Diff
+18
View File
@@ -76,6 +76,7 @@ Contents
- Serial FLASH
- HSMCI Card Slots
- USB Ports
- AT24 Serial EEPROM
- SAMA5D3x-EK Configuration Options
- Configurations
@@ -618,6 +619,23 @@ USB Ports
---- ----------- -------------------------------------------------------
PD28 OVCUR_USB Combined overrcurrent indication from port A and B
AT24 Serial EEPROM
==================
A AT24C512 Serial EEPPROM was used for tested I2C. There are other I2C/TWI
devices on-board, but the serial EEPROM is the simplest test.
The Serial EEPROM was mounted on an external adaptor board and connected to
the SAMA5D3x-EK thusly:
- VCC -- VCC
- GND -- GND
- TWCK0(PA31) -- SCL
- TWD0(PA30) -- SDA
By default, PA30 and PA31 are SWJ-DP pins, it can be used as a pin for TWI
peripheral in the end application.
SAMA5D3x-EK Configuration Options
=================================