mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 06:39:01 +08:00
SAMA5: Barebones TWI driver implementation
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
+405
-88
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
=================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user