Difference between revisions of "SWLEDX8-I2C"
Jump to navigation
Jump to search
Blwikiadmin (talk | contribs) |
Blwikiadmin (talk | contribs) |
||
(66 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
== Features == | == Features == | ||
− | * 16-Bit MCP23017 | + | * 16-Bit Digital I/O card with a small form factor |
+ | ** [https://ww1.microchip.com/downloads/en/devicedoc/20001952c.pdf MCP23017] I/O Expander | ||
** I2C interface | ** I2C interface | ||
+ | * Card can be used standalone or stacked together with the [[SWLEDX8]] card | ||
* I2C Daisy-Chain (In/Out) connectors | * I2C Daisy-Chain (In/Out) connectors | ||
* (3) I2C Address select jumpers for up to 8 devices per I2C bus | * (3) I2C Address select jumpers for up to 8 devices per I2C bus | ||
* SCL/SDA termination jumpers | * SCL/SDA termination jumpers | ||
− | * 2x10 pins | + | * 2x10 pins Digital I/O Header |
+ | ** 16 digital pins | ||
+ | ** 2 power, 2 ground pins | ||
* 59mmx38mm | * 59mmx38mm | ||
* (4) #4-40 mounting holes | * (4) #4-40 mounting holes | ||
− | * | + | * Software Drivers |
== Build Options == | == Build Options == | ||
Line 17: | Line 21: | ||
* There are a number of options for using the card | * There are a number of options for using the card | ||
** Stacked option with SWLEDX8 card | ** Stacked option with SWLEDX8 card | ||
− | ** Small footprint | + | ** Small footprint option |
− | ** Low height/profile | + | ** Low height/profile option |
=== Stacked option with SWLEDX8 card === | === Stacked option with SWLEDX8 card === | ||
+ | |||
+ | * [[SWLEDX8]] card mounts above this card | ||
+ | * Pins can be directly mounted to both cards or male/female connector pairs can be used | ||
+ | |||
+ | [[file:SWLEDX8-I2C_FRONT(DOWN)_REV2.png]] | ||
=== Small footprint option === | === Small footprint option === | ||
− | === Low height/profile option === | + | [[file:SWLEDX8-I2C_FRONT(STRT)_REV2.png]] |
+ | |||
+ | === Low height/profile option === | ||
+ | |||
+ | [[file:SWLEDX8-I2C_FRONT(RT_ANGL)_REV2.png]] | ||
+ | |||
+ | == Rear Side Marking == | ||
+ | |||
+ | [[file:SWLEDX8-I2C_REAR(STRT)_REV2.png]] | ||
+ | |||
+ | == Connectors == | ||
+ | |||
+ | * Connectors are as follows | ||
+ | |||
+ | [[file:SWLEDX8-I2C-CAD(REV2).PNG]] | ||
+ | |||
+ | === P1 - GPIO Pins === | ||
+ | |||
+ | [[file:SWLEDX8-I2C_P1A.PNG]] | ||
+ | |||
+ | ==== Connections to SWLEDX8 Card ==== | ||
+ | |||
+ | * When paired with SWLEDX8 | ||
+ | ** MCP23017 Port A connects to SWITCHES 0-7 on [[SWLEDX8]] | ||
+ | ** MCP23017 Port B connects to LEDs 0-7 on [[SWLEDX8]] | ||
+ | * Board Rev 2 reverses bit order for byte transfers can be used | ||
+ | |||
+ | [[file:SWLEDX8-I2C_P1.PNG]] | ||
+ | |||
+ | === P2 - I2C Interface === | ||
+ | |||
+ | [[file:SWLEDX8-I2C_P2A.PNG]] | ||
+ | |||
+ | * 2X5 header | ||
+ | * Pinout | ||
+ | |||
+ | # GND | ||
+ | # VCC | ||
+ | # SDA | ||
+ | # SCL | ||
+ | # INTA | ||
+ | |||
+ | [[file:SWLEDX8-I2C_P2.PNG]] | ||
+ | |||
+ | === P3 - I2C Terminators / I2C Address Offset Jumpers === | ||
+ | |||
+ | [[file:SWLEDX8-I2C_P3A.PNG]] | ||
+ | |||
+ | * Install left 2 jumpers to terminate I2C bus | ||
+ | ** Typically, the "last" card in a chain | ||
+ | * Install right 3 jumpers for I2C base address offset in range 0x20 (all installed) to 0x27 (all removed) | ||
+ | |||
+ | [[file:SWLEDX8-I2C_P3.PNG]] | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! I2C Address | ||
+ | ! J3(A2) | ||
+ | ! J3(A1) | ||
+ | ! J3(A0) | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | In | ||
+ | | In | ||
+ | | In | ||
+ | |- | ||
+ | | 0x1 | ||
+ | | In | ||
+ | | In | ||
+ | | Out | ||
+ | |- | ||
+ | | 0x2 | ||
+ | | In | ||
+ | | Out | ||
+ | | In | ||
+ | |- | ||
+ | | 0x3 | ||
+ | | In | ||
+ | | Out | ||
+ | | Out | ||
+ | |- | ||
+ | | 0x4 | ||
+ | | Out | ||
+ | | In | ||
+ | | In | ||
+ | |- | ||
+ | | 0x5 | ||
+ | | Out | ||
+ | | In | ||
+ | | Out | ||
+ | |- | ||
+ | | 0x6 | ||
+ | | Out | ||
+ | | Out | ||
+ | | In | ||
+ | |- | ||
+ | | 0x7 | ||
+ | | Out | ||
+ | | Out | ||
+ | | Out | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | == Drivers / Software Examples == | ||
+ | |||
+ | * Any MCP23017 library should work with this card | ||
+ | * Here's our tested code | ||
+ | |||
+ | === Arduino === | ||
+ | |||
+ | * [https://github.com/land-boards/lb-Arduino-Code/tree/master/libraries/LandBoards_MCP23017 LandBoards MCP23017] | ||
+ | ** pinMode(uint8_t bit, uint8_t value) - Set bits 0-7=Input, 8-15=Output | ||
+ | ** readGPIOA() - Read the 8 Switches | ||
+ | ** writeOLATB(uint8_t baData) _ Write the 8 LEDs | ||
+ | ** digitalRead(uint8_t bit) - read a single Switch (bit=0-7) | ||
+ | ** digitalWrite(uint8_t bit, uint8_t wrVal) - write a single LED (nit=8-15) | ||
+ | * [https://github.com/land-boards/lb-Arduino-Code/blob/master/LBCards/SWLED8X/SWLEDX8_01/SWLEDX8_01.ino SWLEDX8_01.ino] - Read 8 Switches, Write 8 LEDs | ||
+ | ** [https://github.com/land-boards/lb-Arduino-Code/tree/master/LBCards/ArduinoInABox/AiBMenu Example running on Arduino in a Box] | ||
+ | |||
+ | === MicroPython Drivers === | ||
+ | |||
+ | ==== ESP32 MicroPython Driver ==== | ||
+ | |||
+ | * [https://github.com/land-boards/lb-Python-Code/tree/master/MicroPython/ESP32/libraries/mcp23017 ESP32 MicroPython Driver] | ||
+ | |||
+ | ==== PyBoard MicroPython Driver ==== | ||
+ | |||
+ | * [https://github.com/land-boards/lb-Python-Code/blob/master/MicroPython/PyBoard%20Clone/libraries/mcp23017/mcp23017.py PyBoard MicroPython Driver] | ||
+ | |||
+ | ==== CircuitPython ==== | ||
+ | |||
+ | * [https://github.com/land-boards/lb-boards/blob/master/Projects/QTPy/Land%20Boards/Land%20Boards%20QT%20Py%20Code/SWLEDX8.py SWLEDX8.py] = Control the card | ||
+ | |||
+ | === Raspberry Pi Pico === | ||
+ | |||
+ | ==== MMBASIC ==== | ||
+ | |||
+ | * [https://github.com/land-boards/RasPiPico/blob/main/PicoMite_MMBASIC/PicoMite_VGA/Land%20Boards%20BASIC%20Programs/SWLEDX8-01.bas SWLEDX8-01.bas] - Read 8x switches, write 8x LEDs | ||
+ | * [https://github.com/land-boards/RasPiPico/blob/main/PicoMite_MMBASIC/PicoMite_VGA/Land%20Boards%20BASIC%20Programs/lbcards/GPIO16-02.bas MMBASIC Example Code] - Bounce a bit across the 16-bits (not for use with [[SWLEDX8]] card) | ||
+ | * [https://github.com/land-boards/RasPiPico/blob/main/PicoMite_MMBASIC/PicoMite_VGA/Land%20Boards%20BASIC%20Programs/lbcards/swledx8-03.bas swledx8-03.bas] - Write alternating pattern to LEDs then read/write switches to LEDs | ||
+ | |||
+ | === I2C VHDL Code === | ||
+ | |||
+ | * [https://github.com/douggilliland/MultiComp/tree/master/MultiComp%20(VHDL%20Template)/Components/I2C I2C VHDL Code] | ||
+ | |||
+ | == Mechanicals == | ||
+ | |||
+ | [[File:SWLEDX8-I2C-MECHS(REV2).PNG]] | ||
+ | |||
+ | == Versions == | ||
+ | |||
+ | === Rev 2 === | ||
+ | |||
+ | * '''Not''' functionally the same as Rev X1 | ||
+ | ** Flips the data bits to match the [[SWLEDX8]] card | ||
+ | *** Programs can read/write in bytes (no shuffling of bits needed) | ||
+ | * Change resistors from SMT (0805) to through hole (1/8W) | ||
+ | * Adds silkscreen Front/Rear | ||
+ | * Added test block to rear | ||
+ | * Moves "Rev 2" silkscreen to rear | ||
+ | |||
+ | === Rev X1 === | ||
+ | * Words, no issues | ||
− | == | + | == Assembly Sheet == |
− | [[ | + | * [[SWLEDX8-I2C Rev 2 Assembly Sheet]] |
+ | * [[SWLEDX8-I2C Rev X1 Assembly Sheet]] |
Latest revision as of 10:35, 21 June 2022
Contents
Features
- 16-Bit Digital I/O card with a small form factor
- MCP23017 I/O Expander
- I2C interface
- Card can be used standalone or stacked together with the SWLEDX8 card
- I2C Daisy-Chain (In/Out) connectors
- (3) I2C Address select jumpers for up to 8 devices per I2C bus
- SCL/SDA termination jumpers
- 2x10 pins Digital I/O Header
- 16 digital pins
- 2 power, 2 ground pins
- 59mmx38mm
- (4) #4-40 mounting holes
- Software Drivers
Build Options
- There are a number of options for using the card
- Stacked option with SWLEDX8 card
- Small footprint option
- Low height/profile option
Stacked option with SWLEDX8 card
- SWLEDX8 card mounts above this card
- Pins can be directly mounted to both cards or male/female connector pairs can be used
Small footprint option
Low height/profile option
Rear Side Marking
Connectors
- Connectors are as follows
P1 - GPIO Pins
Connections to SWLEDX8 Card
- When paired with SWLEDX8
- Board Rev 2 reverses bit order for byte transfers can be used
P2 - I2C Interface
- 2X5 header
- Pinout
- GND
- VCC
- SDA
- SCL
- INTA
P3 - I2C Terminators / I2C Address Offset Jumpers
- Install left 2 jumpers to terminate I2C bus
- Typically, the "last" card in a chain
- Install right 3 jumpers for I2C base address offset in range 0x20 (all installed) to 0x27 (all removed)
I2C Address | J3(A2) | J3(A1) | J3(A0) |
---|---|---|---|
0x0 | In | In | In |
0x1 | In | In | Out |
0x2 | In | Out | In |
0x3 | In | Out | Out |
0x4 | Out | In | In |
0x5 | Out | In | Out |
0x6 | Out | Out | In |
0x7 | Out | Out | Out |
Drivers / Software Examples
- Any MCP23017 library should work with this card
- Here's our tested code
Arduino
- LandBoards MCP23017
- pinMode(uint8_t bit, uint8_t value) - Set bits 0-7=Input, 8-15=Output
- readGPIOA() - Read the 8 Switches
- writeOLATB(uint8_t baData) _ Write the 8 LEDs
- digitalRead(uint8_t bit) - read a single Switch (bit=0-7)
- digitalWrite(uint8_t bit, uint8_t wrVal) - write a single LED (nit=8-15)
- SWLEDX8_01.ino - Read 8 Switches, Write 8 LEDs
MicroPython Drivers
ESP32 MicroPython Driver
PyBoard MicroPython Driver
CircuitPython
- SWLEDX8.py = Control the card
Raspberry Pi Pico
MMBASIC
- SWLEDX8-01.bas - Read 8x switches, write 8x LEDs
- MMBASIC Example Code - Bounce a bit across the 16-bits (not for use with SWLEDX8 card)
- swledx8-03.bas - Write alternating pattern to LEDs then read/write switches to LEDs
I2C VHDL Code
Mechanicals
Versions
Rev 2
- Not functionally the same as Rev X1
- Flips the data bits to match the SWLEDX8 card
- Programs can read/write in bytes (no shuffling of bits needed)
- Flips the data bits to match the SWLEDX8 card
- Change resistors from SMT (0805) to through hole (1/8W)
- Adds silkscreen Front/Rear
- Added test block to rear
- Moves "Rev 2" silkscreen to rear
Rev X1
- Words, no issues