-
Notifications
You must be signed in to change notification settings - Fork 18
Add support for the two new 4 tile mic array boards #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mbruno-xmos
wants to merge
8
commits into
xmos:master
Choose a base branch
from
mbruno-xmos:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+228
−11
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c34d47a
Add support for 4-tile smart mic board
ce7c0e4
Support the new quad tile bga device mic array board. LEDs not suppor…
9bffa60
Added wscript
andrewxcav 26aaca9
Merge pull request #1 from andrewxcav/master
deb3070
Add LED support for the BGA167 mic array board
6f337a0
Merge remote-tracking branch 'xmos/master'
9d3816a
Add comments, rename LED driver task, update version number
e01d1d5
Changed mabs timer to treat MIN_POLL_TIME_US as microseconds instead …
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ MODULE_XCC_XC_FLAGS = $(XCC_XC_FLAGS) | |
|
|
||
| DEPENDENT_MODULES = lib_i2c(>=4.0.0) | ||
|
|
||
| VERSION = 2.2.3 | ||
| VERSION = 2.3.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
lib_mic_array_board_support/src/ma_bga167_led_driver.xc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| // Copyright (c) 2015-2017, XMOS Ltd, All rights reserved | ||
|
|
||
| #include "mic_array_board_support.h" | ||
|
|
||
| #ifdef MIC_BOARD_LED_STCP | ||
|
|
||
| out port p_led_stcp = MIC_BOARD_LED_STCP; | ||
| out port p_led_shcp = MIC_BOARD_LED_SHCP; | ||
| out port p_led_data = MIC_BOARD_LED_DATA; | ||
|
|
||
| #define MAX(a,b) ((a) > (b) ? (a) : (b)) | ||
|
|
||
| #define LED_COUNT MIC_BOARD_SUPPORT_LED_COUNT | ||
|
|
||
| /* | ||
| * Timing data from: | ||
| * https://assets.nexperia.com/documents/data-sheet/74HC_HCT595.pdf | ||
| * | ||
| * Hold times are negligible (less than 1 tick) | ||
| */ | ||
|
|
||
| /* | ||
| * The chip is really powered at 3.3V. The values for 4.5V | ||
| * seem to work fine, at least at room temperature. | ||
| */ | ||
| #define VCC 4 | ||
|
|
||
| #if VCC==2 | ||
| /* | ||
| * Assuming Vcc = 2V, -40C to 85C | ||
| */ | ||
| #define T_DS_SHCP_SU 7 /* min setup time for DS before SHCP high */ | ||
| #define T_SHCP_Q7S_PD 20 /* max SHCP to Q7S propagation delay */ | ||
| #define T_CLK_PW 10 /* min pulse width for STCP and SHCP */ | ||
| #define T_CLK_PERIOD 21 /* min clock period for SHCP */ | ||
| #define T_SHCP_STCP_SU 10 /* min setup time for SHCP before SCTP high */ | ||
|
|
||
| #elif VCC==4 | ||
| /* | ||
| * Assuming Vcc = 4.5V, -40C to 85C | ||
| */ | ||
| #define T_DS_SHCP_SU 2 /* min setup time for DS before SHCP high */ | ||
| #define T_SHCP_Q7S_PD 5 /* max SHCP to Q7S propagation delay */ | ||
| #define T_CLK_PW 2 /* min pulse width for STCP and SHCP */ | ||
| #define T_CLK_PERIOD 5 /* min clock period for SHCP */ | ||
| #define T_SHCP_STCP_SU 2 /* min setup time for SHCP before SCTP high */ | ||
|
|
||
| #endif | ||
|
|
||
| /* calculate minimum time that SHCP must be low for between high pulses */ | ||
| #define T_SHCP_LOW (MAX(T_CLK_PERIOD, (T_SHCP_Q7S_PD + T_DS_SHCP_SU)) - T_CLK_PW) | ||
|
|
||
| static void wait_ticks(int ticks) | ||
| { | ||
| timer tmr; | ||
| uint32_t t; | ||
| tmr :> t; | ||
| tmr when timerafter(t+ticks-1) :> void; | ||
| } | ||
|
|
||
| /*************************************************************** | ||
| Numbers are for the VCC=2V, -40C to 85C case. | ||
|
|
||
| shcp high for 10 ticks | ||
| shcp low for 17 ticks | ||
| ds change 7 ticks before clock high | ||
| ds changes every 27 ticks | ||
|
|
||
| 270 100 170 | ||
| <----------------><-------><-------> | ||
| ________ ________ _______ | ||
| shcp _______| |________| |________| ... | ||
|
|
||
| 70 (setup time) 70 | ||
| <--> <--> | ||
| __ ________________ ________________ ___________ | ||
| ds __/\________________\/________________/\___________... | ||
|
|
||
| 200 70 (200ns is clk high to q7s valid, 70ns is setup time) | ||
| <------------><--> | ||
| _____________________ _________________ __________ | ||
| q7s _____________________/\_________________\/__________... | ||
|
|
||
| ***************************************************************/ | ||
|
|
||
| static void led_driver(out port stcp, out port shcp, out port data, uint16_t led_value) | ||
| { | ||
| stcp <: 0; | ||
| shcp <: 0; | ||
| data <: 0; | ||
|
|
||
| data <: (uint32_t)led_value >> LED_COUNT-1; | ||
| wait_ticks(T_DS_SHCP_SU); | ||
| shcp <: 1; | ||
|
|
||
| for (int i = 0; i < LED_COUNT-1; i++) { | ||
| wait_ticks(T_CLK_PW); | ||
| shcp <: 0; | ||
| wait_ticks(T_SHCP_LOW - T_DS_SHCP_SU); | ||
|
|
||
| /* left shift led_value out (MSB first) */ | ||
| led_value <<= 1; | ||
| data <: (uint32_t)led_value >> LED_COUNT-1; | ||
| wait_ticks(T_DS_SHCP_SU); | ||
| shcp <: 1; | ||
| } | ||
|
|
||
| wait_ticks(T_SHCP_STCP_SU); | ||
| stcp <: 1; | ||
| wait_ticks(T_CLK_PW); | ||
| shcp <: 0; | ||
| stcp <: 0; | ||
| } | ||
|
|
||
| [[combinable]] | ||
| void mabs_bga167_led_driver(server interface ma_bga167_led_if leds) | ||
| { | ||
| while (1) { | ||
| select { | ||
| case leds.set_leds(uint16_t led_value): | ||
| led_driver(p_led_stcp, p_led_shcp, p_led_data, led_value); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #endif | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is commented out it seems better to simply delete it.