Loading...
Searching...
No Matches
mrf24j40_registers.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Neo Nenaco <neo@nenaco.de>
3 * Copyright (C) 2017 Koen Zandberg <koen@bergzand.net>
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
21#ifndef MRF24J40_REGISTERS_H
22#define MRF24J40_REGISTERS_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
32#define MRF24J40_SHORT_ADDR_TRANS (0x00)
33#define MRF24J40_LONG_ADDR_TRANS (0x80)
34#define MRF24J40_ACCESS_READ (0x00)
35#define MRF24J40_ACCESS_WRITE (0x01)
36#define MRF24J40_ACCESS_WRITE_LNG (0x10)
37#define MRF24J40_ADDR_OFFSET (0x01)
44#define MRF24J40_TX_NORMAL_FIFO (0x000)
45#define MRF24J40_TX_BEACON_FIFO (0x080)
46#define MRF24J40_TX_GTS1_FIFO (0x100)
47#define MRF24J40_TX_GTS2_FIFO (0x180)
48#define MRF24J40_RX_FIFO (0x300)
55#define MRF24J40_REG_RXMCR (0x00)
56#define MRF24J40_REG_PANIDL (0x01)
57#define MRF24J40_REG_PANIDH (0x02)
58#define MRF24J40_REG_SADRL (0x03)
59#define MRF24J40_REG_SADRH (0x04)
60#define MRF24J40_REG_EADR0 (0x05)
61#define MRF24J40_REG_EADR1 (0x06)
62#define MRF24J40_REG_EADR2 (0x07)
63#define MRF24J40_REG_EADR3 (0x08)
64#define MRF24J40_REG_EADR4 (0x09)
65#define MRF24J40_REG_EADR5 (0x0A)
66#define MRF24J40_REG_EADR6 (0x0B)
67#define MRF24J40_REG_EADR7 (0x0C)
68#define MRF24J40_REG_RXFLUSH (0x0D)
69#define MRF24J40_REG_ORDER (0x10)
70#define MRF24J40_REG_TXMCR (0x11)
71#define MRF24J40_REG_ACKTMOUT (0x12)
72#define MRF24J40_REG_ESLOTG1 (0x13)
73#define MRF24J40_REG_SYMTICKL (0x14)
74#define MRF24J40_REG_SYMTICKH (0x15)
75#define MRF24J40_REG_PACON0 (0x16)
76#define MRF24J40_REG_PACON1 (0x17)
77#define MRF24J40_REG_PACON2 (0x18)
78#define MRF24J40_REG_TXBCON0 (0x1A)
79#define MRF24J40_REG_TXNCON (0x1B)
80#define MRF24J40_REG_TXG1CON (0x1C)
81#define MRF24J40_REG_TXG2CON (0x1D)
82#define MRF24J40_REG_ESLOTG23 (0x1E)
83#define MRF24J40_REG_ESLOTG45 (0x1F)
84#define MRF24J40_REG_ESLOTG67 (0x20)
85#define MRF24J40_REG_TXPEND (0x21)
86#define MRF24J40_REG_WAKECON (0x22)
87#define MRF24J40_REG_FRMOFFSET (0x23)
88#define MRF24J40_REG_TXSTAT (0x24)
89#define MRF24J40_REG_TXBCON1 (0x25)
90#define MRF24J40_REG_GATECLK (0x26)
91#define MRF24J40_REG_TXTIME (0x27)
92#define MRF24J40_REG_HSYMTMRL (0x28)
93#define MRF24J40_REG_HSYMTMRH (0x29)
94#define MRF24J40_REG_SOFTRST (0x2A)
95#define MRF24J40_REG_SECCON0 (0x2C)
96#define MRF24J40_REG_SECCON1 (0x2D)
97#define MRF24J40_REG_TXSTBL (0x2E)
98#define MRF24J40_REG_RXSR (0x30)
99#define MRF24J40_REG_INTSTAT (0x31)
100#define MRF24J40_REG_INTCON (0x32)
101#define MRF24J40_REG_GPIO (0x33)
102#define MRF24J40_REG_TRISGPIO (0x34)
103#define MRF24J40_REG_SLPACK (0x35)
104#define MRF24J40_REG_RFCTL (0x36)
105#define MRF24J40_REG_SECCR2 (0x37)
106#define MRF24J40_REG_BBREG0 (0x38)
107#define MRF24J40_REG_BBREG1 (0x39)
108#define MRF24J40_REG_BBREG2 (0x3A)
109#define MRF24J40_REG_BBREG3 (0x3B)
110#define MRF24J40_REG_BBREG4 (0x3C)
111#define MRF24J40_REG_BBREG6 (0x3E)
112#define MRF24J40_REG_CCAEDTH (0x3F)
119#define MRF24J40_REG_RFCON0 (0x200)
120#define MRF24J40_REG_RFCON1 (0x201)
121#define MRF24J40_REG_RFCON2 (0x202)
122#define MRF24J40_REG_RFCON3 (0x203)
123#define MRF24J40_REG_RFCON5 (0x205)
124#define MRF24J40_REG_RFCON6 (0x206)
125#define MRF24J40_REG_RFCON7 (0x207)
126#define MRF24J40_REG_RFCON8 (0x208)
127#define MRF24J40_REG_SLPCAL0 (0x209)
128#define MRF24J40_REG_SLPCAL1 (0x20A)
129#define MRF24J40_REG_SLPCAL2 (0x20B)
130#define MRF24J40_REG_RFSTATE (0x20F)
131#define MRF24J40_REG_RSSI (0x210)
132#define MRF24J40_REG_SLPCON0 (0x211)
133#define MRF24J40_REG_SLPCON1 (0x220)
134#define MRF24J40_REG_WAKETIMEL (0x222)
135#define MRF24J40_REG_WAKETIMEH (0x223)
136#define MRF24J40_REG_REMCNTL (0x224)
137#define MRF24J40_REG_REMCNTH (0x225)
138#define MRF24J40_REG_MAINCNT0 (0x226)
139#define MRF24J40_REG_MAINCNT1 (0x227)
140#define MRF24J40_REG_MAINCNT2 (0x228)
141#define MRF24J40_REG_MAINCNT3 (0x229)
142#define MRF24J40_REG_TESTMODE (0x22F)
143#define MRF24J40_REG_ASSOEADR0 (0x230)
144#define MRF24J40_REG_ASSOEADR1 (0x231)
145#define MRF24J40_REG_ASSOEADR2 (0x232)
146#define MRF24J40_REG_ASSOEADR3 (0x233)
147#define MRF24J40_REG_ASSOEADR4 (0x234)
148#define MRF24J40_REG_ASSOEADR5 (0x235)
149#define MRF24J40_REG_ASSOEADR6 (0x236)
150#define MRF24J40_REG_ASSOEADR7 (0x237)
151#define MRF24J40_REG_ASSOSADR0 (0x238)
152#define MRF24J40_REG_ASSOSADR1 (0x239)
153#define MRF24J40_REG_UPNONCE0 (0x240)
154#define MRF24J40_REG_UPNONCE1 (0x241)
155#define MRF24J40_REG_UPNONCE2 (0x242)
156#define MRF24J40_REG_UPNONCE3 (0x243)
157#define MRF24J40_REG_UPNONCE4 (0x244)
158#define MRF24J40_REG_UPNONCE5 (0x245)
159#define MRF24J40_REG_UPNONCE6 (0x246)
160#define MRF24J40_REG_UPNONCE7 (0x247)
161#define MRF24J40_REG_UPNONCE8 (0x248)
162#define MRF24J40_REG_UPNONCE9 (0x249)
163#define MRF24J40_REG_UPNONCE10 (0x24A)
164#define MRF24J40_REG_UPNONCE11 (0x24B)
165#define MRF24J40_REG_UPNONCE12 (0x24C)
172#define MRF24J40_RESET_DELAY (2000U) /* Datasheet MRF24J40 ~2ms */
173#define MRF24J40_RESET_PULSE_WIDTH (20000U) /* 20ms (estimated */
174
175#define MRF24J40_WAKEUP_DELAY (2000U)
177#define MRF24J40_DELAY_SLEEP_TOGGLE (50U)
178#define MRF24J40_STATE_RESET_DELAY (200U)
185#define MRF24J40_RXMCR_NOACKRSP (0x20)
186#define MRF24J40_RXMCR_PANCOORD (0x08)
187#define MRF24J40_RXMCR_COORD (0x04)
188#define MRF24J40_RXMCR_ERRPKT (0x02)
189#define MRF24J40_RXMCR_PROMI (0x01)
196#define MRF24J40_RXFLUSH_WAKEPOL (0x40)
197#define MRF24J40_RXFLUSH_WAKEPAD (0x20)
198#define MRF24J40_RXFLUSH_CMDONLY (0x08)
199#define MRF24J40_RXFLUSH_DATAONLY (0x04)
200#define MRF24J40_RXFLUSH_BCNONLY (0x02)
201#define MRF24J40_RXFLUSH_RXFLUSH (0x01)
208#define MRF24J40_TXMCR_CSMA_BACKOFF_MASK (0x07)
209
210#define MRF24J40_TXMCR_MACMINBE (0x18)
211#define MRF24J40_TXMCR_NOCSMA (0x80)
212#define MRF24J40_TXMCR_BATLIFEXT (0x40)
213#define MRF24J40_TXMCR_SLOTTED (0x20)
214#define MRF24J40_TXMCR_MACMINBE1 (0x10)
215#define MRF24J40_TXMCR_MACMINBE0 (0x08)
216#define MRF24J40_TXMCR_CSMABF2 (0x04)
217#define MRF24J40_TXMCR_CSMABF1 (0x02)
218#define MRF24J40_TXMCR_CSMABF0 (0x01)
219
226#define MRF24J40_TXMCR_MACMINBE_SHIFT (3U)
233#define MRF24J40_ACKTMOUT_DRPACK (0x80)
234#define MRF24J40_ACKTMOUT_MAWD6 (0x40)
235#define MRF24J40_ACKTMOUT_MAWD5 (0x20)
236#define MRF24J40_ACKTMOUT_MAWD4 (0x10)
237#define MRF24J40_ACKTMOUT_MAWD3 (0x08)
238#define MRF24J40_ACKTMOUT_MAWD2 (0x04)
239#define MRF24J40_ACKTMOUT_MAWD1 (0x02)
240#define MRF24J40_ACKTMOUT_MAWD0 (0x01)
241
248#define MRF24J40_PACON2_FIFOEN (0x80)
249#define MRF24J40_PACON2_TXONTS3 (0x20)
250#define MRF24J40_PACON2_TXONTS2 (0x10)
251#define MRF24J40_PACON2_TXONTS1 (0x08)
252#define MRF24J40_PACON2_TXONTS0 (0x04)
253#define MRF24J40_PACON2_TXONT8 (0x02)
254#define MRF24J40_PACON2_TXONT7 (0x01)
261#define MRF24J40_TXNCON_FPSTAT (0x10)
262#define MRF24J40_TXNCON_INDIRECT (0x08)
263#define MRF24J40_TXNCON_TXNACKREQ (0x04)
264#define MRF24J40_TXNCON_TXNSECEN (0x02)
265#define MRF24J40_TXNCON_TXNTRIG (0x01)
272#define MRF24J40_WAKECON_IMMWAKE (0x80)
273#define MRF24J40_WAKECON_REGWAKE (0x40)
280#define MRF24J40_TXSTAT_MAX_FRAME_RETRIES (0xC0)
281#define MRF24J40_TXSTAT_TXNRETRY1 (0x80)
282#define MRF24J40_TXSTAT_TXNRETRY0 (0x40)
283#define MRF24J40_TXSTAT_CCAFAIL (0x20)
284#define MRF24J40_TXSTAT_TXG2FNT (0x10)
285#define MRF24J40_TXSTAT_TXG1FNT (0x08)
286#define MRF24J40_TXSTAT_TXG2STAT (0x04)
287#define MRF24J40_TXSTAT_TXG1STAT (0x02)
288#define MRF24J40_TXSTAT_TXNSTAT (0x01)
295#define MRF24J40_TXSTAT_MAX_FRAME_RETRIES_SHIFT (6U)
296#define MRF24J40_TXSTAT_CCAFAIL_SHIFT (5U)
303#define MRF24J40_SOFTRST_RSTPWR (0x04)
304#define MRF24J40_SOFTRST_RSTBB (0x02)
305#define MRF24J40_SOFTRST_RSTMAC (0x01)
312#define MRF24J40_TXSTBL_RFSTBL3 (0x80)
313#define MRF24J40_TXSTBL_RFSTBL2 (0x40)
314#define MRF24J40_TXSTBL_RFSTBL1 (0x20)
315#define MRF24J40_TXSTBL_RFSTBL0 (0x10)
316#define MRF24J40_TXSTBL_MSIFS3 (0x08)
317#define MRF24J40_TXSTBL_MSIFS2 (0x04)
318#define MRF24J40_TXSTBL_MSIFS1 (0x02)
319#define MRF24J40_TXSTBL_MSIFS0 (0x01)
326#define MRF24J40_INTSTAT_SLPIF (0x80)
327#define MRF24J40_INTSTAT_WAKEIF (0x40)
328#define MRF24J40_INTSTAT_HSYMTMRIF (0x20)
329#define MRF24J40_INTSTAT_SECIF (0x10)
330#define MRF24J40_INTSTAT_RXIF (0x08)
331#define MRF24J40_INTSTAT_TXG2IF (0x04)
332#define MRF24J40_INTSTAT_TXG1IF (0x02)
333#define MRF24J40_INTSTAT_TXNIF (0x01)
340#define MRF24J40_INTCON_SLPIE (0x80)
341#define MRF24J40_INTCON_WAKEIE (0x40)
342#define MRF24J40_INTCON_HSYMTMRIE (0x20)
343#define MRF24J40_INTCON_SECIE (0x10)
344#define MRF24J40_INTCON_RXIE (0x08)
345#define MRF24J40_INTCON_TXG2IE (0x04)
346#define MRF24J40_INTCON_TXG1IE (0x02)
347#define MRF24J40_INTCON_TXNIE (0x01)
354#define MRF24J40_GPIO_0 (0x01)
355#define MRF24J40_GPIO_1 (0x02)
356#define MRF24J40_GPIO_2 (0x04)
357#define MRF24J40_GPIO_3 (0x08)
358#define MRF24J40_GPIO_4 (0x10)
359#define MRF24J40_GPIO_5 (0x20)
366#define MRF24J40_TRISGPIO_TRISGP5 (0x20)
367#define MRF24J40_TRISGPIO_TRISGP4 (0x10)
368#define MRF24J40_TRISGPIO_TRISGP3 (0x08)
369#define MRF24J40_TRISGPIO_TRISGP2 (0x04)
370#define MRF24J40_TRISGPIO_TRISGP1 (0x02)
371#define MRF24J40_TRISGPIO_TRISGP0 (0x01)
378#define MRF24J40_SLPACK_SLPACK (0x80)
385#define MRF24J40_RFCTL_WAKECNT8 (0x10)
386#define MRF24J40_RFCTL_WAKECNT7 (0x08)
387#define MRF24J40_RFCTL_RFRST (0x04)
388#define MRF24J40_RFCTL_RFTXMODE (0x02)
389#define MRF24J40_RFCTL_RFRXMODE (0x01)
396#define MRF24J40_BBREG1_RXDECINV (0x04)
403#define MRF24J40_BBREG2_CCAMODE3 (0xC0)
404#define MRF25J40_BBREG2_CCAMODE1 (0x80)
405#define MRF24J40_BBREG2_CCAMODE2 (0x40)
406
407#define MRF24J40_BBREG2_CCACSTH (0x3C)
414#define MRF24J40_BBREG6_RSSIMODE1 (0x80)
415#define MRF24J40_BBREG6_RSSIMODE2 (0x40)
416#define MRF24J40_BBREG2_RSSIRDY (0x01)
417
418#define MRF24J40_BBREG2_CCACSTH (0x3C)
425#define MRF24J40_RFCON1_VCOOPT7 (0x80)
426#define MRF24J40_RFCON1_VCOOPT6 (0x40)
427#define MRF24J40_RFCON1_VCOOPT5 (0x20)
428#define MRF24J40_RFCON1_VCOOPT4 (0x10)
429#define MRF24J40_RFCON1_VCOOPT3 (0x08)
430#define MRF24J40_RFCON1_VCOOPT2 (0x04)
431#define MRF24J40_RFCON1_VCOOPT1 (0x02)
432#define MRF24J40_RFCON1_VCOOPT0 (0x01)
439#define MRF24J40_RFCON2_PLLEN (0x80)
446#define MRF24J40_RFCON6_TXFIL (0x80)
447#define MRF24J40_RFCON6_20MRECVR (0x10)
448#define MRF24J40_RFCON6_BATEN (0x08)
455#define MRF24J40_RFCON7_SLPCLKSEL1 (0x80)
456#define MRF24J40_RFCON7_SLPCLKSEL2 (0x40)
463#define MRF24J40_RFCON8_RFVCO (0x10)
470#define MRF24J40_RFSTATE_MASK (0xA0)
471#define MRF24J40_RFSTATE_RTSEL2 (0xE0)
472#define MRF24J40_RFSTATE_RTSEL1 (0xC0)
473#define MRF24J40_RFSTATE_RX (0xA0)
474#define MRF24J40_RFSTATE_TX (0x80)
475#define MRF24J40_RFSTATE_CALVCO (0x60)
476#define MRF24J40_RFSTATE_SLEEP (0x40)
477#define MRF24J40_RFSTATE_CALFIL (0x20)
478#define MRF24J40_RFSTATE_RESET (0x00)
485#define MRF24J40_SLPCON0_INTEDGE (0x02)
486#define MRF24J40_SLPCON0_SLPCLKEN (0x01)
493#define MRF24J40_SLPCON1_CLKOUTEN (0x20)
494#define MRF24J40_SLPCON1_SLPCLKDIV4 (0x10)
495#define MRF24J40_SLPCON1_SLPCLKDIV3 (0x08)
496#define MRF24J40_SLPCON1_SLPCLKDIV2 (0x04)
497#define MRF24J40_SLPCON1_SLPCLKDIV1 (0x02)
498#define MRF24J40_SLPCON1_SLPCLKDIV0 (0x01)
505#define MRF24J40_TESTMODE_RSSIWAIT1 (0x10)
506#define MRF24J40_TESTMODE_RSSIWAIT0 (0x08)
507#define MRF24J40_TESTMODE_TESTMODE2 (0x04)
508#define MRF24J40_TESTMODE_TESTMODE1 (0x02)
509#define MRF24J40_TESTMODE_TESTMODE0 (0x01)
512#ifdef __cplusplus
513}
514#endif
515
516#endif /* MRF24J40_REGISTERS_H */