Skip to content

Commit 90ede7a

Browse files
author
Cruz Monrreal
authored
Merge pull request #7814 from SeppoTakalo/connectivity-drivers
Connectivity drivers
2 parents 993c897 + 0456085 commit 90ede7a

37 files changed

+9096
-9
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ matrix:
162162
- python tools/make.py -t GCC_ARM -m K64F --source=. --build=BUILD/K64F/GCC_ARM -j0
163163
# Check that example compiles without rtos
164164
- sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' $EVENTS/README.md > main.cpp
165-
- rm -r rtos features/cellular features/netsocket features/nanostack features/lwipstack features/frameworks/greentea-client features/frameworks/utest features/frameworks/unity BUILD
165+
- rm -r rtos features/cellular features/netsocket features/nanostack features/lwipstack features/frameworks/greentea-client features/frameworks/utest features/frameworks/unity components BUILD
166166
- python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0
167167
# Run local equeue tests
168168
- make -C $EVENTS/equeue test
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Unless specifically indicated otherwise in a file, files are licensed
2+
under the Apache 2.0 license, as can be found in: apache-2.0.txt
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Example RF driver for Atmel 802.15.4 transceivers #
2+
3+
Support for:
4+
* AT86RF233
5+
* AT86RF212B
6+
7+
This driver is used with 6LoWPAN stack.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
3+
Apache License
4+
5+
Version 2.0, January 2004
6+
7+
http://www.apache.org/licenses/
8+
9+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
10+
11+
1. Definitions.
12+
13+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
14+
15+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
16+
17+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
18+
19+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
20+
21+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
22+
23+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
24+
25+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
26+
27+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
28+
29+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
30+
31+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
32+
33+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
34+
35+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
36+
37+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
38+
39+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
40+
You must cause any modified files to carry prominent notices stating that You changed the files; and
41+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
42+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
43+
44+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
45+
46+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
47+
48+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
49+
50+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
51+
52+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
53+
54+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
55+
56+
END OF TERMS AND CONDITIONS
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Licensed under the Apache License, Version 2.0 (the License); you may
5+
* not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef NANOSTACK_RF_PHY_ATMEL_H_
18+
#define NANOSTACK_RF_PHY_ATMEL_H_
19+
20+
#include "at24mac.h"
21+
#include "PinNames.h"
22+
23+
#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI
24+
25+
#include "NanostackRfPhy.h"
26+
27+
// Arduino pin defaults for convenience
28+
#if !defined(ATMEL_SPI_MOSI)
29+
#define ATMEL_SPI_MOSI D11
30+
#endif
31+
#if !defined(ATMEL_SPI_MISO)
32+
#define ATMEL_SPI_MISO D12
33+
#endif
34+
#if !defined(ATMEL_SPI_SCLK)
35+
#define ATMEL_SPI_SCLK D13
36+
#endif
37+
#if !defined(ATMEL_SPI_CS)
38+
#define ATMEL_SPI_CS D10
39+
#endif
40+
#if !defined(ATMEL_SPI_RST)
41+
#define ATMEL_SPI_RST D5
42+
#endif
43+
#if !defined(ATMEL_SPI_SLP)
44+
#define ATMEL_SPI_SLP D7
45+
#endif
46+
#if !defined(ATMEL_SPI_IRQ)
47+
#define ATMEL_SPI_IRQ D9
48+
#endif
49+
#if !defined(ATMEL_I2C_SDA)
50+
#define ATMEL_I2C_SDA D14
51+
#endif
52+
#if !defined(ATMEL_I2C_SCL)
53+
#define ATMEL_I2C_SCL D15
54+
#endif
55+
56+
class RFBits;
57+
58+
class NanostackRfPhyAtmel : public NanostackRfPhy {
59+
public:
60+
NanostackRfPhyAtmel(PinName spi_mosi, PinName spi_miso,
61+
PinName spi_sclk, PinName spi_cs, PinName spi_rst, PinName spi_slp, PinName spi_irq,
62+
PinName i2c_sda, PinName i2c_scl);
63+
virtual ~NanostackRfPhyAtmel();
64+
virtual int8_t rf_register();
65+
virtual void rf_unregister();
66+
virtual void get_mac_address(uint8_t *mac);
67+
virtual void set_mac_address(uint8_t *mac);
68+
69+
private:
70+
AT24Mac _mac;
71+
uint8_t _mac_addr[8];
72+
RFBits *_rf;
73+
bool _mac_set;
74+
75+
const PinName _spi_mosi;
76+
const PinName _spi_miso;
77+
const PinName _spi_sclk;
78+
const PinName _spi_cs;
79+
const PinName _spi_rst;
80+
const PinName _spi_slp;
81+
const PinName _spi_irq;
82+
};
83+
84+
#endif /* MBED_CONF_NANOSTACK_CONFIGURATION */
85+
#endif /* NANOSTACK_RF_PHY_ATMEL_H_ */
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "atmel-rf",
3+
"config": {
4+
"full-spi-speed": {
5+
"help": "Maximum SPI clock speed (Hz), as long as sufficient inter-byte spacing",
6+
"value": 7500000
7+
},
8+
"full-spi-speed-byte-spacing": {
9+
"help": "Required byte spacing in nanoseconds if full SPI speed is in use",
10+
"value": 250
11+
},
12+
"low-spi-speed": {
13+
"help": "Maximum SPI clock speed (Hz) if no inter-byte spacing",
14+
"value": 3750000
15+
},
16+
"use-spi-spacing-api": {
17+
"help": "Use SPI spacing API proposed in https://github.com/ARMmbed/mbed-os/pull/5353 to ensure spacing between bytes - either run at full speed with spacing, or low with no spacing",
18+
"value": false
19+
},
20+
"assume-spaced-spi": {
21+
"help": "If not using SPI spacing API, assume platform has widely-spaced bytes in bursts, so use full clock speed rather than low.",
22+
"value": false
23+
},
24+
"provide-default": {
25+
"help": "Provide default NanostackRfpy. [true/false]",
26+
"value": false
27+
}
28+
},
29+
"target_overrides": {
30+
"STM": {
31+
"assume-spaced-spi": true
32+
}
33+
}
34+
}
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
/*
2+
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Licensed under the Apache License, Version 2.0 (the License); you may
5+
* not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef AT86RFREG_H_
18+
#define AT86RFREG_H_
19+
#ifdef __cplusplus
20+
extern "C" {
21+
#endif
22+
23+
/*AT86RF212 PHY Modes*/
24+
#define BPSK_20 0x00
25+
#define BPSK_40 0x04
26+
#define BPSK_40_ALT 0x14
27+
#define OQPSK_SIN_RC_100 0x08
28+
#define OQPSK_SIN_RC_200 0x09
29+
#define OQPSK_RC_100 0x18
30+
#define OQPSK_RC_200 0x19
31+
#define OQPSK_SIN_250 0x0c
32+
#define OQPSK_SIN_500 0x0d
33+
#define OQPSK_SIN_500_ALT 0x0f
34+
#define OQPSK_RC_250 0x1c
35+
#define OQPSK_RC_500 0x1d
36+
#define OQPSK_RC_500_ALT 0x1f
37+
#define OQPSK_SIN_RC_400_SCR_ON 0x2A
38+
#define OQPSK_SIN_RC_400_SCR_OFF 0x0A
39+
#define OQPSK_RC_400_SCR_ON 0x3A
40+
#define OQPSK_RC_400_SCR_OFF 0x1A
41+
#define OQPSK_SIN_1000_SCR_ON 0x2E
42+
#define OQPSK_SIN_1000_SCR_OFF 0x0E
43+
#define OQPSK_RC_1000_SCR_ON 0x3E
44+
#define OQPSK_RC_1000_SCR_OFF 0x1E
45+
46+
/*Supported transceivers*/
47+
#define PART_AT86RF231 0x03
48+
#define PART_AT86RF212 0x07
49+
#define PART_AT86RF233 0x0B
50+
#define VERSION_AT86RF212 0x01
51+
#define VERSION_AT86RF212B 0x03
52+
53+
/*RF Configuration Registers*/
54+
#define TRX_STATUS 0x01
55+
#define TRX_STATE 0x02
56+
#define TRX_CTRL_0 0x03
57+
#define TRX_CTRL_1 0x04
58+
#define PHY_TX_PWR 0x05
59+
#define PHY_RSSI 0x06
60+
#define PHY_ED_LEVEL 0x07
61+
#define PHY_CC_CCA 0x08
62+
#define RX_CTRL 0x0A
63+
#define SFD_VALUE 0x0B
64+
#define TRX_CTRL_2 0x0C
65+
#define ANT_DIV 0x0D
66+
#define IRQ_MASK 0x0E
67+
#define IRQ_STATUS 0x0F
68+
#define VREG_CTRL 0x10
69+
#define BATMON 0x11
70+
#define XOSC_CTRL 0x12
71+
#define CC_CTRL_0 0x13
72+
#define CC_CTRL_1 0x14
73+
#define RX_SYN 0x15
74+
#define TRX_RPC 0x16
75+
#define RF_CTRL_0 0x16
76+
#define XAH_CTRL_1 0x17
77+
#define FTN_CTRL 0x18
78+
#define PLL_CF 0x1A
79+
#define PLL_DCU 0x1B
80+
#define PART_NUM 0x1C
81+
#define VERSION_NUM 0x1D
82+
#define MAN_ID_0 0x1E
83+
#define MAN_ID_1 0x1F
84+
#define SHORT_ADDR_0 0x20
85+
#define SHORT_ADDR_1 0x21
86+
#define PAN_ID_0 0x22
87+
#define PAN_ID_1 0x23
88+
#define IEEE_ADDR_0 0x24
89+
#define IEEE_ADDR_1 0x25
90+
#define IEEE_ADDR_2 0x26
91+
#define IEEE_ADDR_3 0x27
92+
#define IEEE_ADDR_4 0x28
93+
#define IEEE_ADDR_5 0x29
94+
#define IEEE_ADDR_6 0x2A
95+
#define IEEE_ADDR_7 0x2B
96+
#define XAH_CTRL_0 0x2C
97+
#define CSMA_SEED_0 0x2D
98+
#define CSMA_SEED_1 0x2E
99+
#define CSMA_BE 0x2F
100+
101+
/* CSMA_SEED_1*/
102+
#define AACK_FVN_MODE1 7
103+
#define AACK_FVN_MODE0 6
104+
#define AACK_SET_PD 5
105+
#define AACK_DIS_ACK 4
106+
#define AACK_I_AM_COORD 3
107+
#define CSMA_SEED_12 2
108+
#define CSMA_SEED_11 1
109+
#define CSMA_SEED_10 0
110+
111+
/*TRX_STATUS bits*/
112+
#define CCA_STATUS 0x40
113+
#define CCA_DONE 0x80
114+
115+
/*PHY_CC_CCA bits*/
116+
#define CCA_REQUEST 0x80
117+
#define CCA_MODE_3A 0x00
118+
#define CCA_MODE_1 0x20
119+
#define CCA_MODE_2 0x40
120+
#define CCA_MODE_3B 0x60
121+
#define CCA_MODE_MASK 0x60
122+
#define CCA_CHANNEL_MASK 0x1F
123+
124+
/*IRQ_MASK bits*/
125+
#define RX_START 0x04
126+
#define TRX_END 0x08
127+
#define CCA_ED_DONE 0x10
128+
#define AMI 0x20
129+
#define TRX_UR 0x40
130+
131+
/*ANT_DIV bits*/
132+
#define ANT_DIV_EN 0x08
133+
#define ANT_EXT_SW_EN 0x04
134+
#define ANT_CTRL_DEFAULT 0x03
135+
136+
/*TRX_CTRL_1 bits*/
137+
#define PA_EXT_EN 0x80
138+
#define TX_AUTO_CRC_ON 0x20
139+
#define SPI_CMD_MODE_TRX_STATUS 0x04
140+
#define SPI_CMD_MODE_PHY_RSSI 0x08
141+
#define SPI_CMD_MODE_IRQ_STATUS 0x0C
142+
143+
/*TRX_CTRL_2 bits*/
144+
#define RX_SAFE_MODE 0x80
145+
146+
/*FTN_CTRL bits*/
147+
#define FTN_START 0x80
148+
149+
/*PHY_RSSI bits*/
150+
#define CRC_VALID 0x80
151+
152+
/*RX_SYN bits*/
153+
#define RX_PDT_DIS 0x80
154+
155+
/*TRX_RPC bits */
156+
#define RX_RPC_CTRL 0xC0
157+
#define RX_RPC_EN 0x20
158+
#define PDT_RPC_EN 0x10
159+
#define PLL_RPC_EN 0x08
160+
#define XAH_TX_RPC_EN 0x04
161+
#define IPAN_RPC_EN 0x02
162+
#define TRX_RPC_RSVD_1 0x01
163+
164+
/*XAH_CTRL_1 bits*/
165+
#define AACK_PROM_MODE 0x02
166+
167+
168+
#ifdef __cplusplus
169+
}
170+
#endif
171+
172+
#endif /* AT86RFREG_H_ */

0 commit comments

Comments
 (0)