PicoWAN SDK Documentation
boards.h
Go to the documentation of this file.
1 
31 #ifndef _BOARDS_H_
32 #define _BOARDS_H_
33 
34 #include <gpio.h>
35 
36 #if defined(CFG_murata_sychip_board)
37 /* ***********************************************************************************
38  *
39  * MURATA SyChip Board (early prototype with an STM32L082CZ)
40  *
41  *************************************************************************************/
42 
43 #define HAS_TCXO
44 
45 // RF characteristics
46 #define MAX_RF_POWER 20 // dBm
47 #define MIN_RF_POWER 0 // dBm
48 #define ANTENNA_GAIN 0 // dBi
49 #define LNA_GAIN 0 // dB
50 
51 // GPIOs
52 #define NSS_PORT GPIO_PORT_A // NSS: PA15, sx1276
53 #define NSS_PIN 15
54 
55 #define RX_PORT GPIO_PORT_A // RX: PA1
56 #define RX_PIN 1
57 #define TX_RFO_PORT GPIO_PORT_C // TX_RFO: PC2
58 #define TX_RFO_PIN 2
59 #define TX_PA_PORT GPIO_PORT_C // TX_PA: PC1
60 #define TX_PA_PIN 1
61 #define TCXO_PORT GPIO_PORT_A // PA12
62 #define TCXO_PIN 12
63 
64 #define RST_PORT GPIO_PORT_C // RST: PC0
65 #define RST_PIN 0
66 
67 #define DIO0_PORT GPIO_PORT_B // DIO0: PB4, sx1276 (line 1 irq handler)
68 #define DIO0_PIN 4
69 #define DIO0_TYPE GPIO_PUPD_NONE
70 #define DIO1_PORT GPIO_PORT_B // DIO1: PB1, sx1276 (line 2 irq handler)
71 #define DIO1_PIN 1
72 #define DIO1_TYPE GPIO_PUPD_NONE
73 #define DIO2_PORT GPIO_PORT_B // DIO2: PB0, sx1276 (line 3 irq handler)
74 #define DIO2_PIN 0
75 #define DIO2_TYPE GPIO_PUPD_NONE
76 
77 #define LED0_PORT GPIO_PORT_B // Red LED: PB12
78 #define LED0_PIN 12
79 #define LED0_MODE LED_ACTIVE_HIGH
80 #define LED1_PORT GPIO_PORT_B // Yellow LED: PB13
81 #define LED1_PIN 13
82 #define LED1_MODE LED_ACTIVE_HIGH
83 #define LED2_PORT GPIO_PORT_B // Green LED: PB14
84 #define LED2_PIN 14
85 #define LED2_MODE LED_ACTIVE_HIGH
86 
87 #define BUTTON0_PORT GPIO_PORT_B // PB15
88 #define BUTTON0_PIN 15
89 #define BUTTON0_MODE BUTTON_ACTIVE_LOW
90 #define BUTTON0_TYPE GPIO_PUPD_UP
91 
92 #define OUTPUT_PINS {{NSS_PORT, NSS_PIN}, {RX_PORT, RX_PIN}, {TX_RFO_PORT, TX_RFO_PIN}, \
93  {TX_PA_PORT, TX_PA_PIN}, \
94  {LED0_PORT, LED0_PIN}, {LED1_PORT, LED1_PIN}, {LED2_PORT, LED2_PIN}, \
95  {TCXO_PORT, TCXO_PIN}}
96 #define INPUT_PINS {{DIO0_PORT, DIO0_PIN, DIO0_TYPE}, {DIO1_PORT, DIO1_PIN, DIO1_TYPE}, {DIO2_PORT, DIO2_PIN, DIO2_TYPE}, \
97  {BUTTON0_PORT, BUTTON0_PIN, BUTTON0_TYPE}}
98 
99 // SPI
100 #define SCK_PORT GPIO_PORT_B // SCK: PB3
101 #define SCK_PIN 3
102 #define MISO_PORT GPIO_PORT_A // MISO: PA6
103 #define MISO_PIN 6
104 #define MOSI_PORT GPIO_PORT_A // MOSI: PA7
105 #define MOSI_PIN 7
106 
107 #define GPIO_AF_SPI1 0x00
108 
109 // Console USART
110 #define CONSOLE_USART LPUART_PORT_1
111 
112 #define CONSOLE_USART_TX_PORT GPIO_PORT_A // PA2
113 #define CONSOLE_USART_TX_PIN 2
114 #define CONSOLE_USART_RX_PORT GPIO_PORT_A // PA3
115 #define CONSOLE_USART_RX_PIN 3
116 
117 #define CONSOLE_USART_AF 0x06
118 
119 #define LOWPOWER_PINS {{NSS_PORT, NSS_PIN}, {TX_RFO_PORT, TX_RFO_PIN}, {RX_PORT, RX_PIN}, \
120  {TX_PA_PORT, TX_PA_PIN}, {RST_PORT, RST_PIN}, \
121  {DIO0_PORT, DIO0_PIN}, {DIO1_PORT, DIO1_PIN}, {DIO2_PORT, DIO2_PIN}, \
122  {LED0_PORT, LED0_PIN}, {LED1_PORT, LED1_PIN}, {LED2_PORT, LED2_PIN}, \
123  {CONSOLE_USART_TX_PORT, CONSOLE_USART_TX_PIN}, {CONSOLE_USART_RX_PORT, CONSOLE_USART_RX_PIN}, \
124  {BUTTON0_PORT, BUTTON0_PIN}, \
125  {TCXO_PORT, TCXO_PIN}}
126 #elif defined(CFG_murata_discovery_board)
127 /* ***********************************************************************************
128  *
129  * MURATA Discovery Kit (B-L072Z-LRWAN1)
130  *
131  *************************************************************************************/
132 
133 #define HAS_TCXO
134 
135 // RF characteristics
136 #define MAX_RF_POWER 20 // dBm
137 #define MIN_RF_POWER 0 // dBm
138 #define ANTENNA_GAIN 0 // dBi
139 #define LNA_GAIN 0 // dB
140 
141 // GPIOs
142 #define NSS_PORT GPIO_PORT_A // NSS: PA15, sx1276
143 #define NSS_PIN 15
144 
145 #define RX_PORT GPIO_PORT_A // RX: PA1
146 #define RX_PIN 1
147 #define TX_RFO_PORT GPIO_PORT_C // TX_RFO: PC2
148 #define TX_RFO_PIN 2
149 #define TX_PA_PORT GPIO_PORT_C // TX_PA: PC1
150 #define TX_PA_PIN 1
151 #define TCXO_PORT GPIO_PORT_A // PA12
152 #define TCXO_PIN 12
153 
154 #define RST_PORT 2 // RST: PC0
155 #define RST_PIN 0
156 
157 #define DIO0_PORT GPIO_PORT_B // DIO0: PB4, sx1276 (line 1 irq handler)
158 #define DIO0_PIN 4
159 #define DIO0_TYPE GPIO_PUPD_NONE
160 #define DIO1_PORT GPIO_PORT_B // DIO1: PB1, sx1276 (line 2 irq handler)
161 #define DIO1_PIN 1
162 #define DIO1_TYPE GPIO_PUPD_NONE
163 #define DIO2_PORT GPIO_PORT_B // DIO2: PB0, sx1276 (line 3 irq handler)
164 #define DIO2_PIN 0
165 #define DIO2_TYPE GPIO_PUPD_NONE
166 
167 #define LED0_PORT GPIO_PORT_B // Red LED: PB7 (LED4)
168 #define LED0_PIN 7
169 #define LED0_MODE LED_ACTIVE_HIGH
170 #define LED1_PORT GPIO_PORT_B // Blue LED: PB6 (LED3)
171 #define LED1_PIN 6
172 #define LED1_MODE LED_ACTIVE_HIGH
173 #define LED2_PORT GPIO_PORT_A // Green LED: PA5 (LED2)
174 #define LED2_PIN 5
175 #define LED2_MODE LED_ACTIVE_HIGH
176 #define LED3_PORT GPIO_PORT_B // Green LED: PB5 (LED1)
177 #define LED3_PIN 5
178 #define LED3_MODE LED_ACTIVE_HIGH
179 
180 #define BUTTON0_PORT GPIO_PORT_B // PB2
181 #define BUTTON0_PIN 2
182 #define BUTTON0_MODE BUTTON_ACTIVE_LOW
183 #define BUTTON0_TYPE GPIO_PUPD_NONE
184 
185 #define OUTPUT_PINS {{NSS_PORT, NSS_PIN}, {RX_PORT, RX_PIN}, {TX_RFO_PORT, TX_RFO_PIN}, \
186  {TX_PA_PORT, TX_PA_PIN}, \
187  {LED0_PORT, LED0_PIN}, {LED1_PORT, LED1_PIN}, {LED2_PORT, LED2_PIN}, {LED3_PORT, LED3_PIN}, \
188  {TCXO_PORT, TCXO_PIN}}
189 #define INPUT_PINS {{DIO0_PORT, DIO0_PIN, DIO0_TYPE}, {DIO1_PORT, DIO1_PIN, DIO1_TYPE}, {DIO2_PORT, DIO2_PIN, DIO2_TYPE}, \
190  {BUTTON0_PORT, BUTTON0_PIN, BUTTON0_TYPE}}
191 
192 // SPI
193 #define SCK_PORT GPIO_PORT_B // SCK: PB3
194 #define SCK_PIN 3
195 #define MISO_PORT GPIO_PORT_A // MISO: PA6
196 #define MISO_PIN 6
197 #define MOSI_PORT GPIO_PORT_A // MOSI: PA7
198 #define MOSI_PIN 7
199 
200 #define GPIO_AF_SPI1 0x00
201 
202 // Console USART
203 #define CONSOLE_USART LPUART_PORT_1
204 
205 #define CONSOLE_USART_TX_PORT GPIO_PORT_A // PA2
206 #define CONSOLE_USART_TX_PIN 2
207 #define CONSOLE_USART_RX_PORT GPIO_PORT_A // PA3
208 #define CONSOLE_USART_RX_PIN 3
209 
210 #define CONSOLE_USART_AF 0x06
211 
212 #define LOWPOWER_PINS {{NSS_PORT, NSS_PIN}, {TX_RFO_PORT, TX_RFO_PIN}, {RX_PORT, RX_PIN}, \
213  {TX_PA_PORT, TX_PA_PIN}, {RST_PORT, RST_PIN}, \
214  {DIO0_PORT, DIO0_PIN}, {DIO1_PORT, DIO1_PIN}, {DIO2_PORT, DIO2_PIN}, \
215  {LED0_PORT, LED0_PIN}, {LED1_PORT, LED1_PIN}, {LED2_PORT, LED2_PIN}, {LED3_PORT, LED3_PIN}, \
216  {CONSOLE_USART_TX_PORT, CONSOLE_USART_TX_PIN}, {CONSOLE_USART_RX_PORT, CONSOLE_USART_RX_PIN}, \
217  {BUTTON0_PORT, BUTTON0_PIN}, \
218  {TCXO_PORT, TCXO_PIN}}
219 #elif defined(CFG_murata_module_board)
220 /* ***********************************************************************************
221  *
222  * MURATA CMWX1ZZABZ module alone
223  *
224  *************************************************************************************/
225 
226 #define HAS_TCXO
227 
228 // RF characteristics
229 #define MAX_RF_POWER 20 // dBm
230 #define MIN_RF_POWER 0 // dBm
231 #define ANTENNA_GAIN 0 // dBi
232 #define LNA_GAIN 0 // dB
233 
234 // GPIOs
235 #define NSS_PORT GPIO_PORT_A // NSS: PA15, sx1276
236 #define NSS_PIN 15
237 
238 #define RX_PORT GPIO_PORT_A // RX: PA1
239 #define RX_PIN 1
240 #define TX_RFO_PORT GPIO_PORT_C // TX_RFO: PC2
241 #define TX_RFO_PIN 2
242 #define TX_PA_PORT GPIO_PORT_C // TX_PA: PC1
243 #define TX_PA_PIN 1
244 #define TCXO_PORT GPIO_PORT_A // PA12
245 #define TCXO_PIN 12
246 
247 #define RST_PORT GPIO_PORT_C // RST: PC0
248 #define RST_PIN 0
249 
250 #define DIO0_PORT GPIO_PORT_B // DIO0: PB4, sx1276 (line 1 irq handler)
251 #define DIO0_PIN 4
252 #define DIO0_TYPE GPIO_PUPD_NONE
253 #define DIO1_PORT GPIO_PORT_B // DIO1: PB1, sx1276 (line 2 irq handler)
254 #define DIO1_PIN 1
255 #define DIO1_TYPE GPIO_PUPD_NONE
256 #define DIO2_PORT GPIO_PORT_B // DIO2: PB0, sx1276 (line 3 irq handler)
257 #define DIO2_PIN 0
258 #define DIO2_TYPE GPIO_PUPD_NONE
259 
260 #define OUTPUT_PINS {{NSS_PORT, NSS_PIN}, {RX_PORT, RX_PIN}, {TX_RFO_PORT, TX_RFO_PIN}, \
261  {TX_PA_PORT, TX_PA_PIN}, \
262  {TCXO_PORT, TCXO_PIN}}
263 #define INPUT_PINS {{DIO0_PORT, DIO0_PIN, DIO0_TYPE}, {DIO1_PORT, DIO1_PIN, DIO1_TYPE}, {DIO2_PORT, DIO2_PIN, DIO2_TYPE}}
264 
265 // SPI
266 #define SCK_PORT GPIO_PORT_B // SCK: PB3
267 #define SCK_PIN 3
268 #define MISO_PORT GPIO_PORT_A // MISO: PA6
269 #define MISO_PIN 6
270 #define MOSI_PORT GPIO_PORT_A // MOSI: PA7
271 #define MOSI_PIN 7
272 
273 #define GPIO_AF_SPI1 0x00
274 
275 // Console USART
276 #define CONSOLE_USART LPUART_PORT_1
277 
278 #define CONSOLE_USART_TX_PORT GPIO_PORT_A // PA2
279 #define CONSOLE_USART_TX_PIN 2
280 #define CONSOLE_USART_RX_PORT GPIO_PORT_A // PA3
281 #define CONSOLE_USART_RX_PIN 3
282 
283 #define CONSOLE_USART_AF 0x06
284 
285 #define LOWPOWER_PINS {{NSS_PORT, NSS_PIN}, {TX_RFO_PORT, TX_RFO_PIN}, {RX_PORT, RX_PIN}, \
286  {TX_PA_PORT, TX_PA_PIN}, {RST_PORT, RST_PIN}, \
287  {DIO0_PORT, DIO0_PIN}, {DIO1_PORT, DIO1_PIN}, {DIO2_PORT, DIO2_PIN}, \
288  {CONSOLE_USART_TX_PORT, CONSOLE_USART_TX_PIN}, {CONSOLE_USART_RX_PORT, CONSOLE_USART_RX_PIN}, \
289  {TCXO_PORT, TCXO_PIN}}
290 #elif defined(CFG_nucleo_board)
291 /* ***********************************************************************************
292  *
293  * STM32 Nucleo pack (NUCLEO-L073RZ + SX1276MB1LAS)
294  *
295  *************************************************************************************/
296 
297 // RF characteristics
298 #define MAX_RF_POWER 14 // dBm
299 #define MIN_RF_POWER 0 // dBm
300 #define ANTENNA_GAIN 0 // dBi
301 #define LNA_GAIN 0 // dB
302 
303 // GPIOs
304 #define NSS_PORT GPIO_PORT_B // NSS: PB6, sx1276
305 #define NSS_PIN 6
306 
307 #define TX_RFO_PORT GPIO_PORT_C // TX_RFO: PC1
308 #define TX_RFO_PIN 1
309 
310 #define RST_PORT GPIO_PORT_A // RST: PA0
311 #define RST_PIN 0
312 
313 #define DIO0_PORT GPIO_PORT_A // DIO0: PA10, sx1276 (line 1 irq handler)
314 #define DIO0_PIN 10
315 #define DIO0_TYPE GPIO_PUPD_NONE
316 #define DIO1_PORT GPIO_PORT_B // DIO1: PB3, sx1276 (line 2 irq handler)
317 #define DIO1_PIN 3
318 #define DIO1_TYPE GPIO_PUPD_NONE
319 #define DIO2_PORT GPIO_PORT_B // DIO2: PB5, sx1276 (line 3 irq handler)
320 #define DIO2_PIN 5
321 #define DIO2_TYPE GPIO_PUPD_NONE
322 
323 #define LED0_PORT GPIO_PORT_A // Red LED: PA1
324 #define LED0_PIN 1
325 #define LED0_MODE LED_ACTIVE_HIGH
326 #define LED1_PORT GPIO_PORT_A // Blue LED: PA4
327 #define LED1_PIN 4
328 #define LED1_MODE LED_ACTIVE_HIGH
329 
330 #define BUTTON0_PORT GPIO_PORT_C // PC13
331 #define BUTTON0_PIN 13
332 #define BUTTON0_MODE BUTTON_ACTIVE_LOW
333 #define BUTTON0_TYPE GPIO_PUPD_NONE
334 
335 #define OUTPUT_PINS {{NSS_PORT, NSS_PIN}, {TX_RFO_PORT, TX_RFO_PIN}, \
336  {LED0_PORT, LED0_PIN}, {LED1_PORT, LED1_PIN}}
337 #define INPUT_PINS {{DIO0_PORT, DIO0_PIN, DIO0_TYPE}, {DIO1_PORT, DIO1_PIN, DIO1_TYPE}, {DIO2_PORT, DIO2_PIN, DIO2_TYPE}, \
338  {BUTTON0_PORT, BUTTON0_PIN, BUTTON0_TYPE}}
339 
340 // SPI
341 #define SCK_PORT GPIO_PORT_A // SCK: PA5
342 #define SCK_PIN 5
343 #define MISO_PORT GPIO_PORT_A // MISO: PA6
344 #define MISO_PIN 6
345 #define MOSI_PORT GPIO_PORT_A // MOSI: PA7
346 #define MOSI_PIN 7
347 
348 #define GPIO_AF_SPI1 0x00
349 
350 // Console USART
351 #define CONSOLE_USART LPUART_PORT_1
352 
353 #define CONSOLE_USART_TX_PORT GPIO_PORT_A // PA2
354 #define CONSOLE_USART_TX_PIN 2
355 #define CONSOLE_USART_RX_PORT GPIO_PORT_A // PA3
356 #define CONSOLE_USART_RX_PIN 3
357 
358 #define CONSOLE_USART_AF 0x06
359 
360 #define LOWPOWER_PINS {{NSS_PORT, NSS_PIN}, {TX_RFO_PORT, TX_RFO_PIN}, \
361  {RST_PORT, RST_PIN}, \
362  {DIO0_PORT, DIO0_PIN}, {DIO1_PORT, DIO1_PIN}, {DIO2_PORT, DIO2_PIN}, \
363  {LED0_PORT, LED0_PIN}, {LED1_PORT, LED1_PIN}, \
364  {CONSOLE_USART_TX_PORT, CONSOLE_USART_TX_PIN}, {CONSOLE_USART_RX_PORT, CONSOLE_USART_RX_PIN}, \
365  {BUTTON0_PORT, BUTTON0_PIN}}
366 #elif defined(CFG_picoshield_board)
367 /* ***********************************************************************************
368  *
369  * Archos PicoShield for Arduino
370  *
371  *************************************************************************************/
372 
373 #define HAS_TCXO
374 
375 // RF characteristics
376 #define MAX_RF_POWER 20 // dBm
377 #define MIN_RF_POWER 0 // dBm
378 #define ANTENNA_GAIN 0 // dBi
379 #define LNA_GAIN 0 // dB
380 
381 // GPIOs
382 #define NSS_PORT GPIO_PORT_A // NSS: PA15, sx1276
383 #define NSS_PIN 15
384 
385 #define RX_PORT GPIO_PORT_A // RX: PA1
386 #define RX_PIN 1
387 #define TX_RFO_PORT GPIO_PORT_C // TX_RFO: PC2
388 #define TX_RFO_PIN 2
389 #define TX_PA_PORT GPIO_PORT_C // TX_PA: PC1
390 #define TX_PA_PIN 1
391 #define TCXO_PORT GPIO_PORT_H // PH1
392 #define TCXO_PIN 1
393 
394 #define RST_PORT GPIO_PORT_C // RST: PC0
395 #define RST_PIN 0
396 
397 #define DIO0_PORT GPIO_PORT_B // DIO0: PB4, sx1276 (line 1 irq handler)
398 #define DIO0_PIN 4
399 #define DIO0_TYPE GPIO_PUPD_NONE
400 #define DIO1_PORT GPIO_PORT_B // DIO1: PB1, sx1276 (line 2 irq handler)
401 #define DIO1_PIN 1
402 #define DIO1_TYPE GPIO_PUPD_NONE
403 #define DIO2_PORT GPIO_PORT_B // DIO2: PB0, sx1276 (line 3 irq handler)
404 #define DIO2_PIN 0
405 #define DIO2_TYPE GPIO_PUPD_NONE
406 
407 #define LED0_PORT GPIO_PORT_B // Red LED: PB2
408 #define LED0_PIN 2
409 #define LED0_MODE LED_ACTIVE_HIGH
410 #define LED1_PORT GPIO_PORT_A // Green LED: PA8
411 #define LED1_PIN 8
412 #define LED1_MODE LED_ACTIVE_HIGH
413 
414 #define OUTPUT_PINS {{NSS_PORT, NSS_PIN}, {RX_PORT, RX_PIN}, {TX_RFO_PORT, TX_RFO_PIN}, \
415  {TX_PA_PORT, TX_PA_PIN}, \
416  {LED0_PORT, LED0_PIN}, {LED1_PORT, LED1_PIN}, \
417  {TCXO_PORT, TCXO_PIN}}
418 #define INPUT_PINS {{DIO0_PORT, DIO0_PIN, DIO0_TYPE}, {DIO1_PORT, DIO1_PIN, DIO1_TYPE}, {DIO2_PORT, DIO2_PIN, DIO2_TYPE}}
419 
420 // SPI
421 #define SCK_PORT GPIO_PORT_B // SCK: PB3
422 #define SCK_PIN 3
423 #define MISO_PORT GPIO_PORT_A // MISO: PA6
424 #define MISO_PIN 6
425 #define MOSI_PORT GPIO_PORT_A // MOSI: PA7
426 #define MOSI_PIN 7
427 
428 #define GPIO_AF_SPI1 0x00
429 
430 // Console USART
431 #define CONSOLE_USART LPUART_PORT_1
432 
433 #define CONSOLE_USART_TX_PORT GPIO_PORT_A // PA2
434 #define CONSOLE_USART_TX_PIN 2
435 #define CONSOLE_USART_RX_PORT GPIO_PORT_A // PA3
436 #define CONSOLE_USART_RX_PIN 3
437 
438 #define CONSOLE_USART_AF 0x06
439 
440 #define LOWPOWER_PINS {{NSS_PORT, NSS_PIN}, {TX_RFO_PORT, TX_RFO_PIN}, {RX_PORT, RX_PIN}, \
441  {TX_PA_PORT, TX_PA_PIN}, {RST_PORT, RST_PIN}, \
442  {DIO0_PORT, DIO0_PIN}, {DIO1_PORT, DIO1_PIN}, {DIO2_PORT, DIO2_PIN}, \
443  {LED0_PORT, LED0_PIN}, {LED1_PORT, LED1_PIN}, \
444  {CONSOLE_USART_TX_PORT, CONSOLE_USART_TX_PIN}, {CONSOLE_USART_RX_PORT, CONSOLE_USART_RX_PIN}, \
445  {TCXO_PORT, TCXO_PIN}}
446 #else
447 
448 #error Missing board configuration !
449 
450 #endif
451 
452 
453 #endif /* _BOARDS_H_ */
GPIO driver.