-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #490 from shino-ixy/rs422_example
examples : add RS-422 sample
- Loading branch information
Showing
7 changed files
with
890 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,51 @@ | ||
# | ||
# For a description of the syntax of this configuration file, | ||
# see the file kconfig-language.txt in the NuttX tools repository. | ||
# | ||
|
||
config EXAMPLES_RS422 | ||
tristate "RS422 master/slave example" | ||
default n | ||
---help--- | ||
Enable the RS422 master/slave communication sample | ||
|
||
if EXAMPLES_RS422 | ||
|
||
choice | ||
prompt "Read Enable Pin Assign" | ||
default EXAMPLES_RS422_RE_PIN_I2S_DIN | ||
|
||
config EXAMPLES_RS422_RE_PIN_EMMC_DATA3 | ||
bool "EMMC_DATA3" | ||
|
||
config EXAMPLES_RS422_RE_PIN_I2S_DIN | ||
bool "I2S_DIN" | ||
endchoice | ||
|
||
choice | ||
prompt "Data Enable Pin Assign" | ||
default EXAMPLES_RS422_DE_PIN_I2S_DOUT | ||
|
||
config EXAMPLES_RS422_DE_PIN_EMMC_DATA2 | ||
bool "EMMC_DATA3" | ||
|
||
config EXAMPLES_RS422_DE_PIN_I2S_DOUT | ||
bool "I2S_DOUT" | ||
endchoice | ||
|
||
config EXAMPLES_RS422_PROGNAME | ||
string "Program name" | ||
default "rs422" | ||
---help--- | ||
This is the name of the program that will be use when the NSH ELF | ||
program is installed. | ||
|
||
config EXAMPLES_RS422_PRIORITY | ||
int "rs422 task priority" | ||
default 100 | ||
|
||
config EXAMPLES_RS422_STACKSIZE | ||
int "rs422 stack size" | ||
default 2048 | ||
|
||
endif |
This file contains 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,6 @@ | ||
############################################################################ | ||
# rs422/Make.defs | ||
############################################################################ | ||
ifneq ($(CONFIG_EXAMPLES_RS422),) | ||
CONFIGURED_APPS += rs422 | ||
endif |
This file contains 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,18 @@ | ||
############################################################################ | ||
# rs422/Makefile | ||
############################################################################ | ||
|
||
include $(APPDIR)/Make.defs | ||
|
||
# RS422 built-in application info | ||
PROGNAME = $(CONFIG_EXAMPLES_RS422_PROGNAME) | ||
PRIORITY = $(CONFIG_EXAMPLES_RS422_PRIORITY) | ||
STACKSIZE = $(CONFIG_EXAMPLES_RS422_STACKSIZE) | ||
MODULE = $(CONFIG_EXAMPLES_RS422) | ||
|
||
# RS422 Example | ||
ASRCS = | ||
CSRCS = | ||
MAINSRC = rs422_main.c | ||
|
||
include $(APPDIR)/Application.mk |
This file contains 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,50 @@ | ||
examplex/rs422 | ||
^^^^^^^^^^^^^^ | ||
|
||
Example for communicate nodes via RS422. | ||
|
||
Sample application to link two SPRESENSEs using RS422. | ||
There is a loopback mode to verify operation with one | ||
SPRESENSE and a master/slave mode to link two SPRESENSEs. | ||
Communication results are displayed in stdout. | ||
|
||
The following configuration options can be selected: | ||
|
||
CONFIG_EXAMPLES_RS422 -- rs422 example. | ||
Default: n | ||
CONFIG_EXAMPLES_RS422_RE_PIN_EMMC_DATA3 | ||
or CONFIG_EXAMPLES_RS422_RE_PIN_I2S_DIN | ||
-- Read Enable Pin Assign | ||
Default: "CONFIG_EXAMPLES_RS422_RE_PIN_I2S_DIN" | ||
CONFIG_EXAMPLES_RS422_RE_PIN_EMMC_DATA3 | ||
or CONFIG_EXAMPLES_RS422_RE_PIN_I2S_DIN | ||
-- Data Enable Pin Assign | ||
Default: "CONFIG_EXAMPLES_RS422_DE_PIN_I2S_DOUT" | ||
CONFIG_EXAMPLES_RS422_PROGNAME -- this program if change this field. | ||
Default: "rs422" | ||
CONFIG_EXAMPLES_RS422_PRIORITY -- Specified this example's task priority. | ||
Default: 100 | ||
CONFIG_EXAMPLES_RS422_STACKSIZE -- Specified this example's stack size. | ||
Default: 2048 | ||
|
||
Build kernel and SDK: | ||
|
||
This application can be used by rs422 default config. | ||
|
||
$ ./tools/config.py examples/rs422 | ||
$ make | ||
|
||
Execute under nsh: | ||
|
||
Type 'rs422' and option on nsh like this. | ||
|
||
If you want to run in loopback mode, | ||
nsh> rs422 -l | ||
|
||
If you want to run in master/slave mode, | ||
First execute the following in the slave mode side of the presense | ||
nsh> rs422 -s | ||
|
||
Next, on the master mode side, in the spresense, do the following | ||
nsh> rs422 -m | ||
|
Oops, something went wrong.