all | frequencies |
|
|
|
|
|
exhibits | applications |
---|---|---|---|---|---|---|---|---|
manuals | photos | label |
app s | submitted / available | |||||||
---|---|---|---|---|---|---|---|---|
1 |
|
User Manual Part 2 | Users Manual | 4.21 MiB | January 09 2023 / July 06 2023 | delayed release | ||
1 |
|
User Manual part 1 | Users Manual | 5.00 MiB | January 09 2023 / July 06 2023 | delayed release | ||
1 |
|
Internal Photos | Internal Photos | 1.40 MiB | January 09 2023 / July 06 2023 | delayed release | ||
1 |
|
External Photos | External Photos | 1.41 MiB | January 09 2023 / July 06 2023 | delayed release | ||
1 |
|
ID Label and Location | ID Label/Location Info | 267.47 KiB | January 09 2023 / February 05 2023 | |||
1 |
|
Agency Letter | Cover Letter(s) | 209.56 KiB | January 09 2023 / February 05 2023 | |||
1 |
|
Antenna Gain Info | Cover Letter(s) | 3.56 MiB | January 09 2023 / February 05 2023 | |||
1 | Block Diagram | Block Diagram | January 09 2023 | confidential | ||||
1 |
|
Confidentiality Letter | Cover Letter(s) | 196.96 KiB | January 09 2023 / February 05 2023 | |||
1 |
|
Model Approval Letter | Cover Letter(s) | 191.50 KiB | January 09 2023 / February 05 2023 | |||
1 |
|
Model Declaration Letter | Cover Letter(s) | 190.58 KiB | January 09 2023 / February 05 2023 | |||
1 | Operational Description | Operational Description | January 09 2023 | confidential | ||||
1 |
|
RF Exposure Infp | RF Exposure Info | 1.21 MiB | January 09 2023 / February 05 2023 | |||
1 | Schematics | Schematics | January 09 2023 | confidential | ||||
1 |
|
Test Report BLE | Test Report | 2.22 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report BLE Appendix A | Test Report | 3.38 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report BLE Appendix B | Test Report | 3.39 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report BLE Appendix C | Test Report | 3.64 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report BLE Appendix D Part 1 of 2 | Test Report | 4.85 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report BLE Appendix D Part 2 of 2 | Test Report | 5.63 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report Zigbee | Test Report | 2.24 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report Zigbee Appendix A | Test Report | 3.42 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report Zigbee Appendix B | Test Report | 3.42 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report Zigbee Appendix C | Test Report | 3.44 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report Zigbee Appendix D Part 1 of 2 | Test Report | 4.09 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Report Zigbee Appendix D Part 2 of 2 | Test Report | 3.59 MiB | January 09 2023 / February 05 2023 | |||
1 |
|
Test Setup Photos | Test Setup Photos | 1.69 MiB | January 09 2023 / July 06 2023 | delayed release | ||
1 | User Manual Part 2 | Test Setup Photos | January 09 2023 / July 06 2023 | delayed release |
1 | User Manual Part 2 | Users Manual | 4.21 MiB | January 09 2023 / July 06 2023 | delayed release |
PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.6.4 Synchronization Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 757 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.7 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CTRLA 0x04 0x05 0x06 0x07 0x08 0x09 0x0A
... 0x0B CTRLB INTENCLR INTENSET INTFLAG DATABUFPTR DBGCTRL Reserved 0C KEYWORD0 10 KEYWORD1 14 KEYWORD2 18 KEYWORD3 1C KEYWORD4 20 KEYWORD5 24 KEYWORD6 28 KEYWORD7 0x2C
... 0x37 Reserved 0x38 INDATA 3C INTVECTV0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 CFBS[2:0]
AESMODE[2:0]
ENABLE SWRST XORKEY KEYGEN LOD STARTMODE CIPHER KEYSIZE[1:0]
CTYPE[3:0]
GFMUL EOM NEWMSG START GFMCMP GFMCMP GFMCMP ENCCMP ENCCMP ENCCMP INDATAPTR[1:0]
DBGRUN KEYWORD[7:0]
KEYWORD[15:8]
KEYWORD[23:16]
KEYWORD[31:24]
KEYWORD[7:0]
KEYWORD[15:8]
KEYWORD[23:16]
KEYWORD[31:24]
KEYWORD[7:0]
KEYWORD[15:8]
KEYWORD[23:16]
KEYWORD[31:24]
KEYWORD[7:0]
KEYWORD[15:8]
KEYWORD[23:16]
KEYWORD[31:24]
KEYWORD[7:0]
KEYWORD[15:8]
KEYWORD[23:16]
KEYWORD[31:24]
KEYWORD[7:0]
KEYWORD[15:8]
KEYWORD[23:16]
KEYWORD[31:24]
KEYWORD[7:0]
KEYWORD[15:8]
KEYWORD[23:16]
KEYWORD[31:24]
KEYWORD[7:0]
KEYWORD[15:8]
KEYWORD[23:16]
KEYWORD[31:24]
INDATA[7:0]
INDATA[15:8]
INDATA[23:16]
INDATA[31:24]
INTVECTV[7:0]
INTVECTV[15:8]
INTVECTV[23:16]
INTVECTV[31:24]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 758 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 40 INTVECTV1 44 INTVECTV2 48 INTVECTV3 0x4C
... 0x5B Reserved 0x5C HASHKEY0 0x60 HASHKEY1 0x64 HASHKEY2 0x68 HASHKEY3 0x6C GHASH0 0x70 GHASH1 0x74 GHASH2 0x78 GHASH3 0x7C
... 0x7F Reserved 0x80 CIPLEN 0x84 RANDSEED 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 INTVECTV[7:0]
INTVECTV[15:8]
INTVECTV[23:16]
INTVECTV[31:24]
INTVECTV[7:0]
INTVECTV[15:8]
INTVECTV[23:16]
INTVECTV[31:24]
INTVECTV[7:0]
INTVECTV[15:8]
INTVECTV[23:16]
INTVECTV[31:24]
HASHKEY[7:0]
HASHKEY[15:8]
HASHKEY[23:16]
HASHKEY[31:24]
HASHKEY[7:0]
HASHKEY[15:8]
HASHKEY[23:16]
HASHKEY[31:24]
HASHKEY[7:0]
HASHKEY[15:8]
HASHKEY[23:16]
HASHKEY[31:24]
HASHKEY[7:0]
HASHKEY[15:8]
HASHKEY[23:16]
HASHKEY[31:24]
GHASH[7:0]
GHASH[15:8]
GHASH[23:16]
GHASH[31:24]
GHASH[7:0]
GHASH[15:8]
GHASH[23:16]
GHASH[31:24]
GHASH[7:0]
GHASH[15:8]
GHASH[23:16]
GHASH[31:24]
GHASH[7:0]
GHASH[15:8]
GHASH[23:16]
GHASH[31:24]
CIPLEN[7:0]
CIPLEN[15:8]
CIPLEN[23:16]
CIPLEN[31:24]
RANDSEED[7:0]
RANDSEED[15:8]
RANDSEED[23:16]
RANDSEED[31:24]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 759 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8 Register Description Registers can be 8, 16, or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description. See Register Access Protection from Related Links. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable-
protection is denoted by the "Enable-Protected" property in each individual register description. Related Links 36.5.8. Register Access Protection 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 760 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-protected CTRLA 0x00 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 Access Reset Bit 15 Access Reset Bit 7 Access Reset R/W 0 14 XORKEY R/W 0 6 CFBS[2:0]
R/W 0 13 KEYGEN R/W 0 5 R/W 0 12 LOD R/W 0 4 R/W 0 11 STARTMODE R/W 0 10 CIPHER R/W 0 3 AESMODE[2:0]
R/W 0 2 R/W 0 19 R/W 0 CTYPE[3:0]
18 R/W 0 17 R/W 0 9 16 R/W 0 8 KEYSIZE[1:0]
R/W 0 1 ENABLE R/W 0 R/W 0 0 SWRST R/W 0 Bits 19:16 CTYPE[3:0]Counter Measure Type Value XXX0 XXX1 XX0X XX1X X0XX X1XX 0XXX 1XXX Name CTYPE1 disabled CTYPE1 enabled CTYPE2 disabled CTYPE2 enabled CTYPE3 disabled CTYPE3 enabled CTYPE4 disabled CTYPE4 enabled Description Countermeasure1 disabled Countermeasure1 enabled Countermeasure2 disabled Countermeasure2 enabled Countermeasure3 disabled Countermeasure3 enabled Countermeasure4 disabled Countermeasure4 enabled Bit 14 XORKEYXOR Key Operation Value 0 1 Description No effect The user keyword gets XORed with the previous keyword register content. Bit 13 KEYGENLast Key Generation Value 0 1 Description No effect Start Computation of the last NK words of the expanded key Bit 12 LODLast Output Data Mode Value 0 1 Description No effect Start encryption in Last Output Data mode Bit 11 STARTMODEStart Mode Select 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 761 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) Value 0 1 Name Manual Mode Auto Mode Description Start Encryption / Decryption in Manual mode Start Encryption / Decryption in Auto mode Bit 10 CIPHERCipher Mode Select Value 0 1 Description Decryption Encryption Bits 9:8 KEYSIZE[1:0]Encryption Key Size Value 0 1 2 3 Name 128-bit Key 192-bit Key 256-bit Key Reserved Description 128-bit Key for Encryption / Decryption 192-bit Key for Encryption / Decryption 256-bit Key for Encryption / Decryption Reserved Bits 7:5 CFBS[2:0]Cipher Feedback Block Size Value 0 1 2 3 4 5-7 Name 128-bit data block 64-bit data block 32-bit data block 16-bit data block 8-bit data block Reserved Description 128-bit Input data block for Encryption/Decryption in Cipher Feedback mode 64-bit Input data block for Encryption/Decryption in Cipher Feedback mode 32-bit Input data block for Encryption/Decryption in Cipher Feedback mode 16-bit Input data block for Encryption/Decryption in Cipher Feedback mode 8-bit Input data block for Encryption/Decryption in Cipher Feedback mode Reserved Bits 4:2 AESMODE[2:0]AES Modes of Operation Name ECB CBC OFB CFB Counter CCM GCM Reserved Value 0 1 2 3 4 5 6 7 Description Electronic code book mode Cipher block chaining mode Output feedback mode Cipher feedback mode Counter mode CCM mode Galois counter mode Reserved Bit 1 ENABLEEnable Value 0 1 Description The peripheral is disabled The peripheral is enabled Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets all registers in the AES module to their initial state, and the module will be disabled. Writing a '1' to SWRST will always take precedence, meaning that all other writes in the same write operation will be discarded. Value 0 1 Description There is no reset operation ongoing The reset operation is ongoing 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 762 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.2 Control B Name:
Offset:
Reset:
Property: PAC Write-Protection CTRLB 0x04 0x00 Bit 7 6 5 4 Access Reset Bit 3 GFMULGF Multiplication 3 GFMUL R/W 0 2 EOM R/W 0 1 NEWMSG R/W 0 0 START R/W 0 This bit is applicable only to GCM mode. Description Value No action 0 Setting this bit calculates GF multiplication with data buffer content and hashkey register content. 1 Bit 2 EOMEnd of Message This bit is applicable only to GCM mode. Description Value No action 0 Setting this bit generates final GHASH value for the message. 1 Bit 1 NEWMSGNew Message This bit is used in cipher block chaining (CBC), cipher feedback (CFB) and output feedback (OFB), counter (CTR) modes to indicate the hardware to use Initialization vector for encrypting the first block of message. Value 0 1 Description No action Setting this bit indicates start of new message to the module. Bit 0 STARTStart Encryption/Decryption Value 0 1 Description No action Start encryption / decryption in manual mode. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 763 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.3 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x05 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set (INTENSET) register. Bit 7 6 5 4 3 2 Access Reset 1 GFMCMP R/W 0 0 ENCCMP R/W 0 Bit 1 GFMCMPGF Multiplication Complete Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the GF Multiplication Complete Interrupt Enable bit, which disables the GF Multiplication Complete interrupt. Value 0 1 Description The GF Multiplication Complete interrupt is disabled. The GF Multiplication Complete interrupt is enabled. Bit 0 ENCCMPEncryption Complete Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Encryption Complete Interrupt Enable bit, which disables the Encryption Complete interrupt. Value 0 1 Description The Encryption Complete interrupt is disabled. The Encryption Complete interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 764 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.4 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x06 0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear (INTENCLR) register. Bit 7 6 5 4 3 2 Access Reset 1 GFMCMP R/W 0 0 ENCCMP R/W 0 Bit 1 GFMCMPGF Multiplication Complete Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the GF Multiplication Complete Interrupt Enable bit, which enables the GF Multiplication Complete interrupt. Value 0 1 Description The GF Multiplication Complete interrupt is disabled. The GF Multiplication Complete interrupt is enabled. Bit 0 ENCCMPEncryption Complete Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Encryption Complete Interrupt Enable bit, which enables the Encryption Complete interrupt. Value 0 1 Description The Encryption Complete interrupt is disabled. The Encryption Complete interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 765 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.5 Interrupt Flag Status and Clear Name:
Offset:
Reset:
INTFLAG 0x07 0x00 Bit 7 6 5 4 3 2 Access Reset Bit 1 GFMCMPGF Multiplication Complete 1 GFMCMP R/W 0 0 ENCCMP R/W 0 This flag is cleared by writing a '1' to it. This flag is set when GHASH value is available on the Galois Hash Registers (GHASHx) in GCM mode. Writing a '0' to this bit has no effect. This flag is also automatically cleared in the following cases. 1. Manual encryption/decryption occurs (START in CTRLB register). 2. Reading from the GHASHx register. Bit 0 ENCCMPEncryption Complete This flag is cleared by writing a '1' to it. This flag is set when encryption/decryption is complete and valid data is available on the Data Register. Writing a '0' to this bit has no effect. This flag is also automatically cleared in the following cases:
1. Manual encryption/decryption occurs (START in CTRLA register). (This feature is needed only if we do not support double buffering of INDATA registers). 2. Reading from the data register (INDATAx) when LOD = 0. 3. Writing into the data register (INDATAx) when LOD = 1. 4. Reading from the Hash Key register (HASHKEYx). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 766 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.6 Data Buffer Pointer Name:
Offset:
Reset:
Property: PAC Write-Protection DATABUFPTR 0x08 0x00 Bit 7 6 5 4 3 2 Access Reset 1 0 INDATAPTR[1:0]
R/W 0 R/W 0 Bits 1:0 INDATAPTR[1:0]Input Data Pointer Writing to this field changes the value of the input data pointer, which determines which of the four data registers is written to/read from when the next write/read to the INDATA register address is performed. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 767 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.7 Debug Name:
Offset:
Reset:
Property: PAC Write-Protection DBGCTRL 0x09 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGRUNDebug Run DBGRUN W 0 Writing a '0' to this bit causes the AES to halt during debug mode. Writing a '1' to this bit allows the AES to continue normal operation during debug mode. This bit can only be changed while the AES is disabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 768 36.8.8 Keyword Name:
Offset:
Reset:
Property: PAC Write-Protection KEYWORD 0x0C + n*0x04 [n=0..7]
0x00000000 Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 W 0 23 W 0 15 W 0 7 W 0 30 W 0 22 W 0 14 W 0 6 W 0 29 W 0 21 W 0 13 W 0 5 W 0 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 28 27 KEYWORD[31:24]
W W 0 0 20 19 KEYWORD[23:16]
W W 0 0 11 12 KEYWORD[15:8]
W W 0 0 4 3 KEYWORD[7:0]
W 0 W 0 26 W 0 18 W 0 10 W 0 2 W 0 25 W 0 17 W 0 9 W 0 1 W 0 24 W 0 16 W 0 8 W 0 0 W 0 Bits 31:0 KEYWORD[31:0]Key Word Value The four/six/eight 32-bit Key Word registers set the 128-bit/192-bit/256-bit cryptographic key used for encryption/decryption. KEYWORD0.KEYWORD corresponds to the first word of the key and KEYWORD3/KEYWORD5/
KEYWORD7.KEYWORD to the last one. Note:By setting the XORKEY bit of CTRLA register, keyword will update with the resulting XOR value of user keyword and previous keyword content. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 769 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.9 Data Name:
Offset:
Reset:
INDATA 0x38 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 INDATA[31:24]
R/W 0 20 R/W 0 19 INDATA[23:16]
R/W 0 12 R/W 0 11 INDATA[15:8]
R/W 0 4 R/W 0 3 INDATA[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 INDATA[31:0]Data Value A write to or read from this register corresponds to a write to or read from one of the four data registers. The four 32-bit Data registers set the 128-bit data block used for encryption/decryption. The data register that is written to or read from is given by the DATABUFPTR.INDATPTR field. Note:Both input and output shares the same data buffer. Reading INDATA register will return 0s when AES is performing encryption or decryption operation. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 770 36.8.10 Initialization Vector Register Name:
Offset:
Reset:
Property: PAC Write-Protection INTVECTV 0x3C + n*0x04 [n=0..3]
0x00000000 Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 W 0 23 W 0 15 W 0 7 W 0 30 W 0 22 W 0 14 W 0 6 W 0 29 W 0 21 W 0 13 W 0 5 W 0 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 28 27 INTVECTV[31:24]
W W 0 0 20 19 INTVECTV[23:16]
W W 0 0 11 12 INTVECTV[15:8]
W W 0 0 4 3 INTVECTV[7:0]
W 0 W 0 26 W 0 18 W 0 10 W 0 2 W 0 25 W 0 17 W 0 9 W 0 1 W 0 24 W 0 16 W 0 8 W 0 0 W 0 Bits 31:0 INTVECTV[31:0]Initialization Vector Value The four 32-bit Initialization Vector registers INTVECTVn set the 128-bit Initialization Vector data block that is used by some modes of operation as an additional initial input. INTVECTV0.INTVECTV corresponds to the first word of the Initialization Vector, INTVECTV3.INTVECTV to the last one. These registers are write-only to prevent the Initialization Vector from being read by another application. For CBC, OFB, and CFB modes, the Initialization Vector corresponds to the initialization vector. For CTR mode, it corresponds to the counter value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 771 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.11 Hash Key (GCM mode only) Name:
Offset:
Reset:
Property: PAC Write-protection HASHKEY 0x5C + n*0x04 [n=0..3]
0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 HASHKEY[31:24]
R/W 0 R/W 0 20 19 HASHKEY[23:16]
R/W 0 12 R/W 0 11 HASHKEY[15:8]
R/W 0 4 R/W 0 3 HASHKEY[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 HASHKEY[31:0]Hash Key Value The four 32-bit HASHKEY registers contain the 128-bit Hash Key value computed from the AES KEY. The Hash Key value can also be programmed offering single GF128 multiplication possibilities. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 772 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.12 Galois Hash (GCM mode only) Name:
Offset:
Reset:
Property: PAC Write-Protection GHASH 0x6C + n*0x04 [n=0..3]
0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 GHASH[31:24]
R/W 0 20 R/W 0 19 GHASH[23:16]
R/W 0 12 R/W 0 11 GHASH[15:8]
R/W 0 4 R/W 0 3 GHASH[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 GHASH[31:0]Galois Hash Value The four 32-bit Hash Word registers GHASHcontain the GHASH value after GF128 multiplication in GCM mode. Writing a new key to KEYWORD registers causes GHASH to be initialized with zeroes. These registers can also be programmed. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 773 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.13 Galois Hash x (GCM mode only) Name:
Offset:
Reset:
Property: PAC Write-Protection CIPLEN 0x80 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 CIPLEN[31:24]
R/W 0 20 R/W 0 19 CIPLEN[23:16]
R/W 0 12 R/W 0 11 CIPLEN[15:8]
R/W 0 4 R/W 0 3 CIPLEN[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 CIPLEN[31:0]Cipher Length This register contains the length in bytes of the Cipher text that is to be processed. This is programmed by the user in GCM mode for Tag generation. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 774 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.8.14 Random Seed Name:
Offset:
Reset:
Property: PAC Write-Protection RANDSEED 0x84 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 RANDSEED[31:24]
R/W R/W 0 0 20 19 RANDSEED[23:16]
R/W R/W 0 0 11 12 RANDSEED[15:8]
R/W 0 R/W 0 4 3 RANDSEED[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 RANDSEED[31:0]Random Seed A write to this register corresponds to loading a new seed into the Random number generator. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 775 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37. Public Key Cryptography Controller (PUKCC) 37.1 Overview The Public Key Cryptography Controller (PUKCC) processes public key cryptography algorithm calculus in both GF(p) and GF(2n) fields. The Public Key Cryptography Library (PUKCL) is stored in ROM inside the device. The library can be used in applications to access features of PUKCC, and includes the complete implementation of the following public key cryptography algorithms:
RSA (Rivest-Shamir-Adleman public key cryptosystem), DSA (Digital Signature Algorithm):
Modular Exponentiation with CRT up to 7168 bits Modular Exponentiation without CRT up to 5376 bits Prime generation Utilities: GCD/modular Inverse, Divide, Modular reduction, Multiply, ... Elliptic Curves:
ECDSA GF(p) up to 521 bits for common curves (up to 1120 bits for future use) ECDSA GF(2n) up to 571 bits for common curves (up to 1440 bits for future use) Choice of the curve parameters for compatibility with NIST Curves or other curves in Weierstrass equation Point Multiply Point Add/Doubling Other high level elliptic curve algorithms (ECDH, ...) can be implemented by user using library functions Deterministic Random Number Generation (DRNG ANSI X9.31) for DSA 37.2 Product Dependencies 37.2.1 I/O Lines Not applicable. 37.2.2 Power Management The PUKCC will continue to operate in any sleep mode, as long as its source clock is running. 37.2.3 Clocks The bus clock (PB2_CLK) can be enabled and disabled by the CRU. 37.2.4 DMA Not applicable. 37.2.5 Interrupts Not applicable. 37.2.6 Events Not applicable. 37.3 Functional Description 37.3.1 Public Key Cryptography Library (PUKCL) Application Programming Interface (API) The Public Key Cryptography Controller (PUKCC) is a peripheral that can be used to accelerate public key cryptography, and processes public key cryptography algorithm calculus in both Prime field (GF(p)) and Binary field 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 776 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
(GF(2n)). Different functionalities of the PUKCC are accessed with the help of the Public Key Cryptography Library
(PUKCL), which is embedded into a dedicated ROM inside the microcontroller. The PUKCL provides access to many algorithms and functions. The features provided, start from basic addition or comparison, up to the RSA or ECDSA complete computation. The library can be utilized by including the PUKCL Driver in the application and passing parameters through a common Application Programming Interface (API). The PUKCC Driver is available in Harmony 3. This library can be used in conjunction with a SSL software stack to improve performance and helps to reduce the RAM usage and time taken to perform different cryptographic functions. 37.3.2 PUKCL Features PUKCL features include:
37.3.4. Basic Arithmetic and Cryptographic Services - PUKCL self-test, GCD, integral division, etc. 37.3.5. Modular Arithmetic Services - Modular reduction, modular exponentiation, probable prime generation and modular exponentiation 37.3.6. Elliptic Curves Over GF(p) Services - Point addition and doubling on an elliptic curve in a prime field, ECDSA signature generation and verification on an elliptic curve over GF(p) 37.3.7. Elliptic Curves Over GF(2n) Services - Point addition and doubling on an elliptic curve in a prime field, ECDSA signature generation and verification on an elliptic curve over GF(2n) 37.3.3 PUKCL Usage The following sections provide details on accessing the PUKCL and its features. 37.3.3.1 Initializing the PUKCC and PUKCL For a project created with Harmony 3, the clock initialization is handled by the initialization function CLK_Initialize(). After a power-on reset, and when the PUKCC Clock is enabled, a Crypto RAM clear process is launched. It is mandatory to wait until the end of this process before using the Crypto Library. The following code shows how to wait for the Crypto RAM clear process. while ((PUKCCSR & BIT_PUKCCSR_CLRRAM_BUSY) != 0);
The next task to be done is self-test. From the generated project in Harmony 3, copy the example for the PUKCC Driver SelfTest and add it to the main source file. This is a mandatory step before using the library. The return values from the SelfTest service must be compared against known values mentioned in the service description (see the Description section in 37.3.4.1. SelfTest). Example 37-1.PUKCC Initialization void PUKCC_self_test(void)
// Clear contents of PUKCLParam memset(&PUKCLParam, 0, sizeof(PUKCL_PARAM));
pvPUKCLParam = &PUKCLParam;
vPUKCL_Process(SelfTest, pvPUKCLParam);
// In case of error, loop here while (PUKCL(u2Status) != PUKCL_OK) {
while (pvPUKCLParam->P.PUKCL_SelfTest.u4Version != PUKCL_VERSION) {
while (pvPUKCLParam->P.PUKCL_SelfTest.u4CheckNum1 != 0x6E70DDD2) {
while (pvPUKCLParam->P.PUKCL_SelfTest.u4CheckNum2 != 0x25C8D64F) {
int main(void)
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 777 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
/* Initializes MCU, drivers and middleware */
SYS_Initialize();
// Wait for Crypto RAM clear process while ((PUKCCSR & BIT_PUKCCSR_CLRRAM_BUSY) != 0);
// Initialize PUKCC and perform self test PUKCC_self_test();
while(1)
Note:It may also be necessary to initialize the Random Number Generator (RNG) on the microcontroller, as some services in the library use the peripheral. Before calling such services, be sure to follow the directives given for random number generation on the selected microcontroller (particularly initialization and seeding) and compulsorily start the RNG. For details refer to each service. 37.3.3.2 Accessing Different Library Services All cryptographic services in the library are accessed by the macro vPUKCL_Process. All of these services use the same process for receiving and returning parameters. PUKCL receives two arguments: the requested service and a pointer to a structure called the parameter block. The parameter block contains two structures, a common parameter structure for all commands and specific parameter structure for each service. A specific service is accessed with vPUKCL_Process by passing the service name as the first argument. For example, to perform SelfTest, use vPUKCL_Process(SelfTest, pvPUKCLParam). Example 37-2.PUKCL Parameter Block typedef struct _PUKCL_param {
PUKCL_HEADER PUKCL_Header;
union {
_PUKCL_CLEARFLAGS PUKCL_ClearFlags;
_PUKCL_COMP PUKCL_Comp;
_PUKCL_CONDCOPY PUKCL_CondCopy;
_PUKCL_CRT PUKCL_CRT;
_PUKCL_DIV PUKCL_Div;
_PUKCL_EXPMOD PUKCL_ExpMod;
_PUKCL_FASTCOPY PUKCL_FastCopy;
_PUKCL_FILL PUKCL_Fill;
_PUKCL_FMULT PUKCL_Fmult;
_PUKCL_GCD PUKCL_GCD;
_PUKCL_PRIMEGEN PUKCL_PrimeGen;
_PUKCL_REDMOD PUKCL_RedMod;
_PUKCL_RNG PUKCL_Rng;
_PUKCL_SELFTEST PUKCL_SelfTest;
_PUKCL_SMULT PUKCL_Smult;
_PUKCL_SQUARE PUKCL_Square;
_PUKCL_SWAP PUKCL_Swap;
// ECC _PUKCL_ZPECCADD PUKCL_ZpEccAdd;
_PUKCL_ZPECCDBL PUKCL_ZpEccDbl;
_PUKCL_ZPECCADDSUB PUKCL_ZpEccAddSub;
_PUKCL_ZPECCMUL PUKCL_ZpEccMul;
_PUKCL_ZPECDSAGENERATE PUKCL_ZpEcDsaGenerate;
_PUKCL_ZPECDSAVERIFY PUKCL_ZpEcDsaVerify;
_PUKCL_ZPECDSAQUICKVERIFY PUKCL_ZpEcDsaQuickVerify;
_PUKCL_ZPECCQUICKDUALMUL PUKCL_ZpEccQuickDualMul;
_PUKCL_ZPECCONVPROJTOAFFINE PUKCL_ZpEcConvProjToAffine;
_PUKCL_ZPECCONVAFFINETOPROJECTIVE PUKCL_ZpEcConvAffineToProjective;
_PUKCL_ZPECRANDOMIZECOORDINATE PUKCL_ZpEcRandomiseCoordinate;
_PUKCL_ZPECPOINTISONCURVE PUKCL_ZpEcPointIsOnCurve;
// ECC _PUKCL_GF2NECCADD PUKCL_GF2NEccAdd;
_PUKCL_GF2NECCDBL PUKCL_GF2NEccDbl;
_PUKCL_GF2NECCMUL PUKCL_GF2NEccMul;
_PUKCL_GF2NECDSAGENERATE PUKCL_GF2NEcDsaGenerate;
_PUKCL_GF2NECDSAVERIFY PUKCL_GF2NEcDsaVerify;
_PUKCL_GF2NECCONVPROJTOAFFINE PUKCL_GF2NEcConvProjToAffine;
_PUKCL_GF2NECCONVAFFINETOPROJECTIVE PUKCL_GF2NEcConvAffineToProjective;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 778 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) _PUKCL_GF2NECRANDOMIZECOORDINATE PUKCL_GF2NEcRandomiseCoordinate;
_PUKCL_GF2NECPOINTISONCURVE PUKCL_GF2NEcPointIsOnCurve;
} P;
} PUKCL_PARAM, 37.3.3.2.1 PUKCL_HEADER Structure The PUKCL_HEADER is common for all services of the library. This header includes standard fields to indicate the requested service, sub-service, options, return status, and so on, as shown in the following tables. Different terms used in the below description to be understood, are as follows:
Parameter Represents a variable used by the PUKCL. Every parameter belongs to either PUKCL_HEADER or PUKCL Service Specific Header Type Indicates the data type. For details on data type, please refer to CryptoLib_typedef_pb.h file in the library Dir Direction. Indicates whether PUKCL considers the variable as input or output. Input means that the application passes data to the PUKCL using the variable. Output means that the PUKCL uses the variable to pass data to the application. Location Suggests whether the parameter need to be stored in Crypto RAM or device SRAM. The PUKCL driver has macros for placing parameters into Crypto RAM, so that the user does not have to worry about the addresses Data Length If a parameter is a pointer variable, the Data Length column shows the size of the data pointed by the pointer Table 37-1. PUKCL_HEADER Structure Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service u1Service u1SubService u2Option u1 u1 u2 I I I Specific PUKCL_STATUS I/O u2Status Reserved Reserved u2 u2 u4 I/O Required service Executed service Required sub-service Executed sub-service Required option Executed option See the following table PUKCL_STATUS Structure See the following table PUKCL_STATUS Structure Output Status The Specific field in the PUKCL_HEADER structure is another structure named PUKCL_STATUS. The following table describes this structure. The details of the use of these bits are provided in the individual service descriptions. 37.3.3.2.2 PUKCL_STATUS Structure Members of the PUKCL_STATUS structure are shown in the following table. Table 37-2. PUKCL_STATUS Structure Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service CarryIn (see Note 1) CarryOut Zero bit bit bit Gf2n (see Note 1) bit Violation bit I O O I O CarryIn CarryOut 1: Result is zero 0: Result is not zero Mathematical field 0: Integers (Zp) 1: Field GF(2n) Indicates a violation 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 779 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Note:
1. Two of these fields must be filled in to avoid problems during computations. If the Gf2n and CarryIn fields are not reset or initialized properly, problems may be encountered during computations. For instance, not initializing the Gf2n field may result in getting a correct mathematical result, but computed over GF(2n) instead of Zp. 37.3.3.2.3 PUKCL Service Specific Header Details about each service specific header are provided with service descriptions in a subsequent section. Such structures may contain input or output parameters. A parameter is considered as an input parameter when it used for passing information to the PUKCL, and it is considered as an output parameter when the PUKCL uses it to pass a result back to the application code. The following code provides the service specific header example for the SelfTest service. typedef struct _PUKCL_selftest {
u4 u4Version;
u4 u4PUKCCVersion;
u4 u4CheckNum1;
u4 u4CheckNum2;
u1 u1Step;
} _PUKCL_SELFTEST;
After the SelfTest service is invoked (with vPUKCL_Process(SelfTest, pvPUKCLParam)), the service specific return values can be checked using pvPUKCLParam. To check whether the version returned by the PUKCL is correct, the following code can be used. while (pvPUKCLParam->P.PUKCL_SelfTest.u4Version != PUKCL_VERSION);
In a similar way, other returns can also be accessed. 37.3.3.3 Parameter Passing (Special Considerations) Most of the PUKCL services work with memory area and accept pointers and lengths as parameters to define input and output areas. Most of the time, the pointers and lengths are untouched by the services, while the defined areas are read, filled, or overwritten. These memory areas are defined with an initial pointer and a byte length. For most of the commands, the memory area location must be in the PUKCC Cryptographic RAM. The Cryptographic RAM is the memory area for parameter exchange with the PUKCL and is 4 Kbytes large. Sometimes memory areas can be located in Embedded SRAM, which is detailed in the Location column of the parameters description tables. When working with binary fields, polynomials in GF(2n) need no transformation to be written in an area:
Each bit represents a polynomial coefficient 0 or 1 The polynomials must be written Low Significant Byte First A zero padding on the Most Significant Bytes may be added if the area is larger than the real size of the polynomial Important:The Cryptographic RAM is 4 Kbytes in size and is dedicated to PUKCC. However, to ensure correct library operation, the two last 32-bit words must not be used. Unless otherwise specified, these memory areas contain integers in GF(p) or polynomials in GF(2n) with the Less Significant Byte first. Unless otherwise specified, the length must be a multiple of four and the pointers must be four bytes aligned. This is because most of the services work with 32-bit words. 37.3.3.4 Aligned Significant Length Parameters in memory areas can have any Significant Length in bytes. As the lengths in PUKCL must be a multiple of four, a padding is processed on the Most Significant Side with zero to three bytes cleared to zero. Now the parameter can be considered to meet the Aligned Significant Length requirement for PUKCL. 37.3.3.5 Processing Field GF(p) and GF(2n) The library can process arithmetic functions over GF(p) (or Zp integers) and GF(2n), when applicable. The choice of these processing fields is made using the following rules:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 780 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) If a processing field is not applicable to the function, it is not mentioned and the Specific.GF2n bit has no effect. If the function can support both processing fields, the choice is mentioned and the Specific.GF2n bit must be filled according to the choice. If the function supports only one of the processing fields, the processing field is mentioned and the Specific.GF2n bit has no effect. 37.3.3.6 Return Codes Each call to one of the PUKCL services returns a status code indicating whether or not the execution is correct, which can be decoded, as shown in the following figure. Figure 37-1. Return Code Status Decoding The following table shows how the severity indicators must be decoded. Table 37-3. Severity Indicators Value for Bits 1415 Severity Comment 0xC000 0x8000 0x4000 0x0000 Severe Indicates a blocking error condition Warning Indicates a cautionary use of the return values Information Indicates the result is correct and gives information No error or no severity given The following table contains the exhaustive list of all reason codes. Table 37-4. Return Codes Value for Bits 0013 Severity Code Reason Code 0x0000 0x4001 0x4002 0xC001 0xC002 0xC003 0xC004 0xC005 0xC006 0xC007 0xC008 0xC101 PUKCL_OK Informative PUKCL_NUMBER_IS_NOT_PRIME Informative PUKCL_NUMBER_IS_PRIME Severe Severe Severe Severe Severe Severe Severe Severe Severe PUKCL_COMPUTATION_NOT_STARTED PUKCL_UNKNOWN_SERVICE PUKCL_UNEXPLOITABLE_OPTIONS PUKCL_HARDWARE_ISSUE PUKCL_WRONG_HARDWARE PUKCL_LIBRARY_MALFORMED PUKCL_ERROR PUKCL_UNKNOWN_SUBSERVICE PUKCL_DIVISION_BY_ZERO 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 781 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Value for Bits 0013 Severity Code Reason Code 0xC102 0xC103 0xC104 Severe Severe Severe PUKCL_MALFORMED_MODULUS PUKCL_FAULT_DETECTED PUKCL_MALFORMED_KEY Please note the following rules about return codes:
A status value indicating a severe error, means that an expected operation has not been executed or has been corrupted. Therefore, the result of such an operation must not be used. A status value indicating a warning must be looked at precisely, as the expected correctness of the result cannot be guaranteed. A status value indicating an information always means that the result is correct with no possible misinterpretation of the values. A status value zero indicates that there is no error or no severity. In the following sections, for each service, the constraints on the parameters placement are detailed. For reduced code size and higher execution speed, tests are processed on these constraints. It is important that PUKCL users take these placement constraints into consideration at the development and test stages to ensure the correct functioning of the library. 37.3.4 Basic Arithmetic and Cryptographic Services 37.3.4.1 SelfTest 37.3.4.1.1 Purpose This service is used to initialize the PUKCL. It resets the PUKCC, clears the Crypto RAM, and returns the library and PUKCC version numbers. It must be called before using any other services in the library and the user must verify the return status at the end of the service execution. 37.3.4.1.2 How to Use the Service 37.3.4.1.3 Description This service processes internal tests and returns information and status codes as described in 37.3.4.1.7. Status Returned Values. The service name for this operation is SelfTest. 37.3.4.1.4 Parameters Definition It is possible to directly address this service through the PUKCL_SelfTest() macro. Table 37-5. SelfTest Service Parameters Parameter Type Dir. Location Data Length Before Executing the After Executing the Service u4Version u4 u4PUKCCVersion u4 u4CheckNum1 u4CheckNum2 u1Step u4 u4 u1 O O O O O Service PUKCL version PUKCC Version Test result value 1 Test result value 2 Latest correctly executed step 37.3.4.1.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 782 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) vPUKCL_Process(SelfTest,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
// The Library version is available
// in PUKCL_SelfTest(u4Version)
// The PUKCL version is available
// in PUKCL_SelfTest(u4PUKCCVersion)
37.3.4.1.6 Returned Values The expected u4Version value depends on the version of PUKCL being used, and the u4PUKCCVersion value depends on the version of PUKCC being used. The expected u4CheckNum1 value is 0x6e70ddd2 and the expected one for u4CheckNum2 is 0x25c8d64f. The expected final u1Step value is 3. 37.3.4.1.7 Status Returned Values Table 37-6. SelfTest Service Return Codes Returned Status Importance Meaning PUKCL_OK PUKCL_ERROR Severe Service functioned correctly. An issue has been encountered. 37.3.4.2 Clear Flags 37.3.4.2.1 Purpose This service can be used to clear parameter structure flags. 37.3.4.2.2 How to Use the Service 37.3.4.2.3 Description This service clears CarryOut, CarryIn, Zero and Violation flags in the Specific bit field. The Gf2n flag is untouched. The service name for this operation is ClearFlags. 37.3.4.2.4 Parameters Definition It is possible to directly address this service through the PUKCL_ClearFlags() macro. Table 37-7. Clear Flags Service Parameters Parameter Type Direction Location Data Length Before Executing the Specific/CarryOut Bit Specific/CarryIn Specific/Zero Specific/Violation Bit Bit Bit O O O O 37.3.4.2.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
Service
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ClearFlags,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
// Success
else // Manage the error After Executing the Service Cleared Cleared Cleared Cleared 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 783 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.4.2.6 Status Returned Values Table 37-8. ClearFlags Service Return Codes Returned Status Importance Meaning PUKCL_OK Service functioned correctly. 37.3.4.3 Swap 37.3.4.3.1 Purpose This service performs swapping of two buffers. 37.3.4.3.2 How to Use the Service 37.3.4.3.3 Description This service swaps two buffers, X and Y, of the same size in memory. The service name for this operation is Swap. 37.3.4.3.4 Parameters Definition This service can easily be accessed through the use of the PUKCL_Swap() macro. Table 37-9. Swap Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1XBase nu1 nu1YBase nu1 u2XLength u2 I I I Crypto RAM u2Length Base of the number X Base of X filled with Y Crypto RAM u2Length Base of the number Y Base of Y filled with X Length of X and Y Length of X and Y 37.3.4.3.5 Code Example _PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// Initialize parameters PUKCL_Swap(nu1XBase) = <Base of the X number>;
PUKCL_Swap(nu1YBase) = <Base of the Y number>;
PUKCL_Swap(u2XLength) = <Length of the numbers>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(Swap,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
else // Manage the error 37.3.4.3.6 Constraints The following conditions must be avoided to ensure that the service works correctly:
nu1XBase or nu1YBase are not aligned on 32-bit boundaries u2XLength is either <4, > 0xffc, or not a 32-bit length
{nu1XBase, u2XLength} or {nu1YBase, u2XLength} do not entirely lie in PUKCCRAM
{nu1XBase, u2XLength} overlaps {nu1YBase,u2YLength}
37.3.4.3.7 Status Returned Values Table 37-10. Swap Service Return Codes Returned status Importance Meaning PUKCL_OK Service functioned correctly 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 784 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.4.4 Fill 37.3.4.4.1 Purpose This service performs a memory fill operation, with a given 32-bit constant. 37.3.4.4.2 How to Use the Service 37.3.4.4.3 Description This service fills a Crypto RAM space with a provided 32-bit constant: Fill (R, FillValue) The service name for this operation is Fill. 37.3.4.4.4 Parameters Definition This service can easily be accessed through the use of the PUKCL_Fill() macro. Table 37-11. Fill Service Parameters Parameter Type Direction. Location Data Length Before Executing the After Executing the Service Service nu1RBase nu1 u2RLength u4FillValue u2 u4 I I I Crypto RAM u2RLength Base of R Base of R value filled repetitively with u4FillValue Crypto RAM Length of R Filling value Length of R Filling value 37.3.4.4.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// Initialize parameters PUKCL_Fill(nu1RBase) = <Base of the R number>;
PUKCL_Fill(u2RLength) = <Length of the R number>;
PUKCL_Fill(u4FillValue) = <32-bits value to fill with>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(Fill,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
else // Manage the error 37.3.4.4.6 Constraints The following conditions must be avoided to ensure that the service works correctly:
nu1RBase are not aligned on 32-bit boundaries u2RLength is either: <4, >0xffc or not a 32-bit length
{nu1RBase, u2RLength} do not entirely lie in Crypto RAM 37.3.4.4.7 Status Returned Values Table 37-12. Fill Service Return Codes Returned Status Importance Meaning PUKCL_OK Service functioned correctly. 37.3.4.5 Fast Copy/Clear 37.3.4.5.1 Purpose This service performs a copy from a memory area to another or a memory area clear. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 785 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.4.5.2 How to Use the Service 37.3.4.5.3 Description This service copies a number X into another number R, padding with zero on the MSB side up to the length specified for R. R = X If the lengths of R and X are equal, a complete fast copy is processed. If the length of R is strictly greater than the length of X, X is first copied in the Low Significant Bytes side of R, and R is padded with zeros on the Most Significant Bytes side. If the pointer on the X area equals zero, R is filled with zeros. This operation can also be made by using the Fill service (see 37.3.4.4. Fill). The service name for this operation is FastCopy. Important:The length of R must be greater or equal to the length of X. 37.3.4.5.4 Parameters Definition This service can easily be accessed through the use of the PUKCL_FastCopy() macro. Table 37-13. FastCopy Service Parameters Parameter Type Direction Location Data Length Before Executing the Crypto RAM u2XLength Base of X Service After Executing the Service Base of X number untouched Crypto RAM u2RLength Base of R Base of R filled with X Length of R Length of X Length of R Length of X nu1XBase nu1 nu1RBase nu1 u2RLength u2XLength u2 u2 I I I I 37.3.4.5.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// Initialize parameters PUKCL_FastCopy(nu1XBase) = <Base of the X number>;
PUKCL_FastCopy(nu1RBase) = <Base of the R number>;
PUKCL_FastCopy(u2XLength) = <Length of the X number>;
PUKCL_FastCopy(u2RLength) = <Length of the R number>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(FastCopy,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
else // Manage the error 37.3.4.5.6 Constraints The parameter placements that are not allowed are are as follows. If nu1XBase equals zero, no checks are made on nu1XBase (fixed) and u2XLength (unused). The following conditions must be avoided to ensure that the service works correctly:
nu1XBase or nu1RBase are not aligned on 32-bit boundaries 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 786 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) u2XLength or u2RLength is either: <4, >0xffc or not a 32-bit length or u2XLength >u2RLength
{nu1XBase, u2XLength} or {nu1RBase, u2RLength} do not entirely lie in Crypto RAM
{nu1XBase, u2XLength} overlaps {nu1RBase,u2RLength}
37.3.4.5.7 Status Returned Values Table 37-14. FastCopy Service Return Codes Returned status Importance Meaning PUKCL_OK Service functioned correctly 37.3.4.6 Conditional Copy/Clear 37.3.4.6.1 Purpose This service conditionally performs a copy from a memory area to another or a memory area clear. 37.3.4.6.2 How to Use the Service 37.3.4.6.3 Description This service copies a number X into another number R, padding with zero on the MSB side up to the length specified for R. This copy operation is performed under the conditions specified in the options. If the condition is verified, R = X. The copy or clear action is made under condition. The four possible options for the condition are described in the following table. Two of the conditions check the Specific.CarryIn bit. The processing is done as follows:
If the condition is not verified, nothing is processed. If the condition is verified the copy or clear follows the rules:
If the lengths of R and X are equal, a complete fast copy is processed If the length of R is strictly greater than the length of X, X is first copied in the Low Significant Bytes side of R, and R is padded with zeros on the Most Significant Bytes side. If the pointer on the X area equals zero, R is filled with zeros. The service name for this operation is CondCopy. Important:If the condition is verified, the length of R must be greater or equal to the length of X. 37.3.4.6.4 Parameters Definition This service can easily be accessed through the use of the PUKCL_CondCopy() and PUKCL() macros. Table 37-15. CondCopy Service Parameters Parameter Type Direction Location Data Length Before Executing the u2Options u2 Specific/CarryIn Bit nu1XBase nu1 I I I Service Option for condition
(see the following table) After Executing the Service Option for condition (see the following table) Bit CarryIn Bit CarryIn Crypto RAM u2XLength Base of X Base of X number untouched 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 787 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Parameter Type Direction Location Data Length Before Executing the Crypto RAM u2RLength Base of R Service After Executing the Service Base of R filled with X if condition holds Length of R Length of X Length of R Length of X nu1RBase nu1 u2RLength u2XLength u2 u2 I I I 37.3.4.6.5 Available Options The option for the condition is set by the u2Options input parameter that must take one of the values listed in the following table. Table 37-16. CondCopy Service Options Option Purpose Needed parameters PUKCL_CONDCOPY_ALWAYS Always perform the copy nu1XBase,u2XLength,nu1RBase, u2RLength PUKCL_CONDCOPY_NEVER Never perform the copy None PUKCL_CONDCOPY_IF_CARRY Perform the copy if CarryIn is 1 PUKCL_CONDCOPY_IF_NOT_CARRY Perform the copy if CarryIn is zero Specific/CarryIn nu1XBase,u2XLength,nu1RBase, u2RLength Specific/CarryIn nu1XBase,u2XLength,nu1RBase, u2RLength 37.3.4.6.6 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// CarryIn shall be beforehand filled (with zero or one) PUKCL(Specific).CarryIn = ...;
// Condition Option PUKCL(u2Options) = ...;
// Initialize parameters PUKCL_CondCopy(nu1XBase) = <Base of the X number>;
PUKCL_CondCopy(nu1RBase) = <Base of the R number>;
PUKCL_CondCopy(u2XLength) = <Length of the X number>;
PUKCL_CondCopy(u2RLength) = <Length of the R number>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(CondCopy,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
else // Manage the error 37.3.4.6.7 Constraints The parameters placement that are not allowed are listed below. If the conditional option and the CarryIn do not lead to execute the copy, no checks are made on the constraints to be respected. If nu1XBase equals zero, no checks are made on nu1XBase (fixed) and u2XLength (unused). The following conditions must be avoided to ensure that the service works correctly:
nu1XBase or nu1RBase are not aligned on 32-bit boundaries u2XLength or u2RLength is either: <4, >0xffc or not a 32-bit length or u2XLength >u2RLength 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 788 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
{nu1XBase, u2XLength} or {nu1RBase, u2RLength} do not entirely lie in Crypto RAM
{nu1XBase, u2XLength} overlaps {nu1RBase,u2RLength}
37.3.4.6.8 Status Returned Values Table 37-17. CondCopy Service Return Codes Returned status Importance Meaning PUKCL_WRONG_SERVICE Severe An inconsistency has been detected between the called service and the provided service number. PUKCL_OK Service functioned correctly 37.3.4.7 Small Multiply, Add, Subtract, Exclusive OR Related Links 37.3.4.5. Fast Copy/Clear 37.3.5.1. Modular Reduction 37.3.4.7.1 Purpose This purpose of this service is to multiply a large number X by a single-word number, MulValue, and perform an optional accumulation/subtract with a large number Z, returning the result R. The following options are available:
Work in the GF(2n) or in the standard GF(p) arithmetic integer field Add of a supplemental CarryOperand Overlap of the operands is possible, taking into account some constraints Modulo-reduction of the computation result (see Modular Reduction from Related Links) In addition to a multiply, possible uses of this service can include:
Copy a block of data from one place to another (if u4MulValue is 1). This operation can alternatively be made by using the Fast Copy service (see Fast Copy/Clear from Related Links) Adding/Subtracting two numbers (if u4MulValue is1) Xoring two blocks of data (if u4MulValue is 1 and the selected mathematical field is GF(2n)) 37.3.4.7.2 How to Use the Service 37.3.4.7.3 Description This service processes the following operation (if not computing a modular reduction of the result):
R = [Z] (MulValue X + CarryOperand) Or (if computing a modular reduction of the result):
R = ([Z] (MulValue X + CarryOperand))mod N The service name for this operation is Smult. The result of the Small Multiply Operation is stored on u2RLength bytes, so the choice of this length compared to u2XLength may lead to:
A truncation if the result is too big to be stored on u2RLengthbytes. A padding on the MSB side if the result does not take all the u2RLengthbytes. However, in all cases this rule must be followed:
Important:The length of R must be greater than or equal to the length of X. In these computations, the following parameters need to be provided:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 789 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) R the result (pointed by{nu1RBase,u2Rlength}) X one input number or GF(2n) polynomial (pointed by{nu1XBase,u2XLength}) Z one optional input number or GF(2n) polynomial (pointed by{nu1ZBase,u2Rlength}). MulValue one input number or GF(2n)polynomial on one word (provided in u4MulValue) CarryOperand (provided through the CarryOptions and Carry values). Important:Even if neither accumulation nor subtraction is specified, the nu1ZBase must always be filled and point to a Crypto RAM space. It this case, nu1ZBase can point to the same space as the nu1RBase. If using the modular reduction option, the Multiply operation is followed by a reduction (see Modular Reduction from Related Links) and the following parameters must be additionally provided:
Nthe modulus (pointed by {nu1ModBase,u2Modlength +4}) Cnsthe reduction constant In case of Big reduction, Cns is pointed by {nu1CnsBase,64bytes}. In case of Fast or Normalized reduction, Cns is pointed by {nu1CnsBase,u2ModLength +8}
Important:
The result buffer R must first be padded with zero bytes until its length is sufficient to perform the reduction (2*u2ModLength + 8) to be used by the Modular Reduction service as an input parameter. The result of the reduction is written in the area X pointed by {nu1XBase, u2ModLength + 4}. For example, if relevant u2ModLength is 0x80 bytes and u2XLength is 0x80 too, the length of the Rspace may be 2*(u2ModLength + 4) = 0x108 bytes. In case of fast or normalized reduction, the length of the result may be u2ModLength + 4 so 0x84 bytes. Therefore, the zone X may lengths 0x84 bytes (at least). The multiplication of X by 1 word provide a result in the zone R which MSB bytes will be padded with zero bytes. In that example, the length of the zone R will be 2*u2ModLength + 8 = 0x108 bytes. 37.3.4.7.4 Parameters Definition Table 37-18. Smult Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service u2Options u2 Specific/Gf2n CarryIn Specific/CarryOut Zero Violation Bits Bits nu1ModBase nu1CnsBase nu1 nu1 u2ModLength u2 I I I I I I Options (see below) GF(2n) Bit and Carry In Options (see below) Carry Out, Zero Bit and Violation Bit filled according to the result Crypto RAM u2ModLength + 4 Base of N Base of N untouched Crypto RAM u2ModLength + 8 Base of Cns Base of Cns untouched Length of N Length of N 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 790 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Parameter Type Direction Location Data Length nu1XBase nu1 u2XLength nu1ZBase nu1RBase u2RLength u4MulValue u2 nu1 nu1 u2 u4 I I I I I I Before Executing the Service After Executing the Service Base of X Base of X(2) Crypto RAM u2XLength or u2ModLength +
4(1) Length of X Length of X Crypto RAM u2RLength Base of Z Base of Z untouched Crypto RAM u2RLength Base of R Base of R (see Note 3) Length of R Length of R Value of MulValue Value of MulValue untouched Notes:
1. 2. 3. If a reduction option is specified, the area X will be, if necessary, extended to u2ModLength + 4 bytes. If Smult is without reduction, X is untouched. If Smult is with reduction, X is filled with the final result. If Smult is without reduction, R is filled with the final result. If Smult is with reduction, R is corrupted. 37.3.4.7.5 Available Options The options are set by the u2Options input parameter, which is composed of:
The mandatory Small Multiplication operation option described in the following table. The mandatory CarryOperand option described in Smult Service (with Accumulate/Subtract From) Carry Settings and Smult Service Carry Settings tables. The facultative Modular Reduction option (see Modular Reduction). If the Modular Reduction is not requested, this option is absent. The u2Options number is calculated by an Inclusive OR of the options. Some examples in C language are:
Operation: Small Multiply only without carry and without Modular Reduction PUKCL(u2Options) = SET_MULTIPLIEROPTION(PUKCL_SMULT_ONLY) |
SET_CARRYOPTION(CARRY_NONE);
Operation: Small Multiply with addition with Specific/CarryIn addition and with Fast Modular Reduction PUKCL(u2Options) =SET_MULTIPLIEROPTION(PUKCL_SMULT_ADD) |
SET_CARRYOPTION(ADD_CARRY) | PUKCL_REDMOD_REDUCTION | PUKCL_REDMOD_USING_FASTRED;
The following table lists all of the necessary parameters for the Small Multiply option. When the Addition or Subtraction option is not chosen, it is not necessary to fill in the nu1ZBase parameter. Table 37-19. Smult Service Operation Options Option Purpose Required Parameters SET_MULTIPLIEROPTION(PUKCL_SMULT_ ONLY) Perform R = MulValue*X +
CarryOperand SET_MULTIPLIEROPTION(PUKCL_SMULT_ ADD) SET_MULTIPLIEROPTION(PUKCL_SMULT_ SUB) Perform R = Z
+ MulValue*X +
CarryOperand Perform R = Z
- (MulValue*X +
CarryOperand) nu1RBase, u2RLength, nu1XBase, u2XLength, u4MulValue nu1RBase, u2RLength, nu1ZBase, nu1XBase, u2XLength,u4MulValue nu1RBase, u2RLength, nu1ZBase, nu1XBase, u2XLength,u4MulValue 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 791 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.4.7.6 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// Gf2n and CarryIn shall be beforehand filled (with zero or one) PUKCL(Specific).Gf2n = ...;
PUKCL(Specific).CarryIn = ...; PUKCL(u2Options) =...;
// Depending on the option specified, all fields must not be filled PUKCL_Smult(nu1XBase) = <Base of the X number>;
PUKCL_Smult(u2XLength) = <Length of the X number>;
PUKCL_Smult(nu1RBase) = <Base of the R number>;
PUKCL_Smult(u2RLength) = <Length of the R number>;
PUKCL_Smult(nu1ZBase) = <Base of the Z number>;
PUKCL_Smult(u4MulValue) = <Value to be multiplied with>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(Smult,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
// The Small multiplication has been executed correctly
else // Manage the error Note:
The length of R must be greater or equal to the length of X. Additional options are available through the use of a modular reduction to be executed at the end of this operation. Some important considerations have to be taken into account concerning the length of resulting operands to get a mathematically correct result. The output of this operation is not obviously compatible with the modular reduction, as it may be either smaller or bigger. In the case (most of the time) where the result (pointed by nu1RBase) is smaller in size than twice the modulus plus one word, it is mandatory to add padding bytes to zero. Otherwise, the reduced value will be taken considering the high order words (potentially uninitialized) as part of the number, thus resulting in a mathematically correct but unexpected result. In the case that the result is bigger than twice the modulus plus one word, the modular reduction feature has to be executed as a separate operation, using an Euclidean division. 37.3.4.7.7 Constraints For the case of a small multiplication with an option indicating either subtraction or accumulation, the following conditions must be avoided to ensure the service works correctly:
{nu1XBase, u2XLength}, {nu1ZLength, u2RLength} or {nu1RBase, u2RLength} do not entirely lie in Crypto RAM nu1XBase, nu1RBase or nu1ZBase are not aligned on 32-bit boundaries u2XLength or u2RLength is either: < 4, > 0xffc or not a 32-bit length or u2XLength >u2RLength
{nu1RBase, u2RLength} overlaps {nu1XBase, u2XLength} or nu1R < nu1Z and {nu1RBase,u2RLength}
overlaps {nu1ZBase, u2RLength}
If the nu1R value is greater or equals to the nu1Z one, the overlapping between R and Z is allowed. If a modular reduction is specified, the relevant parameters must be defined according to the chosen reduction and follow the description in Modular Reduction. Additional constraints to be respected and error codes are described in this section and in Smult Service Return Codes. Multiplication with Accumulation or Subtraction When the options bits specify that either an Accumulation or a Subtraction must be performed, this service performs the following operation:
R = (Z (MulValue X + CarryOperand))mod BRLength Table 37-20. Smult Service (with Accumulate/Subtract From) Carry Settings Carry Options CarryOperand Resulting Operation SET_CARRYOPTION(ADD_CARRY) CarryIn R = Z (MulValue*X + CarryIn) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 792 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Carry Options CarryOperand Resulting Operation SET_CARRYOPTION(SUB_CARRY)
- CarryIn R = Z (MulValue*X - CarryIn) SET_CARRYOPTION(ADD_1_PLUS_CARRY) 1 + CarryIn R = Z (MulValue*X + 1 + CarryIn) SET_CARRYOPTION(ADD_1_MINUS_CARRY) 1 - CarryIn R = Z (MulValue*X + 1 - CarryIn) SET_CARRYOPTION(CARRY_NONE) SET_CARRYOPTION(ADD_1) SET_CARRYOPTION(SUB_1) SET_CARRYOPTION(ADD_2) 0 1
- 1 2 R = Z (MulValue*X) R = Z (MulValue*X + 1) R = Z (MulValue*X - 1) R = Z (MulValue*X + 2) Multiplication without Accumulation or Subtraction When the case the options bits specify that neither an Accumulation nor a Subtraction must be performed, this service performs the following operation:
R = (MulValue X + CarryOperand)mod BRLength Table 37-21. Smult Service Carry Settings Carry Options CarryOperand Resulting Operation SET_CARRYOPTION(ADD_CARRY) SET_CARRYOPTION(SUB_CARRY) CarryIn
- CarryIn R = MulValue*X + CarryIn R = MulValue*X - CarryIn SET_CARRYOPTION(ADD_1_PLUS_CARRY) 1 + CarryIn R = MulValue*X + 1 + CarryIn SET_CARRYOPTION(ADD_1_MINUS_CARRY) 1 - CarryIn R = MulValue*X + 1 - CarryIn SET_CARRYOPTION(CARRY_NONE) SET_CARRYOPTION(ADD_1) SET_CARRYOPTION(SUB_1) SET_CARRYOPTION(ADD_2) 0 1
-1 2 R = MulValue*X R = MulValue*X + 1 R = MulValue*X - 1 R = MulValue*X + 2 37.3.4.7.8 Status Returned Values Table 37-22. Smult Service Return Codes Returned Status Importance Meaning PUKCL_OK Service functioned correctly 37.3.4.8 Compare 37.3.4.8.1 Purpose The purpose of this service is to compare two numbers in classical arithmetic GF(p). Important:This service works only with integers. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 793 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.4.8.2 How to Use the Service 37.3.4.8.3 Description This service accepts two numbers in classical arithmetic in input and performs a comparison, virtually subtracting (X
+ CarryIn) from Y:
CompareGetFlags (Y - (X + CarryIn)) The numbers X and Y are untouched but the resulting flags CarryOut and the Zero Bit are filled. If the lengths of Y and X are equal, a comparison is processed. If the length of Y is strictly greater than the length of X, X is first virtually padded with zeros on the Most Significant Bytes side, then a comparison is processed. Note:The length of Y must be greater or equal to the length of X. In this computation, the following data need to be provided:
X (pointed by{nu1XBase,u2XLength}) Y (pointed by{nu1YBase,u2YLength}) The service name for this operation is Comp. 37.3.4.8.4 Parameters Definition Table 37-23. Comp Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service Specific/Gf2n CarryIn Specific/CarryOut Zero Violation nu1XBase u2XLength nu1YBase u2YLength Bits Bits nu1 u2 nu1 u2 I I I I I I GF(2n) Bit and Carry In Carry Out, Zero Bit and Violation Bit filled according to the result Crypto RAM u2XLength Base of X Base of X Length of X Length of X Crypto RAM u2YLength Base of Y Base of Y Length of Y Length of Y 37.3.4.8.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// CarryIn shall be beforehand filled (with zero or one) PUKCL(Specific).CarryIn = ...;
// Initializing parameters PUKCL_Comp(nu1XBase) = <Base of the ram location of X>;
PUKCL_Comp(u2XLength) = <Length of X>;
PUKCL_Comp(nu1YBase) = <Base of the ram location of Y>;
PUKCL_Comp(u2YLength) = <Length of Y>;
// vPUKCL_Process() is a macro command,
// and then calls the library... vPUKCL_Process(Comp,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
// The COMPARE has been executed correctly
// CarryOut, Zero ... are available
... = PUKCL(Specific).CarryOut;
... = PUKCL(Specific).Zero;
else // Manage the error 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 794 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.4.8.6 Constraints The following conditions must be avoided to ensure that the service works correctly:
nu1XBase or nu1YBase are not aligned on 32-bit boundaries u2XLength or u2YLength is either: < 4, > 0xffc or not a 32-bit length or u2XLength >u2YLength
{nu1XBase, u2XLength} or {nu1YLength, u2YLength} are not in Crypto RAM 37.3.4.8.7 Status Returned Values Table 37-24. Comp Service Return Codes Returned Status Importance Meaning PUKCL_OK Service functioned correctly 37.3.4.9 Full Multiply Related Links 37.3.5.1. Modular Reduction 37.3.4.9.1 Purpose The purpose of this service is to multiply two large numbers, X and Y, and optionally accumulate/subtract from a third large number, Z, returning the result, R. The available options are as follows:
Work in the GF(2n) field or in the standard arithmetic field Add of a supplemental CarryOperand Overlap of the operands is possible, taking into account some constraints Modular Reduction of the computation result (see Modular Reduction from Related Links) 37.3.4.9.2 How to Use the Service 37.3.4.9.3 Description This service provides the following (if not computing a modular reduction of the result):
R = [Z] (X Y + CarryOperand) Or (if computing a modular reduction of the result):
R = ([Z] (X Y + CarryOperand))mod N The service name for this operation is Fmult. In these computations, the following data has to be provided:
R the result (pointed by {nu1RBase,u2Xlength +u2YLength}) X one input number or GF(2n) polynomial (pointed by{nu1XBase,u2XLength}) Y one input number or GF(2n) polynomial (pointed by{nu1YBase,u2YLength}) Z one optional input number or GF(2n) polynomial (pointed by {nu1ZBase,u2Xlength +u2YLength}) CarryOperand (provided through the Carry Options and Carry values) Important:Even if neither accumulation nor subtraction is specified, the nu1ZBase must always be filled and point to a Crypto RAM space. It this case, nu1ZBase can point to the same space as the nu1RBase. If using the big modular reduction option, the Multiply operation is followed by a reduction (see Modular Reduction from Related Links). In this case, the length of Cns is 64 bytes. If using the modular reduction option, the Multiply operation is followed by a reduction (see Modular Reduction from Related Links). In this case the following parameters must be additionally provided:
Nthe modulus (pointed by {nu1ModBase,u2Modlength +4}) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 795 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Cnsthe reduction constant In case of Big reduction, Cns is pointed by {nu1CnsBase,64bytes}. In case of Fast or Normalized reduction, Cns is pointed by (pointed by {nu1CnsBase,u2ModLength+ 8}) Note:
The result buffer R must first be padded with zero bytes until its length is sufficient to perform the reduction
(2*u2ModLength + 8) to be used by the Modular Reduction service as an input parameter. The result of the reduction is written in the area X pointed by {nu1XBase, u2ModLength + 4}. For example, if u2ModLength, u2XLength and u2YLength are 0x80 bytes, the length of the R space is 2*(u2ModLength + 4) = 0x108 bytes because of the constraints of modular reduction. In case of Fast or Normalized Reduction, the length of the result is u2ModLength + 4 so 0x84 bytes. Thus, the zone X has a length of 0x84 bytes (at least). The multiplication of X by Y provides a result of length 0x100 bytes in the zone R so the 8 MSB bytes must be previously padded with zero bytes (in offsets 0x100 to 0x107). 37.3.4.9.4 Parameters Definition Table 37-25. Fmult Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service Options (see below) Options (see below) GF(2n) Bit and Carry In Carry Out, Zero Bit and Violation Bit filled according to the result Base of N untouched Base of Cns untouched Crypto RAM u2ModLength + 4 Base of N Crypto RAM u2ModLength + 8 Base of Cns or 64 bytes Length of N Length of N Crypto RAM u2XLength or Base of X Base of X(2) u2ModLength + 4(1) Length of X Length of X Crypto RAM u2YLength Base of Y Base of Y Length of Y Length of Y Crypto RAM u2XLength +
Base of Z Base of Z untouched u2YLength Crypto RAM u2XLength +
Base of R Base of R(3) u2YLength u2Options Specific/Gf2n CarryIn Specific/CarryOut Zero Violation u2 Bits Bits nu1ModBase nu1 nu1CnsBase nu1 u2 nu1 u2 nu1 u2 nu1 nu1 u2ModLength nu1XBase u2XLength nu1YBase u2YLength nu1ZBase nu1RBase Notes:
I I I I I I I I I I I I 1. 2. 3. In case of a reduction option is specified, if necessary, the area X will be extended to u2ModLength + 4 bytes. If FMult is without reduction, X is untouched. If FMult is with reduction, X is filled with the final result. If FMult is without reduction, R is filled with the final result. If FMult is with reduction, R is corrupted. 37.3.4.9.5 Available Options The options are set by the u2Options input parameter, which is composed of:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 796 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) the mandatory Full Multiplication operation option described in Table 37-26 the mandatory CarryOperand option described in Table 37-27 and Table 37-28 the facultative Modular Reduction option(see Modular Reduction from Related Links). If the Modular Reduction is not requested, this option is absent. The u2Options number is calculated by an Inclusive OR of the options. Some Examples in C language are:
Operation: Full Multiply only without carry and without Modular Reduction PUKCL(u2Options) = SET_MULTIPLIEROPTION(PUKCL_FMULT_ONLY) |
SET_CARRYOPTION(CARRY_NONE);
Operation: Full Multiply with addition with Specific/CarryIn addition and with Fast Modular Reduction PUKCL(u2Options) = SET_MULTIPLIEROPTION(PUKCL_FMULT_ADD) |
SET_CARRYOPTION(ADD_CARRY) |
PUKCL_REDMOD_REDUCTION |
PUKCL_REDMOD_USING_FASTRED;
The following table shows all of the necessary parameters for the Full Multiply option. When the Addition or Subtraction option is not chosen, it is not necessary to fill in the nu1ZBase parameter. Table 37-26. Fmult Service Options Option Purpose SET_MULTIPLIEROPTION(PUKCL_FMUL_ONLY) Perform R = X*Y +
CarryOperand SET_MULTIPLIEROPTION(PUKCL_FMUL_ADD) Perform R = Z + X*Y +
CarryOperand SET_MULTIPLIEROPTION(PUKCL_FMUL_SUB) Perform R = Z - (X*Y +
CarryOperand) Required Parameters nu1RBase, nu1YBase, u2YLength, nu1XBase, u2XLength nu1RBase, nu1ZBase, nu1YBase, u2YLength, nu1XBase, u2XLength nu1RBase, nu1ZBase, nu1YBase, u2YLength, nu1Xlength, u2XLength 37.3.4.9.6 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// Gf2n and CarryIn shall be beforehand filled (with zero or one) PUKCL(Specific).Gf2n = ...;
PUKCL(Specific).CarryIn = ...;
PUKCL(u2Option) =...;
// Depending on the option specified, not all fields must be filled PUKCL_Fmult(nu1XBase) = <Base of the ram location of X>;
PUKCL_Fmult(u2XLength) = <Length of X>;
PUKCL_Fmult(nu1YBase) = <Base of the ram location of Y>;
PUKCL_Fmult(u2YLength) = <Length of Y>;
PUKCL_Fmult(nu1ZBase) = <Base of the ram location of Z>;
PUKCL_Fmult(nu1RBase) = <Base of the ram location of R>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(Fmult,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
// The Full multiply has been executed correctly
else // Manage the error 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 797 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.4.9.7 Important Considerations for Modular Reduction of a Fmult Computation Result Note:
Additional options are available through the use of a modular reduction to be executed at the end of this operation. Some important considerations have to be taken into account concerning the length of resulting operands to get a mathematically correct result. The output of this operation is not always compatible with the modular reduction as it may be either smaller or bigger. In the case (most of the time) the result (pointed by nu1RBase) is smaller in size than twice the modulus plus one word by one word, a padding word must be added to zero. Otherwise, the reduced value will be taken considering the high order words (potentially uninitialized) as part of the number, thus resulting in getting a mathematically correct but unexpected result. In the case that the result is bigger than twice the modulus plus one word, the modular reduction feature has to be executed as a separate operation, using an Euclidean division. 37.3.4.9.8 Constraints The following conditions must be avoided to ensure that the service works correctly:
nu1XBase, nu1YBase, nu1RBase or nu1ZBase are not aligned on 32-bit boundaries
{nu1XBase, u2XLength}, {nu1YLength, u2YLength}, {nu1ZBase, u2XLength+u2YLength} or{nu1RBase, u2XLength+u2YLength} are not in Crypto RAM u2XLength, u2YLength is either: < 4, > 0xffc or not a 32-bit length
{nu1RBase, u2XLength+u2YLength} overlaps {nu1YBase, u2YLength} or{nu1RBase, u2XLength+u2YLength}
overlaps {nu1XBase, u2XLength}
{nu1RBase, u2XLength+u2YLength} overlaps {nu1ZBase, u2XLength+u2YLength} and nu1RBase> nu1ZBase If a modular reduction is specified, the relevant parameters must be defined according to the chosen reduction and follow the description in Modular Reduction (see Modular Reduction from Related Links). Additional constraints to be respected and error codes are described in this section and in Table 37-49. Multiplication with Accumulation or Subtraction In the case where the options bits specify that either an Accumulation or a subtraction must be performed, this service performs the following operation:
R = (Z (X Y + CarryOperand))mod BXLength + YLength Table 37-27. Fmult Service (with Accumulate/Subtract From) Carry Settings Option AND CARRYOPTIONS CarryOperand Resulting Operation SET_CARRYOPTION(ADD_CARRY) SET_CARRYOPTION(SUB_CARRY) CarryIn
- CarryIn R = Z (X*Y + CarryIn) R = Z (X*Y - CarryIn) SET_CARRYOPTION(ADD_1_PLUS_CARRY) 1 + CarryIn R = Z (X*Y + 1 + CarryIn) SET_CARRYOPTION(ADD_1_MINUS_CARRY) 1 - CarryIn R = Z (X*Y + 1 - CarryIn) SET_CARRYOPTION(CARRY_NONE) SET_CARRYOPTION(ADD_1) SET_CARRYOPTION(SUB_1) SET_CARRYOPTION(ADD_2) 0 1
- 1 2 R = Z (X*Y) R = Z (X*Y + 1) R = Z (X*Y - 1) R = Z (X*Y + 2) Multiplication without Accumulation or Subtraction In the case the options bits specify that either an Accumulation or a subtraction must be performed, this service performs the following operation:
R = (X Y + CarryOperand)mod BXLength + YLength 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 798 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Table 37-28. Fmult Service Carry Settings Option AND CARRYOPTIONS CarryOperand Resulting Operation SET_CARRYOPTION(ADD_CARRY) SET_CARRYOPTION(SUB_CARRY) CarryIn
- CarryIn R = X*Y + CarryIn R = X*Y - CarryIn SET_CARRYOPTION(ADD_1_PLUS_CARRY) 1 + CarryIn R = X*Y + 1 + CarryIn SET_CARRYOPTION(ADD_1_MINUS_CARRY) 1 - CarryIn R = X*Y + 1 - CarryIn SET_CARRYOPTION(CARRY_NONE) SET_CARRYOPTION(ADD_1) SET_CARRYOPTION(SUB_1) SET_CARRYOPTION(ADD_2) 0 1
- 1 2 R = X*Y R = X*Y + 1 R = X*Y - 1 R = X*Y + 2 37.3.4.9.9 Status Returned Values Table 37-29. Fmult Service Return Codes Returned Status Importance Meaning PUKCL_OK Service functioned correctly 37.3.4.10 Square Related Links 37.3.5.1. Modular Reduction 37.3.4.10.1 Purpose The purpose of this service is to compute the square of a big number and optionally accumulate/subtract from a second big number. Please note that this service uses an optimized implementation of the squaring. It also means that when the GF(2n) flag is set, the execution time will be smaller than when not set (in that case, the squaring execution time will still be smaller than for a standard multiplication). The available options are as follows:
Work in the GF(2n) or in the standard integer arithmetic field Add of a supplemental CarryOperand Overlapping of the operands is possible, taking into account some constraints Modular Reduction of the computation result 37.3.4.10.2 How to Use the Service 37.3.4.10.3 Description This service provides the following (if not computing a modular reduction of the result):
R = [Z] (X2 + CarryOperand) Or (if computing a modular reduction of the result):
R = ([Z] (X2 + CarryOperand))mod N The service name for this operation is Square. In these computations, the following data has to be provided:
R the result (pointed by {nu1RBase,2 *u2Xlength}) X one input number or GF(2n) polynomial (pointed by{nu1XBase,u2XLength}) Z one optional input number or GF(2n) polynomial (pointed by {nu1ZBase,2 *u2Xlength}) CarryOperand (provided through the CarryOptions and Carry values) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 799 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Important:Even if neither accumulation nor subtraction is specified, the nu1ZBase must always be filled and point to a Crypto RAM space. It this case, nu1ZBase can point to the same space as the nu1RBase. If using the big modular reduction option, the Multiply operation is followed by a reduction (see Modular Reduction from Related Links). In this case, the length of Cns is 64 bytes. If using the modular reduction option the Square operation is followed by a reduction (see Modular Reduction from Related Links). In this case the following parameters must be additionally provided:
Nthe modulus (pointed by {nu1ModBase,u2Modlength +4}). Cnsthe reduction constant (pointed by {nu1CnsBase,u2Modlength +8}) In case of big reduction option, the length of Cns is 64bytes. Note:
The result buffer R must first be padded with zero bytes until its length is sufficient to perform the reduction
(2*u2ModLength + 8) to be used by the Modular Reduction service as an input parameter. The result of the reduction is written in the area X pointed by {nu1XBase, u2ModLength + 4}. For example, if u2ModLength, u2XLength is 0x80 bytes, the length of the R space is 2*(u2ModLength + 4) = 0x108 bytes because of the constraints of modular reduction. In case of Fast or Normalized Reduction, the length of the result is u2ModLength + 4 so 0x84 bytes. Thus, the zoneX has a length of 0x84 bytes (at least). The square of X provides a result of length 0x100 bytes in the zone R so the 8 MSB bytes previously must be previously padded with zero bytes (in offsets 0x100 to 0x107). 37.3.4.10.4 Parameters Definition Table 37-30. Square Service Parameters Parameter Type Direction Location Data Length u2Options Specific/Gf2n CarryIn Specific/CarryOut Zero Violation u2 Bits Bits nu1ModBase nu1 nu1CnsBase nu1 u2ModLength nu1XBase u2XLength nu1ZBase nu1RBase u2 nu1 u2 nu1 nu1 I I I I I I I I I I Before Executing the Service After Executing the Service Options (see below) Options (see below) GF(2n) Bit and Carry In Carry Out, Zero Bit and Violation Bit filled according to the result Base of N untouched Base of Cns untouched Crypto RAM u2ModLength + 4 Base of N Crypto RAM u2ModLength + 8 or 64 bytes Base of Cns Length of N Length of N Crypto RAM u2XLength or Base of X Base of X(2) u2ModLength + 4(1) Length of X Length of X Crypto RAM 2 * u2XLength Base of Z Base of Z Crypto RAM 2 * u2XLength Base of R Base of R(3) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 800 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Notes:
1. 2. 3. In case of a reduction option is specified, the area X will be, if necessary, extended to u2ModLength + 4 bytes. If Square is without reduction, X is untouched. If Square is with reduction, X is filled with the final result. If Square is without reduction, R is filled with the final result. If Square is with reduction, R is corrupted. 37.3.4.10.5 Available Options The options are set by the u2Options input parameter, which is composed of:
the mandatory Square operation option described in Table 37-31 the mandatory CarryOperand option described in Table 37-32 and Table 37-33 the facultative Modular Reduction option (see Modular Reduction from Related Links). If the Modular Reduction is not requested, this option is absent. The u2Options number is calculated by an Inclusive OR of the options. Some Examples in C language are:
Operation: Square only without carry and without Modular Reduction PUKCL(u2Options) = SET_MULTIPLIEROPTION(PUKCL_SQUARE_ONLY) |
SET_CARRYOPTION(CARRY_NONE);
Operation: Square with addition with Specific/CarryIn addition and with Fast Modular Reduction PUKCL(u2Options) = SET_MULTIPLIEROPTION(PUKCL_SQUARE_ADD) |
SET_CARRYOPTION(ADD_CARRY) | PUKCL_REDMOD_REDUCTION | PUKCL_REDMOD_USING_FASTRED;
The following table lists all of the necessary parameters for the Square option. When the Addition or Subtraction option is not chosen it is not necessary to fill in the nu1ZBase parameter. Table 37-31. Square Service Options Option Purpose Required Parameters SET_MULTIPLIEROPTION(PUKCL_ SQUARE_ONLY) SET_MULTIPLIEROPTION(PUKCL_ SQUARE_ADD) SET_MULTIPLIEROPTION(PUKCL_ SQUARE_SUB) Perform R = X2 + CarryOperand nu1RBase, nu1ZBase, nu1XBase, u2XLength Perform R = Z + X2 + CarryOperand nu1RBase, nu1ZBase, nu1XBase, u2XLength Perform R = Z - (X2 + CarryOperand) nu1RBase, nu1ZBase, nu1Xlength, u2XLength 37.3.4.10.6 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// Gf2n and CarryIn shall be beforehand filled (with zero or one) PUKCL(Specific).Gf2n = ...;
PUKCL(Specific).CarryIn = ...;
PUKCL(u2Option) =...;
// Depending on the option specified, not all fields must be filled PUKCL_Fmult(nu1XBase) = <Base of the ram location of X>;
PUKCL_Fmult(u2XLength) = <Length of X>;
PUKCL_Fmult(nu1ZBase) = <Base of the ram location of Z>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(Square,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
// The Squaring has been executed correctly
else // Manage the error 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 801 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.4.10.7 Important Considerations for Modular Reduction of a Square Computation Note:
Additional options are available through the use of a modular reduction to be executed at the end of this operation. Some important considerations have to be taken into account concerning the length of resulting operands to get a mathematically correct result. The output of this operation is not obviously compatible with the modular reduction as it may be either smaller or bigger. In the case (most of the time) the result (pointed by nu1RBase) is smaller in size than twice the modulus plus one word by one word, a padding word must be added to zero. Otherwise, the reduced value will be taken considering the high order words (potentially uninitialized) as part of the number, thus resulting in getting a mathematically correct but unexpected result. In the case that the result is greater than twice the modulus plus one word, the modular reduction feature has to be executed as a separate operation, using an Euclidean division. 37.3.4.10.8 Constraints When the options only indicate a square, the constraints involving nu1ZBase are not checked. The following conditions must be avoided to ensure that the service works correctly:
{nu1XBase, u2XLength}, {nu1ZBase, 2*u2XLength} or {nu1RBase, 2*u2XLength} are not in Crypto RAM nu1XBase, nu1RBase or nu1ZBase are not aligned on 32-bit boundaries u2XLength is either: < 4, > 0xffc or not a 32-bit length
{nu1RBase, 2*u2XLength} overlaps {nu1XBase,u2XLength}
{nu1RBase, 2*u2XLength} overlaps {nu1ZBase, 2*u2XLength} and nu1RBase >nu1ZBase If a modular reduction is specified, the relevant parameters must be defined according to the chosen reduction and follow the description in Modular Reduction (see Modular Reduction from Related Links). Additional constraints to be respected and error codes are described in this section and in Table 37-49. Multiplication with Accumulation or Subtraction Where the options bits specify that either an Accumulation or a subtraction must be performed, this command performs the following operation:
R = (Z (X2 + CarryOperand))mod B2 XLength Table 37-32. Multiplication with Accumulation or Subtraction Option AND CARRYOPTIONS CarryOperand Resulting Operation SET_CARRYOPTION(ADD_CARRY) SET_CARRYOPTION(SUB_CARRY) SET_CARRYOPTION(ADD_1_PLUS_CARRY) SET_CARRYOPTION(ADD_1_MINUS_CARRY) SET_CARRYOPTION(CARRY_NONE) SET_CARRYOPTION(ADD_1) SET_CARRYOPTION(SUB_1) SET_CARRYOPTION(ADD_2) CarryIn
- CarryIn 1 + CarryIn 1 - CarryIn R = Z (X2 + CarryIn) R = Z (X2 - CarryIn) R = Z (X2 + 1 + CarryIn) R = Z (X2 + 1 - CarryIn) 0 1
- 1 2 R = Z (X2) R = Z (X2 + 1) R = Z (X2 - 1) R = Z (X2 + 2) 37.3.4.10.9 Multiplication without Accumulation or Subtraction Where the options bits specify that either an accumulation or a subtraction must be performed, this command performs the following operation:
R = (X2 + CarryOperand)mod B2 XLength Table 37-33. Square Service Carry Settings Option AND CARRYOPTIONS CarryOperand Resulting Operation SET_CARRYOPTION(ADD_CARRY) CarryIn R = X2 + CarryIn 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 802 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Option AND CARRYOPTIONS SET_CARRYOPTION(SUB_CARRY) SET_CARRYOPTION(ADD_1_PLUS_CARRY) SET_CARRYOPTION(ADD_1_MINUS_CARRY) SET_CARRYOPTION(CARRY_NONE) SET_CARRYOPTION(ADD_1) SET_CARRYOPTION(SUB_1) SET_CARRYOPTION(ADD_2) CarryOperand Resulting Operation
- CarryIn 1 + CarryIn 1 - CarryIn R = X2 - CarryIn R = X2 + 1 + CarryIn R = X2 + 1 - CarryIn 0 1
- 1 2 R = X2 R = X2 + 1 R = X2 - 1 R = X2 + 2 37.3.4.10.10 Status Returned Values Table 37-34. Square Service Return Codes Returned status Importance Meaning PUKCL_OK Service functioned correctly 37.3.4.11 Integral (Euclidean) Division 37.3.4.11.1 Purpose The purpose of this service is to compute the Euclidean Division of two multiple precision numbers in GF(p) or polynomial in GF(2n). The Numerator is divided by the Denominator giving the Quotient Quo and the Remainder R. The following options are available:
Work in the GF(2n) field or in the standard integer arithmetic field GF(p) 37.3.4.11.2 How to Use the Service 37.3.4.11.3 Description This service processes the calculus corresponding to:
Num = Mod Quo + R wit 0 R < Mod and Quo =
The Numerator is Num. Num Mod The Divisior (Modulus) is Mod. The Quotient is Quo. The Remainder is R. The Inputs are, the Numerator Num, and the Denominator Mod. The service calculates the Quotient and the Remainder. The Remainder overwrites the Numerator and is copied to the R area. If the parameter nu1QuoBase equals zero, the Quotient is not stored in memory. If nu1QuoBase is different from zero, the Quotient length is (<Numerator Length> - <Denominator Length>) + 4 bytes. In this computation, the following areas need to be provided:
Num (pointed by {nu1NumBase,u2NumLength}) filled with the Numerator (with MSB word to zero). Mod (pointed by {nu1ModBase,u2ModLength}) filled with the Denominator. Workspace (pointed by {nu1CnsBase,64 or68}). Quo (pointed by {nu1QuoBase,u2NumLength - u2ModLength + 4}) to contain calculated Quotient. When the quotient is not needed, the nu1QuoBase pointer can be provided as NULL. In that case, only the remainder will be provided as a result. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 803 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) R (pointed by {nu1RBase,u2ModLength}) to contain the calculated Remainder. The service name for this operation is Div. 37.3.4.11.4 Parameters Definition Table 37-35. Div Service Parameters Parameter Type Dir. Location Data Length Before Executing the Service After Executing the Service Specific/Gf2n nu1NumBase Bit nu1 u2NumLength u2 nu1ModBase u2ModLength nu1QuoBase (see Note 1) nu1 u2 nu1 nu1WorkSpace nu1 nu1RBase ( see Note 2) nu1 Notes:
I I I I I I I I GF(2n) Bit Crypto RAM u2NumLength Base of Num Base of Num Filled with the Numerator Length of the Numerator Crypto RAM u2ModLengt Base of the Divisor Filled with the Remainder Length of the Numerator Base of the Divisor untouched Length of the Divisor Length of the Divisor Crypto RAM u2NumLength -
Base of the Quotient Base of the Quotient u2ModLength + 4 Crypto RAM GF(p): 64 GF(2n): 68 Crypto RAM u2ModLength Base of the WorkSpace Base of the Remainder Base of the WorkSpace corrupted Base of the Remainder 1. 2. If the quotient is not needed, set nu1QuoBase to zero and the quotient will not be written to memory. If the quotient is needed, set the nu1QuoBase to the beginning of an area of size (u2NumLength - u2ModLength +
4) to write the whole quotient. The Remainder is present in the area {nu1NumBase, u2NumLength} at the end of the calculus. The nu1RBase parameter makes it possible to copy this result in the other area {nu1RBase, u2ModLength}, if this copy is not needed, set nu1RBase to the same value as nu1NumBase and the copy will not be done. Note:The parameter Num must have its most significant 32-bit word cleared to zero. The length u2NumLength is the length of Num including this zero word. One additional word is used on the LSB side of the Num parameter, this word is restored at the end of the calculus. As a consequence the parameter nu1NumBase must never been at the beginning of the Crypto RAM, i.e., ensure that nu1NumBase <Crypto RAM Base> + 4 bytes. One additional word is used on the MSB side of the Num parameter, this word is not corrupted. As a consequence the Area {nu1NumBase, u2NumLength} must not be at the end of the Crypto RAM, i.e., en sure that nu1NumBase+u2NumLength <Crypto RAM End> - 4. u2ModLength must be the true length of the Modulus, i.e., the MSB word of the area {nu1ModBase, u2ModLength}
must be different from zero. The minimum value for u2ModLength is 8 bytes, so the significant length of Num must be at least 8 bytes. To divide by a 32-bit value, the divider and numerator shall be multiplied by 232. The resulting remainder will have to be divided by 232, the quotient will be exact. 37.3.4.11.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// Fill all the fields
// In that case, the quotient will be computed 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 804 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
// If it was not needed, set nu1QuoBase to NULL PUKCL_Div(nu1NumBase) = <Base of the ram location of Num>;
PUKCL_Div(nu1ModBase) = <Base of the ram location of Mod>;
PUKCL_Div(nu1QuoBase) = <Base of the ram location of Quo>;
PUKCL_Div(nu1WorkSpace) = <Base of the workspace>;
PUKCL_Div(nu1RBase) = <Base of the ram location of R>;
PUKCL_Div(u2NumLength) = <Length of Num>;
PUKCL_Div(u2ModLength) = <Length of Mod>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(Div,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
// The Division has been executed correctly
else // Manage the error 37.3.4.11.6 Constraints The following conditions must be avoided to ensure the service works correctly:
nu1ModBase, nu1RBase, nu1QuoBase, nu1WorkSpace or nu1NumBase are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength}, {nu1RBase, u2ModLength}, {nu1WorkSpace, 64} or{nu1NumBase, u2NumLength} are not in Crypto RAM u2ModLength, u2NumLength is either: < 4, > 0xffc or not a 32-bit length One or more overlaps exist between two of the areas: {nu1ModBase,u2ModLength},{nu1RBase, u2ModLength}
{nu1NumBase, u2NumLength}(1) or {nu1WorkSpace,64}
If nu1QuoBase is different from zero and: {nu1QuoBase, u2NumLength - u2ModLength + 4} are not in Crypto RAM If nu1QuoBase is different from zero and one or more overlaps exist between two of the areas:
{nu1QuoBase, u2NumLength - u2ModLength + 4}, {nu1ModBase, u2ModLength}, {nu1RBase, u2ModLength},
{nu1NumBase, u2NumLength} or {nu1WorkSpace, 64}
Overlaps between {nu1RBase, u2ModLength} and {nu1NumBase, u2NumLength} are forbidden, but the equality between nu1RBase and nu1NumBase is authorized 37.3.4.11.7 Status Returned Values Table 37-36. Div Service Return Codes Returned Status Importance Meaning PUKCL_OK Service functioned correctly. PUKCL_DIVISION_BY_ZERO Severe The operation was not performed because the Denominator value is zero. 37.3.4.12 GCD, Modular Inverse 37.3.4.12.1 Purpose The purpose of this command is to compute the Greatest Common Divisor (GCD) and the Modular Inverse. The algorithm used is the Extended Euclidean Algorithm for the GCD. This command accepts as input two multiple precision numbers in GF(p) or two polynomials in GF(2n) X and Y and computes their GCD (D), if D equals one, the command also supplies the inverse of X modulo Y. The available options are as follows:
Work in the GF(2n) field or in the standard integer arithmetic field GF(p) 37.3.4.12.2 How to Use the Service 37.3.4.12.3 Description This command calculates:
D = GCD(X,Y). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 805 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) and parameter A in the Bezout equation:
A X + B Y = D. The first input, or input to inverse is X. The second input, or modulus is Y. The GCD is output in D. The modular inverse if X and Y are co-primes is output A:
A = X1mod(Y) The command calculates the GCD and the value A. The value A is the multiplicative inverse of X, only if X and Y are co-prime. As a supplemental result, Z is given back, being the quotient of Y divided by D only if D is different from zero:
Z =
At the end of the command: X is overwritten by D. Y D Y is cleared. The value of A is calculated and stored. The value of Z is calculated and stored if D is different from zero. The service name for this operation is GCD. In this computation, the following areas have to be provided:
X (pointed by {nu1XBase,u2Length}) filled with X (with MSB word to zero) Y (pointed by {nu1YBase,u2Length}) filled with Y (with MSB word to zero) A (pointed by {nu1ABase,u2Length}) to contain calculated A Z (pointed by {nu1ZBase,u2Length}) to contain calculated Z The workspace (pointed by {nu1WorkSpace,32}) 37.3.4.12.4 Parameters Definition Table 37-37. GCD Service Parameters Parameter Type Dir. Location Data Length Before Executing the Service After Executing the Service Specific/Gf2n Bit nu1XBase nu1 u2Length u2 nu1YBase nu1ABase nu1 nu1 nu1ZBase nu1 nu1WorkSpace nu1 I I I I I I I GF(2n) Bit Crypto RAM u2Length Base of X Number X Base of X Filled with the GCD D Length of the Areas X, Y, A, Z Length of the Areas X, Y, A, Z Crypto RAM u2Length Base of Y Number Y Base of Y Cleared area Crypto RAM u2Length Base of A Base of A Crypto RAM u2Length + 4
(see Note 1) Filled with the result Base of Z Base of Z Crypto RAM 32 bytes Base of the workspace Filled with the result Base of the workspace corrupted Note:
1. The additional word is 4 zero bytes. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 806 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) The parameters X and Y must have their most significant 32-bit word cleared to zero. The length u2Length is the length of the longer of the parameters X and Y including this zero word. To clarify here is an example:
X is an 8 bytes number. Y is a 12 bytes number. This example is processed this way before the use of the GCD service:
The longer number is Y so its length is taken and increased by 4 bytes for the 32-bit word cleared to zero, this gives u2Length = 16 bytes. Therefore, X, Y, A and Z areas have a length of 16 bytes. Y is padded with 4 bytes cleared to zero on the MSB side and the u2Length = 16 bytes are written in memory
(LSB first). X is padded with 8 bytes cleared to zero on the MSB side and the u2Length = 16 bytes are written in memory
(LSB first). The areas A and Z are mapped in memory with a size of u2Length = 16 bytes. The workspace is mapped in memory with its constant size of 32 bytes 37.3.4.12.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// Fill all the fields PUKCL(u2Option) = 0;
PUKCL_GCD(nu1XBase) = <Base of the ram location of X>;
PUKCL_GCD(nu1YBase) = <Base of the ram location of Y>;
PUKCL_GCD(nu1ABase) = <Base of the ram location of A>;
PUKCL_GCD(nu1ZBase) = <Base of the ram location of Z>;
PUKCL_GCD(nu1WorkSpace) = <Base of the workspace>;
PUKCL_GCD(u2Length) = <Length of X, Y, A and Z>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(GCD, pvPUKCLParam);
if (PUKCL_Param.Status == PUKCL_OK)
// The GCD has been executed correctly
else // Manage the error 37.3.4.12.6 Constraints The following conditions must be avoided to ensure that the service works correctly:
nu1XBase, nu1YBase, nu1ABase or nu1ZBase are not aligned on 32-bit boundaries
{nu1XBase, u2Length}, {nu1YBase, u2Length}, {nu1ABase, u2Length} or {nu1ZBase, u2Length} are not in Crypto RAM u2Length is either: < 4, > 0xffc or not a 32-bit length
{nu1XBase, u2Length} overlaps {nu1YBase, u2Length} or {nu1XBase, u2Length} overlaps {nu1ABase, u2Length} or {nu1XBase, u2Length} overlaps {nu1ZBase, u2Length} or {nu1YBase, u2Length}overlaps
{nu1ABase, u2Length} or {nu1YBase, u2Length} overlaps {nu1ZBase, u2Length} or {nu1ABase, u2Length} overlaps
{nu1ZBase, u2Length}
37.3.4.12.7 Status Returned Values Table 37-38. GCD Service Return Codes Returned Status Importance Meaning PUKCL_OK Service functioned correctly 37.3.4.13 Get Random Number 37.3.4.13.1 Purpose The purpose of this command is to provide the user with a source of entropy. The options available for this service are:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 807 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Generation of random numbers from a Hardware Random Number Generator (TRNG). Generation of random numbers from a Deterministic Random Number Generator (DRNG). Important:
When using this service, be sure to strictly follow the directives given for the RNG on the chip you use
(particularly initialization, seeding) and compulsorily start the RNG. If the directives require not to use this service, follow them and use the proposed method to get random numbers. This service only has the option to get random numbers and does not seed, initialize or start the RNG. Other options are reserved for future use. Neither continuous testing nor entropy testing is included in this service. If this is needed (FIPS 140, ZKA, ...), this service must not be used and the users develops their own command. The DRNG is compatible with both ANSI X9.31 and FIPS 186-2 standards (see the important note below). The DRNG is designed according to:
The algorithm described in the document ANSI Digital Signatures Using Reversible Public Key Cryptography for the Financial Services Industry (rDSA) X9.31 dated September 9, 1998. The Change recommendation for ANSI X9.0 - 1995 (Part 1) and ANSI X9.31 -1998:
The algorithm B.2.1 Algorithm for computing m Values of x is the one applied in the Toolbox 3 X9.31 DRNG. The DRNG is compatible with:
The DRNG is described in the document NIST Digital Signature Standard (DSS) FIPS Pub 186-2 January 27, 2000 Appendix 3.1 The FIPS 186-2 Change Notice 1 dated October 5, 2001 modifies this algorithm. Important:To apply the FIPS 186-2 algorithm, the parameters XSeed[0] and XSeed[1] must be set to the same value. 37.3.4.13.2 How to Use the Service 37.3.4.13.3 Description This service has four possible options described in Table 37-41. Two of these options are reserved for future use. This service performs the following operations:
Generation of a random number from the Hardware RNG Generation of a random number from the Deterministic RNG Generation of a Random Number from the Hardware RNG This service, activated with the option PUKCL_RNG_GET, makes it possible to get a random number R from the Hardware RNG:
R = HardwareRandomGenerate() In the Generation of random from the RNG service, the following parameters need to be provided:
R the generated number area (pointed by{nu1RBase,u2RLength}) 37.3.4.13.4 Generation of a Random Number from the Deterministic RNG This service, activated with the option PUKCL_RNG_X931_GET, makes it possible to get a random number R from the Deterministic Random Number Generator with input parameters the Key XKey and the Seed XSeed:
(XKey, R) = DeterministicRandomGenerateFromSeed ( XKey, XSeed, Q) In the generation of a random number from the Deterministic RNG service, the following parameters need to be provided:
XKey the input and output Key (pointed by {nu1XKeyBase,u2XKeyLength}) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 808 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) XSeed the input Seed (pointed by {nu1XseedBase,u2XKeyLength}) Q the prime number (pointed by {nu1QBase, 20bytes}) R the generated number area (pointed by {nu1RBase, 20bytes}) 37.3.4.13.5 Hardware RNG Parameters Definition The parameters for the generation of random from the Hardware RNG are described in the following table. This service can easily be accessed through the use of the PUKCL_Rng() and PUKCL() macros. Table 37-39. RNG Service Hardware Generated Parameters Parameter Type Dir. Location Data Length Before Executing the Service After Executing the Service u2Options u2 nu1RBase nu1 u2RLength u2 I I I Option (see Table 37-41) Option (see Table 37-41) Crypto RAM or Device RAM u2RLength Base of R Base of R filled with random values depending on the option Length of R Length of R 37.3.4.13.6 Deterministic RNG Parameters Definition The parameters for the generation of random from the Deterministic RNG are described in the following table. This service can easily be accessed through the use of the PUKCL_Rng() and PUKCL() macros. Table 37-40. RNG Service Deterministic Generated Parameters Parameter Type Direction Location Data Length u2Options u2 I Before Executing the Service After Executing the Service Option (see Table 37-41) Option (see Table 37-41) nu1XKeyBase nu1 I/O Crypto RAM u2XKeyLength Base of XKey nu1Workspace nu1 NA Crypto RAM 64 bytes nu1Workspace2(1) nu1 NA Crypto RAM 2*u1XKeyLength + 4 Base of the workspace Base of the workspace 2 Base of XKey filled with the resulting XKey Base of the workspace corrupted Base of the workspace corrupted nu1XSeedBase nu1 I/O Crypto RAM max u2XKeyLength u2 nu1QBase nu1RBase nu1 nu1 I I I
( 2*u2XKeyLength, 44 bytes) Base of the values XSeed[0]
and XSeed[1]
Base of XSeed filled with the result on 20 bytes Length of XKey, Xseed[0] and Xseed[1]
Length of XKey, Xseed[0] and Xseed[1]
Crypto RAM 20 bytes Base of Q Base of Q Crypto RAM u2RLength Base of R Base of R filled with the result on 20 bytes Note:
1. The nu1 Workspace2 must be a multiple of 256. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 809 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.4.13.7 Options The option is set by the u2Options input parameter that must take one of the values listed in the following table. Note:The values, OPTION_RNG_SEED and OPTION_RNG_GETSEED, are reserved for future use. Table 37-41. RNG Service Options Option Purpose PUKCL_RNG_SEED Reserved Required Parameters Reserved PUKCL_RNG_GET Generation of a random number from the RNG nu1RBase, u2RLength PUKCL_RNG_X931_GET Generation of a random number from the Deterministic RNG nu1XKeyBase, nu1Workspace, nu1XSeedBase, u2XKeyLength, nu1QBase, nu1RBase PUKCL_RNG_GETSEED Reserved Reserved 37.3.4.13.8 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL(u2Option) =...;
// Initializing parameters PUKCL_Rng(nu1RBase) = <Base of the ram location to store the rng>;
PUKCL_Rng(u2RLength) = <Length of the rng to get>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(Rng,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
// The RNG generation has been executed correctly
else // Manage the error 37.3.4.13.9 Constraints Random Number Generation The following conditions must be avoided to ensure that the service works correctly:
{nu1RBase,u2RLength} not in RAM
{nu1RBase,u2RLength} not accessible or authorized for writing Deterministic Random Number Generation The length of the parameter nu1XSeedbase is: XSeedLength = max( 2*u2XKeyLength, 44 bytes) The max() macro takes a maximum of two values. The following conditions must be avoided to ensure that the service works correctly:
nu1XKeyBase,nu1Workspace, nu1Workspace2, nu1XSeedBase, nu1QBase, nu1RBase are not aligned on 32-
bit boundaries
{nu1XKeyBase, u2XKeyLength}, {nu1Workspace, 64 bytes}, {nu1Workspace2, 2*u1XKeyLength +4},
{nu1XSeedBase, XSeedLength}, {nu1QBase, 24 bytes} or {nu1RBase, 20 bytes} are not in PUKCC RAM u2XKeyLength is either: < 20, > 64 or not a 32-bit length nu1Workspace2 not multiple of 256. Overlaps exist between two or more of the areas: {nu1XKeyBase, u2XKeyLength}, {nu1Workspace,64 bytes},
{nu1XSeedBase, XSeedLength}, {nu1QBase, 24 bytes} or {nu1RBase, 20 bytes}
The area {nu1RBase, 20} can overlap with {nu1Workspace, 64 bytes} or {nu1QBas, 24 bytes}. The pointer nu1RBase can equal the pointer nu1XSeedBase. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 810 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.4.13.10 Status Returned Values Table 37-42. RNG Service Return Codes Returned status PUKCL_OK Importance Information Meaning Service functioned correctly 37.3.5 Modular Arithmetic Services This section provides a complete description of the modular arithmetic services, which consists of two sets:
Modular reductions, which can be used as stand alone operations, or used as a final step of most arithmetic operations (full and small multiplications, squaring). Modular operations, which include modular exponentiations (with or without using the CRT) and a probabilistic prime number generation. These operations work on general data so the modulus has no special form. The modular services are available through:
a Fast form (may return a congruence of the result, with a high probability to have a Normalized result) a Normalized form (returns the exact result, strictly lower than the modulus) a Euclidean form (returns the exact result, strictly lower than the modulus) The following table describes the modes of the modular reduction with the hypothesis:
In GF(p): The modulus is N with length NLength in bytes In GF(2n): The modulus is P[X] with length NLength in bytes For the exact calculus of NLength see below. Table 37-43. Modular Reduction Modes Modular Reduction Form Fast Input Dynamic Result Dynamic Comments GF(p): 0 Input < (N2) *
(232) GF(2n): Input < ((P[x])2) *
(X32) GF(p): 0 Res < N * 4 GF(2n): Res < P[X] * (X2) The fastest reduction available, needs a precomputed constant. Normalized InputLength < NLength + 4 bytes GF(p): 0 Res < N GF(2n):
Res < P[X]
Using Euclidean division InputLength < 2 * NLength +
4 bytes GF(p): 0 Res < N GF(2n): Res < P[X]
The correction step does not runs in constant time. Needs a precomputed constant. The Normalize function cannot be applied to the product of two numbers of length u2NLength. Does not need any precomputed constant. To be able to use these modular reduction services (except the Euclidean division), first the implementer shall call the setup service, providing the modulus as well as one free memory space for the constant (this constant is used to speed up the modular reduction). In most commands (except the modular exponentiation), the quotient is stored in the high order bytes of the number to be reduced, using only eight bytes more than the maximum size of the number to be reduced. The following rules must be respected to ensure the modular reduction services function correctly:
The numbers to be reduced can have any significant length, given the fact it CANNOT BE GREATER than 2*u2ModLength + 4 bytes. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 811 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) The modulus SHALL ALWAYS HAVE a significant length of <u2ModLength> bytes. The modulus must be provided as a <u2ModLength + 4> bytes long number, padded on the most significant side with a 32-bit word cleared to zero. Not respecting this rule leads to unexpected and wrong results from the modular reduction. The normalization operation ALWAYS performs a modular reduction step, and will therefore have the same memory usage as this one. The very first operation before any modular operation SHALL BE a modular setup. 37.3.5.1 Modular Reduction Related Links 37.3.3.4. Aligned Significant Length 37.3.5.1.1 Purpose This service is used to perform the various steps necessary to perform a modular reduction and accepts as input numbers in GF(p) or polynomials in GF(2n) . The available options for this service are:
Work in the GF(2n) or in the standard integer arithmetic field GF(p) Operation is the generation of the reduction constant. Operation is a Modular Reduction. Operation is a Normalization. 37.3.5.1.2 How to Use the Service 37.3.5.1.3 Description This service performs one of the following operations:
Setup of the Fast or Normalize functions: generation of the reduction constant Fast Modular Reduction Big Modular Reduction (using Euclides division) Normalization The service name for this operation is RedMod. 37.3.5.1.4 Modular Reduction Setup This service calculates the constant Cns, computed from the modulus and used to speed up the modular reduction:
Cns = SetupConstant(N) This service must be processed before the use of the Fast or Normalize functions. In the Setup computations, the following data must be provided:
N the modulus (pointed by {nu1ModBase,u2ModLength +4}). Cns the Setup Constant Result (pointed by {nu1CnsBase,u2ModLength +12}). X used as a workspace (pointed by {nu1XBase,2 * u2ModLength + 8}) (include the supplementary bytes; see Note 2 in Table 37-44 R used as a workspace (pointed by {nu1RBase,64 or 68bytes}). u2ModLength is the Aligned Significant Length of the modulus and is not the byte Significant Length (see Aligned Significant Length from Related Links). 37.3.5.1.5 Fast Reductions and Normalization These commands calculate an approximated or exact Modular Reduction, that is, the result may be greater than the modulus, but is always congruent to the true result. Important:Before using these functions, ensure that the constant Cns has been calculated with the setup for the Modular Reduction service. Input and Result significant values verify:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 812 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) For the Fast Modular Reduction:
2 32 0 X < N 2 For the Normalize:
R = Xmod N + k N wit 0 k 4 XLengt < NLengt + 4 bytes R In these Fast Modular Reduction and Normalize computations, the following data have to be provided:
= Xmod N X (pointed by {nu1XBase,2 * u2ModLength +8}) The Normalize computation accept as entry a value whose length is lower or equal to u2ModLength +
4 (that is, for example, a value yet reduced but not normalized.). The u2ModLength + 4 MSB bytes are cleared at the beginning of the computation. in case of Fast RedMod computations, the value X mayverify: X < (N2) *(232). include the supplementary bytes; see Note 3 in 37.3.5.1.8. Fast Modular Reductions Service Parameters Definition. R (pointed by {nu1RBase,u2Modlength +4}) N (pointed by {nu1ModBase,u2ModLength +4}) Cns (pointed by {nu1CnsBase,u2ModLength +12}) u2ModLength is the Aligned Significant Length of the modulus and is not the byte Significant Length (see Aligned Significant Length from Related Links). The Fast Modular Reduction is able to reduce inputs up to <2*u2ModLength + 4> bytes. The input can come from a multiplication of 2 <u2ModLength + 4> bytes numbers. The input X is considered as a <2*u2ModLength + 8> bytes number. Important:Additionally the Fast Reduction and Normalize functions need supplemental bytes located on the MSB side of the number to be reduced but these bytes are restored at the end of the operation and are therefore unchanged. However, these bytes are to be taken into account when the mapping is created, and could lead to unexpected results if overlapping with other area used by the function. The Fast Modular Reduction returns a <u2ModLength + 4> bytes number, but this number is in fact a <u2ModLength
+ 2> significant bytes number. When using the Fast Modular Reduction, the two MSB bytes of the <u2ModLength +
2> can have a maximum of two lsb bits set (depending on the reduced number and the modulo). The Normalize computation accepts as entry a resulting value of Fast Modular Reduction and computes an exact result. It can not be applied to the result of the product of two numbers of size NLength: a Fast Modular Reduction must be applied before. For the Normalize computation, the X value is limited by the preceding formula but the area in memory is bigger as described in 37.3.5.1.8. Fast Modular Reductions Service Parameters Definition. As input, the Normalize sub-service only accept values, which length is lower or equal to u2ModLength + 4. The Most Significant u2ModLength + 4 bytes are firstly cleared by this service. 37.3.5.1.6 Big Modular Reduction Using Euclide's Division This command calculates:
XLengt < 2 NLengt + 4 bytes R In this Big Modular Reduction computations, the following data must be provided:
= Xmod N X (pointed by {nu1XBase,2 * u2ModLength + 8}) (include the supplementary bytes; see Note 1 in Table 37-46) R (pointed by {nu1RBase,u2Modlength +4}) N (pointed by {nu1ModBase,u2ModLength +4}) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 813 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) u2ModLength is the Aligned Significant Length of the modulus and is not the byte Significant Length (see Aligned Significant Length from Related Links). Workspace (pointed by {nu1CnsBase,64 or 68}). 37.3.5.1.7 Modular Reductions Service Parameters Definition Table 37-44. RedMod Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service u2Options u2 Specific/CarryIn Bits Specific/Gf2n Specific/CarryOut Zero Violation Bit Bits nu1ModBase(1) nu1 nu1CnsBase nu1 u2ModLength nu1RBase u2 nu1 nu1XBase(2) nu1 I I I I I I I I I Notes:
Options (see below) Must be set to zero. GF(2n) Bit Crypto RAM u2ModLength + 4 Base of N Crypto RAM u2ModLength + 12 Base of Cns Options (see below) Carry Out, Zero Bit and Violation Bit filled according to the result Base of N untouched Base of Cns filled with the Setup Constant Length of N Length of N Crypto RAM GF(p): 64 bytes Base of R GF(2n): 68 bytes as a workspace Crypto RAM 2*u2ModLength + 8 Base of X as a workspace Base of R workspace corrupted Base of X workspace corrupted 1. 2. The Modulus is to be given as a u2ModLength Aligned Significant Length Bytes however, it has to be provided as a u2ModLength + 4 bytes long number, having the four high-order bytes set to zero. Before the X (pointed by {nu1XBase,2 * u2ModLength + 8}) LSB bytes, four supplementary bytes will be saved/restored. Other four supplementary bytes will also be saved/restored after the X MSB bytes. All these supplementary bytes may be entirely in the Crypto RAM (therefore, do not place the X area too near the end of the Crypto RAM) and shall not overlap with other area used by the service. 37.3.5.1.8 Fast Modular Reductions Service Parameters Definition Table 37-45. Fast RedMode and Normalize Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service u2Options u2 Specific/CarryIn Bits Specific/Gf2n Bit I I I Options (see below) Must be set to zero. GF(2n) Bit Options (see below) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 814 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service Specific/CarryOut Zero Violation Bits nu1ModBase(1) nu1 nu1 u2 nu1 nu1 nu1CnsBase u2ModLength nu1RBase(2) nu1XBase(3) Notes:
I I I I I I Crypto RAM u2ModLength + 4 Base of N Crypto RAM u2ModLength + 12 Base of Cns Carry Out, Zero Bit and Violation Bit filled according to the result Base of N untouched Base of Cns untouched Length of N Length of N Crypto RAM u2ModLength + 4 Base of R Base of R filled with the result Crypto RAM 2*u2ModLength + 8 Base of X the Base of X corrupted number to reduce 1. 2. 3. The Modulus is to be given as a u2ModLength Aligned Significant Length Bytes however, it has to be provided as a u2ModLength + 4 bytes long number, having the four high-order bytes set to zero. To make profitable the space memory, it is possible to set nu1RBase exactly equal to nu1XBase. After the X (pointed by {nu1XBase,2 * u2ModLength + 8}) MSB bytes, supplementary bytes will be saved/
restored (8 bytes in case of Fast RedMod, otherwise; 12 bytes). These supplementary bytes may be entirely in the Crypto RAM (therefore, do not place the X area too near the end of the Crypto RAM) and shall not overlap with other area used by the service. 37.3.5.1.9 Big Modular Reduction Parameters Definition Table 37-46. Big RedMod Service Parameters Parameter Type Direction Location Data Length u2Options u2 Specific/CarryIn Bits Specific/Gf2n Specific/CarryOut Zero Violation nu1ModBase nu1CnsBase u2ModLength nu1RBase nu1XBase(1) Bit Bits nu1 nu1 u2 nu1 nu1 I I I I I I I I I Before Executing the Service After Executing the Service Options (see below) Options (see below) Must be set to zero GF(2n) Bit Carry Out, Zero Bit and Violation Bit filled according to the result Crypto RAM u2ModLength + 4 Base of N Base of N untouched Crypto RAM GF(p): 64 bytes GF(2n): 68 bytes Base of Cns as a workspace Base of Cns corrupted Length of N Length of N Crypto RAM u2ModLength + 4 Base of R Crypto RAM 2*u2ModLength + 8 Base of X the number to reduce Base of R filled with the result Base of X filled with the result 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 815 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Note:
1. Before the X (pointed by {nu1XBase,2 * u2ModLength + 8}) LSB bytes, four supplementary bytes will be saved/restored. Other four supplementary bytes will also be saved/restored after the X MSB bytes. All of these supplementary bytes may be entirely in the Crypto RAM (therefore, do not place the X area too near the end of the Crypto RAM) and shall not overlap with other area used by the service. 37.3.5.1.10 Options The options are set by the u2Options input parameter, which is composed of:
the mandatory Operation Option described in Table 37-47 if the Operation Option is PUKCL_REDMOD_REDUCTION, the Modular Reduction Sub-Option described in Table 37-48 The u2Options number is calculated by an Inclusive OR of the options. Some Examples in C language are:
Operation: Setup for the ModularReductions. PUKCL(u2Options) = PUKCL_ REDMOD_SETUP;
Operation: Fast ModularReduction. PUKCL(u2Options) = PUKCL_REDMOD_REDUCTION | PUKCL_REDMOD_USING_FASTRED;
For this command three exclusive options can be specified. The following table lists the operations that can be performed. Table 37-47. RedMod Service Options Option Purpose PUKCL_REDMOD_SETUP Perform the Cns value computation PUKCL_REDMOD_REDUCTION Perform R X Mod N, see sub-option for details PUKCL_REDMOD_NORMALIZE Perform R = X Mod N Required Parameters nu1ModBase, u2ModLength, nu1CnsBase, nu1XBase nu1ModBase, u2ModLength, nu1CndBase, nu1XBase, nu1RBase nu1ModBase, u2ModLength, nu1CndBase, nu1XBase, nu1RBase When selecting the PUKCL_REDMOD_REDUCTION option, one of the two sub-options listed in the following table must be selected. Table 37-48. RedMode Service Options with PUKCL_RED_MOD_REDUCTION Option Purpose Required Parameters PUKCL_REDMOD _USING_DIVISION PUKCL_REDMOD _USING_FASTRED Perform R = X Mod N nu1ModBase, u2ModLength, nu1CndBase, nu1XBase Perform R X Mod N The entropy is minimized (~2 bits) nu1ModBase, u2ModLength, nu1CndBase, nu1XBase, nu1RBase 37.3.5.1.11 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL(Specific).CarryIn = 0;
PUKCL(Specific).GF2n = ...;
PUKCL(u2Option) =...;
// Depending on the option specified, not all fields must be filled PUKCL_RedMod(nu1ModBase) = <Base of the ram location of N>;
PUKCL_RedMod(u2ModLength) = <Length of N>;
PUKCL_RedMod(nu1CnsBase) = <Base of the ram location of Cns>;
... 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 816 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(RedMod,pvPUKCLParam);
if (PUKCL_Param.Status == PUKCL_OK)
// operation has correctly been performed
else // Manage the error 37.3.5.1.12 Constraints Depending on the options chosen the lengths of the R area and Cns area differ:
For the Setup:
RLength = 64bytes CnsLength = u2ModLength +12 For the Fast Reduction and Normalize:
RLength = u2ModLength +4 CnsLength = u2ModLength +8 For the BigRedMod:
RLength = u2ModLength +4 CnsLength =64 The following combinations of input values must be avoided in the case of a modular reduction alone, meaning that it has not been requested as an option of any other command:
nu1ModBase, nu1CnsBase, nu1RBase, nu1XBase are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2CnsLength}, {nu1XBase, 2*u2XLength + 8 + s} or
{nu1RBase, u2RLength} are not in Crypto RAM u2ModLength is either: < 4, > 0xffc or not a 32-bit length Overlaps exist between two or more of the areas: {nu1ModBase, u2ModLength + 4},{nu1CnsBase, u2CnsLength}, {nu1XBase, 2*u2XLength + 8 + s} or {nu1RBase, u2RLength}
Note:Overlaps between {nu1RBase, RLength} and {nu1XBase, 2*u2XLength + 8} are forbidden; but if the operation is the Fast, Normalized or Big Modular Reduction, the equality between nu1RBase and nu1XBase is authorized. 37.3.5.1.13 Status Returned Values Table 37-49. RedMod Service Return Codes Returned Status PUKCL_OK Importance Meaning Service functioned correctly PUKCL_DIVISION_BY_ZERO Severe When computing an Euclidean division, the Modulus was found to be zero. This occurs ONLY when either reducing using an Euclidean division or computing the reduction constant usable for a Fast or Normalize Reduction. PUKCL_UNEXPLOITABLE_OPTIONS Severe A bad combination of options has been detected. PUKCL_MALFORMED_MODULUS Severe The Msw of the modulus is not zero. 37.3.5.2 Modular Exponentiation (Without CRT) 37.3.5.2.1 Purpose This service is used to perform the Modular Exponentiation computation. This service processes integers in GF(p) only. The options available for this service are:
Fast implementation Regular implementation 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 817 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Exponent is located in Crypto RAM or not in Crypto RAM Exponent window size 37.3.5.2.2 How to Use the Service 37.3.5.2.3 Description Important:Before using these functions, ensure that the constant Cns has been calculated with the Setup of the Modular Reductions service. This service processes the following operation:
The service name for this operation is ExpMod. R = XExpmod(N) In this computation, the following parameters need to be provided:
X: input number (pointed by {nu1XBase,u2ModLength +16}) N: modulus (pointed by {nu1ModBase,u2ModLength +4}). Exp: exponent (pointed by {pfu1ExpBase,u2ExpLength +4}) Cns: Fast Modular Constant (pointed by {nu1CnsBase,u2ModLength +8}) Precomp: precomputation workspace (pointed by{nu1PrecompBase,PrecompLen}) Blinding: exponent blinding value (provided inu1Blinding) The length PrecompLen depends on the lengths and options chosen; its calculus is detailed in Options below. Note:The minimum value for u2ModLength is 12 bytes. Therefore, the significant length of N must be at least three 32-bit words. 37.3.5.2.4 Parameters Definition Table 37-50. ExpMod Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service Options (see below) Options (see below) Crypto RAM u2ModLength + 4 Base of N Base of N untouched Crypto RAM u2ModLength + 8 Base of Cns Base of Cns untouched Length of N Length of N Crypto RAM u2ModLength + 16 Base of X Base of X u2Options u2 nu1ModBase nu1CnsBase u2ModLength nu1XBase(1) nu1 nu1 u2 nu1 nu1PrecompBase nu1 I I I I I I Crypto RAM See below pfu1ExpBase(2) pfu1 I Any place(3) u2ExpLength + 4 u2ExpLength(4) u2 u1Blinding(5) u1 I I Filled with the result Base of Precomp as a workspace Base of Precomp workspace corrupted Base of the Exponent Base of the Exponent untouched Significant length of Exponent Significant length of Exponent Exponent unblinding value Exponent unblinding value untouched 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 818 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Notes:
1. 2. 3. 4. 5. This zone contains the number to be exponentiated (u2ModLength bytes) and is used during the computations as a workspace (four 32-bit words longer than the number to be exponentiated). At the end of the computation, it contains the correct result of the operation. The exponent must be given with a supplemental word on the LSB side (low addresses). This word shall be set to zero. If the PUKCL_EXPMOD_EXPINPUKCCRAM option is not set, the location of the exponent MUST NOT be the Crypto RAM, even partially. The u2ExpLength parameter does not take into account the supplemental word needed on the LSB side of the exponent. It is possible to mask the exponent in memory using an 8-bits XOR mask value. Be aware that not only the exponent, but also the supplemental word has to be masked. If masking is not desired, then this parameter must be set to 0. 37.3.5.2.5 Options The options are set by the u2Options input parameter, which is composed of:
the mandatory Calculus Mode Option described in Table 37-51 the mandatory Window Size Option described in Table 37-52 the indication of the presence of the exponent in Crypto RAM Note: Please check precisely if one part of the exponent is in Crypto RAM. If this is the case the PUKCL_EXPMOD_EXPINPUKCCRAM must be used. The u2Options number is calculated by an Inclusive OR of the options. Some examples in C language are:
Operation:Fast Modular Exponentiation with the window size equal to 1 and with no part of the Exponent in the Crypto RAM PUKCL(u2Options) = PUKCL_EXPMOD_FASTRSA | PUKCL_EXPMOD_WINDOWSIZE_1;
Operation: Regular Modular Exponentiation with the window size equal to 2 and with one part of the Exponent in the Crypto RAM PUKCL(u2Options) = PUKCL_EXPMOD_REGULARRSA | PUKCL_EXPMOD_WINDOWSIZE_2 |
PUKCL_EXPMOD_EXPINPUKCCRAM;
There is no difference on the final result when using any of the options for this service. The choice has to be made according to the available resources (RAM, Time) and also taking into account the expected security level. For this service, two exclusive Calculus Modes are possible. The following table describes the Calculus Mode Options. Table 37-51. ExpMod Service Calculus Mode Option Option Explanation PUKCL_EXPMOD_FASTRSA Performs a Fast computation PUKCL_EXPMOD_REGULARRSA Performs a Regular computation, slower than the Fast version, but using Regular calculus methods For this service, four window sizes are possible. The window size in bits is those of the windowing method used for the exponent. The choice of the window size is a balance between the size of the parameters and the computation time:
Increasing the window size increases the precomputation workspace. Increasing the window size reduces the computation time (may not be relevant for very small exponents). The following table details the size of the precomputation workspace, depending on the chosen window size option. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 819 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Table 37-52. ExpMode Service Window Size Options and Precomputation Space Size Option specified Size of the PrecompBase Workspace
(bytes) Content of the Workspace PUKCL_EXPMOD_WINDOWSIZE_1 3*(u2ModLength + 4) + 8 PUKCL_EXPMOD_WINDOWSIZE_2 4*(u2ModLength + 4) + 8 PUKCL_EXPMOD_WINDOWSIZE_3 6*(u2ModLength + 4) + 8 x x x3 x x3 x5 x7 PUKCL_EXPMOD_WINDOWSIZE_4 10*(u2ModLength + 4) + 8 x x3 x5 x7 x9 x11 x13 x15 The exponent can be located in RAM or in the data space. If one part of the exponent is in Crypto RAM this must be mandatory signaled by using the option PUKCL_EXPMOD_EXPINPUKCCRAM. The following table describes this option. Table 37-53. ExpMod Service Exponent in Crypto RAM Option Option Purpose PUKCL_EXPMOD_EXPINPUKCCRAM The exponent can be read from any data space of memory, including Flash, RAM or even Crypto RAM. When at least one word the exponent is in Crypto RAM, this option has to be set. 37.3.5.2.6 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL(u2Option) =...;
// Depending on the option specified, not all fields must be filled PUKCL_ExpMod(nu1ModBase) = <Base of the ram location of N>;
PUKCL_ExpMod(u2ModLength) = <Length of N>;
PUKCL_ExpMod(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL_ExpMod(nu1XBase) = <Base of the ram location of X>;
PUKCL_ExpMod(nu1PrecompBase) = <Base of the ram location of Precomp>;
PUKCL_ExpMod(pfu1ExpBase) = <Base of the location of Exp>;
PUKCL_ExpMod(u2ExpLength) = <Length of Exp>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ExpMod, pvPUKCLParam);
if (PUKCL_Param.Status == PUKCL_OK)
// operation has been performed correctly
else // Manage the error 37.3.5.2.7 Constraints The following combinations of input values must be avoided in the case of a modular reduction alone, meaning that it has not been requested as an option of any other command:
nu1ModBase,nu1CnsBase, nu1XBase,nu1PrecompBase,nu1ExpBase are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1XBase, u2ModLength +16},
{nu1PrecompBase, <PrecompLength>} are not in Crypto RAM
{nu1ExpBase,u2ExpLength + 4} has no part in Crypto RAM and PUKCL_EXPMOD_EXPINPUKCCRAM is specified u2ModLength or u2ExpLength are either: < 4, > 0xffc or not a 32-bit length None or both PUKCL_EXPMOD_REGULARRSA and PUKCL_EXPMOD_FASTRSA are specified.
{nu1PrecompBase,<PrecompLength>} overlaps with either: {nu1ModBase, u2ModLength +4},{nu1CnsBase, u2ModLength + 8} {nu1XBase, u2ModLength + 16} or {nu1ExpBase, u2ExpLength + 4}
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 820 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
{nu1XBase,u2ModLength + 16} overlaps with either: {nu1ModBase, u2ModLength + 4},{nu1CnsBase, u2ModLength + 8} or {nu1ExpBase, u2ExpLength + 4}
{nu1ModBase, u2ModLength + 4} overlaps {nu1CnsBase, u2ModLength +8}
37.3.5.2.8 Maximum Sizes for the Modular Exponentiation The following table provides the maximum sizes for the Modular Exponentiation, depending on the window size and the presence of the exponent in Crypto RAM. The figures below are calculated supposing that u2ExpLength =u2ModLength. In case of the PUKCL_EXPMOD_EXPINPUKCCRAM option is specified, for the computation of the maximum acceptable size, it is assumed the Exponent is entirely in the Crypto RAM and its length is equal to the Modulus one. Otherwise, the Exponent is entirely out of the Crypto RAM and so the computation do not depend on its length. Table 37-54. Maximum Exponentiation Sizes Option Specified Maximum Modulus Size (bytes) Maximum Modulus Size (bits) Exponent in Crypto RAM, 1 bit window Exponent in Crypto RAM, 2 bits window Exponent in Crypto RAM, 3 bits window Exponent in Crypto RAM, 4 bits window Exponent not in Crypto RAM, 1 bit window 576 504 400 284 672 Exponent not in Crypto RAM, 2 bits window 576 Exponent not in Crypto RAM, 3 bits window 448 Exponent not in Crypto RAM, 4 bits window 308 4608 4032 3200 2272 5376 4608 3584 2464 37.3.5.2.9 Status Returned Values Table 37-55. ExpMod Service Return Codes Returned Status Importance Meaning PUKCL_OK Service functioned correctly 37.3.5.3 Probable Prime Generation (Using Rabin-Miller) 37.3.5.3.1 Purpose This service is used to perform probable prime generation or test. This service processes integers in GF(p) only. The options available for this service are:
Choice of the number of iterations of the Rabin-Miller test Generation or Test of a probable prime number Fast Implementation Regular Implementation Exponent Window Size 37.3.5.3.2 Additional Information The Rabin-Miller test is a probable-primality testing algorithm. As a consequence, the primality of the generated number is not guaranteed at 100%, however, numerous publications have been issued explaining how to estimate the probability of getting a composite number, giving the size of the number and the number of iterations (the T parameter). Useful information can be found in the Handbook of Applied Cryptography (Discrete Mathematics and Its Applications by Alfred J. Menezes, Paul C. van Oorschot, and Scott A. Vanstone, in the following sections:
4.2.3. Rabin-Miller Test 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 821 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 4.4. Prime Number Generation 37.3.5.3.3 How to Use the Service 37.3.5.3.4 Description This service processes a test for probable primality or a generation of a probable prime number. Note: When using this service be sure to follow the directives given for the RNG on the chip you use (particularly initialization, seeding) and compulsorily start the RNG. This service processes one of the following operations: CheckProbablePrimality(N) or N = GenerateProbablePrimeFromSeed (NSeed) In this computation, the following parameters need to be provided:
N the input number (pointed by {nu1NBase,u2NLength +4}) If the requested operation is a test, it is untouched after the operation. If the requested operation is a generation and a probable prime number was found before reaching the Maximum Increment, it contains the resulting probable prime after the operation. If the requested operation was a generation and Maximum Increment was reached before a probable prime number was found, it contains no relevant information. Cns as a workspace (pointed by {nu1CnsBase,u2NLength +12}) Rnd as a workspace (pointed by {nu1RndBase,u2NLength +16}) Precomp the precomputation workspace (pointed by{nu1PrecompBase,PrecompLen}) Exp as a workspace (pointed by {pfu1ExpBase,u2ExpLength +4}) u1MillerRabinIterations the number of Miller Rabin Iterations requested u2MaxIncrement, maximum increment of the number in case of probable prime generation The length PrecompLen depends on the lengths and options chosen; its calculus is detailed in Options below. The service name for this operation is PrimeGen. 37.3.5.3.5 Parameters Definition Table 37-56. PrimeGen Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1NBase(1) nu1CnsBase u2NLength nu1RndBase nu1PrecompBase nu1RBase(2) nu1ExpBase(3) u1MillerRabin-Iterations u2MaxIncrement nu1 nu1 u2 nu1 nu1 I I I I I Crypto RAM u2NLength + 4 Base of N Number to test or Seed for the generation Base of N unchanged if test or generation result(2) Crypto RAM u2NLength + 12 Base of Cns as a workspace Base of Cns workspace corrupted Length of N Length of N Crypto RAM Max (u2NLength +
Internal Workspace 16,64) Crypto RAM See Options below Base of Precomp workspace Internal Workspace corrupted Base of Precomp workspace corrupted nu1 Crypto RAM nu1 u1 u2 I I I Crypto RAM u2NLength + 4 Base of Exponent (R) Base of Exponent (R) Miller Rabins T parameter Miller Rabins T parameter Maximum Increment(4) Maximum Increment 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 822 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Notes:
1. 1. 2. 3. This zone contains the number to be either tested or used as a seed for generation. It has to be provided with one zero word on the MSB side. This area has supplementary constraints (see the following Important note). This parameter does not have to be provided and is used as an internal value for computing the reductions constant. The area {nu1ExpBase, u2NLength + 4} must be entirely in the Crypto RAM. The generation starts from the number in {nu1NBase,u2NLength + 4} and increments it until a number is found as probable prime. However, the generation may stop for two reasons: The number has been incremented in a way it is bigger than <u2NLength> bytes, or the original number has been incremented by more than
<u2MaxIncrement>. In case of probable prime generation, ensure that the addition of NSeed and Maximum Increment is not a number with more bytes than u2NLength, as this would produce an overflow. Important:
One additional word is used on the LSB side of the NBase parameter; this word is restored at the end of the calculus. As a consequence, the parameter nu1NBase must never be at the beginning of the Crypto RAM, but at least at one word from the beginning. One additional word is used on the MSB side of the NBase parameter; this word is not corrupted. As a consequence the Area {nu1NBase, u2NLength} must not be at the end of the Crypto RAM but at least at one word from the end. Prime numbers of a size lower than 96 bits (three 32-bit words) cannot be generated or tested by this service. 37.3.5.3.6 Options Some of the Prime Generation options configure the Modular Exponentiation steps and so are very similar to the Modular Exponentiation options. The options are set by the u2Options input parameter, which is composed of:
the mandatory Operation Option described in Table 37-57 the mandatory Calculus Mode Option described in Table 37-58 the mandatory Window Size Option described in Table 37-59 The u2Options number is calculated by an Inclusive OR of the options. Some Examples in C language are:
Operation: Probable Prime Testing with Fast Modular Exponentiation and the window size equal to 1 PUKCL(u2Options) = PUKCL_PRIMEGEN_TEST | PUKCL_EXPMOD_FASTRSA |
PUKCL_EXPMOD_WINDOWSIZE_1;
Operation: Probable Prime Generate with Regular Modular Exponentiation and the window size equal to 2 PUKCL(u2Options) = PUKCL_EXPMOD_REGULARRSA | PUKCL_EXPMOD_WINDOWSIZE_2;
The following table describes the PrimeGen service features available from the various options. Table 37-57. PrimeGen Service Options Option Method Used PUKCL_PRIMEGEN_TEST This option is used to specify that only tests will be made on the provided number. When this option is not specified, a prime generation algorithm is selected, starting from the given seed and incrementing it. PUKCL_EXPMOD_WINDOWSIZE_1,2,3 or 4 Depending on this option, different bit-window sizes will be used. For long exponents, the bigger the window, the faster the computation. However, this has also an impact on the size of the precomputations table. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 823 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) For this service, two exclusive Calculus Modes are possible. The following table describes the Calculus Mode Options. Table 37-58. PrimeGen Service Calculus Mode Options Option Explanation PUKCL_EXPMOD_FASTRSA Perform a Fast computation. PUKCL_EXPMOD_REGULARRSA Performs a Regular computation, slower than the Fast version, but using regular calculus methods. The length of the Precomp area depends on the window size W and u2NLength. The Precomp area length is:
PrecompLen = max( 2*(u2NLength + 4) + 2W-1 * (u2NLength + 4), u2NLength + 8 + 64) + 8 Note:Please calculate precisely the length PrecompLen with the formula and the max() macro, which takes a maximum of two values. The following table shows the size of the precomputation workspace (PrecompLen), depending on the chosen window size option. Table 37-59. PrimeGen Service Precomputation Space Size Option Specified Size of the PrecompBase Workspace
(bytes) Content of the Workspace PUKCL_EXPMOD_WINDOWSIZE_1 max( 3*(u2NLength + 4), u2NLength + 72) + 8 x PUKCL_EXPMOD_WINDOWSIZE_2 max( 4*(u2NLength + 4), u2NLength + 72) + 8 PUKCL_EXPMOD_WINDOWSIZE_3 max( 6*(u2NLength + 4), u2NLength + 72) + 8 x x3 x x3 x5 x7 PUKCL_EXPMOD_WINDOWSIZE_4 max( 10*(u2NLength + 4) u2NLength + 72) + 8 x x3 x5 x7 x9 x11 x13 x15 The following table provides the maximum sizes for the Prime Generation depending on the window size. Table 37-60. PrimeGen Service Maximum Sizes Characteristics of the Operation Maximum Prime Sizes (bits) 1 bit window 2 bits window 3 bits window 4 bits window 4608 4032 3200 2272 37.3.5.3.7 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL(u2Option) =...;
// Depending on the option specified, not all fields must be filled PUKCL_PrimeGen(nu1NBase) = <Base of the ram location of N>;
PUKCL_PrimeGen(u2NLength) = <Length of N>;
PUKCL_PrimeGen(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL_PrimeGen(nu1PrecompBase) = <Base of the ram location of Precomp>;
PUKCL_PrimeGen(pfu1ExpBase) = <Base of the location of Exp>;
PUKCL_PrimeGen(u2ExpLength) = <Length of Exp>;
PUKCL_PrimeGen(u1MillerRabinIterations) = <Number of iterations>;
PUKCL_PrimeGen(u2MaxIncrement) = <Maximum Increment>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(PrimeGen, pvPUKCLParam);
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 824 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) if (PUKCL_Param.Status == PUKCL_NUMBER_IS_PRIME)
// The number is probably prime
else if (PUKCL_Param.Status == PUKCL_NUMBER_IS_NOT_PRIME)
// The number is not prime
else // Manage the error 37.3.5.3.8 Constraints The following combinations of input values must be avoided in the case of a modular reduction alone, meaning that it has not been requested as an option of any other service:
nu1NBase,nu1CnsBase, nu1RndBase,nu1PrecompBase,nu1ExpBase are not aligned on 32-bit boundaries
{nu1NBase, u2NLength + 4}, {nu1CnsBase, u2NLength + 12}, {nu1RndBase, u2NLength +12},
{nu1PrecompBase, <PrecompLength>} are not in Crypto RAM u2NLength is either: < 12, > 0xffc or not a 32-bit length Both PUKCL_EXPMOD_REGULARRSA and PUKCL_EXPMOD_FASTRSA are specified.
{nu1PrecompBase,<PrecompLength>} overlaps with either: {nu1NBase, u2NLength + 4},{nu1CnsBase, u2NLength + 12} {nu1RndBase, u2NLength + 12} or {nu1ExpBase, u2ExpLength + 4}
{nu1RndBase,3*u2NLength + 24} overlaps with either: {nu1NBase, u2NLength + 4},{nu1CnsBase, u2NLength +
12} {nu1XBase, u2NLength + 12} or {nu1ExpBase, u2ExpLength + 4}
{nu1NBase, u2NLength + 4} overlaps {nu1CnsBase, u2NLength +12}
37.3.5.3.9 Status Returned Values Table 37-61. PrimeGen Service Return Codes Returned Status Importance Meaning PUKCL_NUMBER_IS_PRIME Information The generated or tested number has been detected as probably prime. PUKCL_NUMBER_IS_NOT_PRIME Information The generated or tested number has been detected as composite. 37.3.5.4 Modular Exponentiation (With CRT) 37.3.5.4.1 Purpose The purpose of this service is to perform the Modular Exponentiation with the Chinese Remainders Theorem (CRT). This service processes integers in GF(p) only. The options available for this service are:
Fast implementation Regular implementation Exponent is located in Crypto RAM or not Exponent window size 37.3.5.4.2 How to Use the Service 37.3.5.4.3 Description This service processes a Modular Exponentiation with the Chinese Remainder Theorem:
R = XDmod(N) with N = P *Q Important: For this service, be sure to follow the directives given for the RSA implementation on the chip you use. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 825 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) This service requires that the modulus N is the product of two co-primes P and Q and that the decryption exponents D is co-prime with the product ((P-1)*(Q-1)). The Input data are P, Q, EP, EQ, Rvalue, and X. P and Q are the co-primes so that N = P*Q. X is the number to exponentiate. EP, EQ and Rval are calculated as follows:
EP = Dmod(P 1) EQ = Dmod(Q 1) Rval = P1mod(Q) In some cases, the decryption exponent D may not be available and the encryption exponent E may be available instead. The possibilities to calculate the parameters are:
Calculate D from E with the formula:
D = E1mod((P 1) (Q 1)) Calculate the parameters from E:
EP = E1mod(P 1) EQ = E1mod(Q 1) Rval = P1mod(Q) In this computation, the following parameters need to be provided:
X the input number (pointed by {nu1XBase,2*u2ModLength +16}) P and Q the primes (pointed by {nu1ModBase,2*u2ModLength +8}). EP and EQ the reduced exponents (pointed by {pfu1ExpBase,2*u2ExpLength +8}) Rval and Precomp (pointed by{nu1PrecompBase,RAndPrecompLen}) Blinding the exponent blinding value (provided inu1Blinding) The length RAndPrecompLen depends on the lengths and options chosen; its calculus is detailed in Options below. The service for this operation is CRT. Note:The minimum value for u2ModLength is 12 bytes. Therefore, the significant length of P or Q must be at least three 32-bit words. 37.3.5.4.4 Parameters Definition The following table shows the parameter block for the CRT service. Many parameters have complex placement in memory; therefore, detailed figures are provided in CRT Service Placement below. Table 37-62. CRT Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service u2Options u2 nu1ModBase nu1 u2ModLength u2 nu1XBase(1) nu1 nu1PrecompBase nu1 I I I I I Options (see below) Crypto RAM 2*u2ModLength + 8 Base of P, Q Length of P or Q greater than or equal to 12 Options (see below) Base of P, Q untouched Length of P or Q Crypto RAM 2*u2ModLength +
16 Base of X Base of X Filled with the result Crypto RAM See Options below Base of Rvalue Corrupted and Pre computations workspace pfu1ExpBase(2) pfu1 I Any place 2*u2ExpLength + 8 Base of EP, EQ Base of EP, EQ untouched 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 826 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Parameter Type Direction Location Data Length u2ExpLength u1Blinding(3) u2 u4 I I Before Executing the Service After Executing the Service Significant length of EP or EQ Significant length of EP or EQ Exponent unblinding value Exponent unblinding value Notes:
1. 2. 3. This zone contains the number to be exponentiated (u2ModLength bytes) and is used during the computations as a workspace (four 32-bit words longer than the number to be exponentiated). At the end of the computation, it contains the correct result of the operation. If the PUKCL_EXPMOD_EXPINPUKCCRAM option is not set, the location of the exponent MUST NOT be placed in the Crypto RAM, even partially. It is possible to mask the exponent in memory using a 32-bit XOR mask value. Be aware that not only the exponent, but also the supplemental spill word has to be masked. If masking is not desired, the parameter must be set to 0. 37.3.5.4.5 Options Most of the CRT options configure the Modular Exponentiation steps of the CRT and so are very similar to the Fast Modular Exponentiation options. The options are set by the u2Options input parameter, which is composed of:
the mandatory Calculus Mode Option described in Table 37-63 the mandatory Window Size Option described in Table 37-64 the indication of the presence of the exponent in Crypto RAM Important:Please check precisely if one part of the exponent area (containing EP and EQ) is in Crypto RAM. If this is the case, the PUKCL_EXPMOD_EXPINPUKCCRAM option must be used. The u2Options number is calculated by an Inclusive OR of the options. Some Examples in C language are:
Operation: CRT using the Fast Modular Exponentiation with the window size equal to 1 and with no part of the Exponent area in the Crypto RAM PUKCL(u2Options) = PUKCL_EXPMOD_FASTRSA | PUKCL_EXPMOD_WINDOWSIZE_1;
Operation:CRT using the Regular Modular Exponentiation with the window size equal to 2 and with one part the Exponent area in the Crypto RAM PUKCL(u2Options) = PUKCL_EXPMOD_REGULARRSA | PUKCL_EXPMOD_WINDOWSIZE_2 |
PUKCL_EXPMOD_EXPINPUKCCRAM;
For this service, two exclusive Calculus Modes for the Modular Exponentiation steps of the CRT are possible. The following table describes the Calculus Mode Options. Table 37-63. CRT Service Calculus Mode Options Option Explanation PUKCL_EXPMOD_FASTRSA Perform a Fast computation. PUKCL_EXPMOD_REGULARRSA Performs a Regular computation, slower than the Fast version, but using regular calculus methods. For this service, four window sizes for the Modular Exponentiation Steps are possible. The window size in bits is those of the windowing method used for the exponent. The choice of the window size is a balance between the size of the parameters and the computation time:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 827 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Increasing the window size increases the precomputation workspace. Increasing the window size reduces the computation time (may not be relevant for very small exponents). The length of the Rval and Precomp area depends on the window size W and u2ModLength. The Rval and Precomp area length is:
RandPrecompLen = 4 * (u2ModLength + 4) + max(64 , 2(W-1) * (u2ModLength + 4)) + 8 Important:Please calculate precisely the length RandPrecompLen with the formula and the max() macro, which takes the maximum of two values. The following table shows the size of the Rval and Precomp area, depending on the chosen window size option. Table 37-64. CRT Service Window Size Options and Rval and Precomp Area Size Option Specified Size of the Rval and Precomp Area (bytes) Precomputation Values PUKCL_EXPMOD_WINDOWSIZE_1 4*(u2ModLength + 4) + max(64 , (u2ModLength +
x 4)) + 8 PUKCL_EXPMOD_WINDOWSIZE_2 4*(u2ModLength + 4) + max(64 , 2*(u2ModLength x x3
+ 4)) + 8 PUKCL_EXPMOD_WINDOWSIZE_3 4*(u2ModLength + 4) + max(64 , 4*(u2ModLength x x3 x5 x7
+ 4)) + 8 PUKCL_EXPMOD_WINDOWSIZE_4 10*(u2ModLength + 4) + max(64 , x x3 x5 x7 x9 x11 x13 x15 8*(u2ModLength + 4)) + 8 The exponent area can be located in RAM or in the data space. If one part of the exponent area is in Crypto RAM this must be mandatory signaled by using the PUKCL_EXPMOD_EXPINPUKCCRAM option. The following table describes this option. Table 37-65. CRT Service Crypto RAM Option Exponent Area Option Purpose PUKCL_EXPMOD_EXPINPUKCCRAM The exponent area can be read from any data space of memory, including Crypto RAM. When at least one word the exponent is in Crypto RAM, this option has to be set. 37.3.5.4.6 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL(u2Option) =...;
// Depending on the option specified, not all fields must be filled PUKCL_CRT(nu1ModBase) =
<Base of the ram location of P and Q>; PUKCL_CRT(u2ModLength) = <Length of P or Q>;
PUKCL_CRT(nu1XBase) = <Base of the ram location of X>;
PUKCL_CRT(nu1PrecompBase) = <Base of the ram location of RVal and Precomp>;
PUKCL_CRT(pfu1ExpBase) = <Base of the ram location of EP and EQ>;
PUKCL_CRT(u2ExpLength) = <Length of EP or EQ>;
PUKCL_CRT(u1Blinding) = <Blinding value>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(CRT, pvPUKCLParam);
if (PUKCL_Param.Status == PUKCL_OK)
// operation has been performed correctly
... 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 828 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
else // Manage the error 37.3.5.4.7 Constraints The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1XBase, nu1PrecompBase, pfu1ExpBase are not aligned on 32-bit boundaries
{nu1XBase, 2*u2ModLength + 16}, {nu1ModBase, 2*u2ModLength + 8},{nu1PrecompBase,<PrecompLength>}
are not in Crypto RAM
{nu1ExpBase,2*u2ExpLength + 8} is not in Crypto RAM and PUKCL_EXPMOD_EXPINPUKCCRAM is specified u2ModLength or u2ExpLength are either: < 4, > 0xffc or not a 32-bit length None or both PUKCL_EXPMOD_REGULARRSA and PUKCL_EXPMOD_FASTRSA are specified.
{nu1XBase,2*u2ModLength + 16} overlaps with either: {nu1ModBase, 2*u2ModLength +8},{nu1PrecompBase,
<PrecompLength>} or {pfu1ExpBase, 2*u2ExpLength + 8}
{nu1ModBase,2*u2ModLength + 8} overlaps with either: {nu1PrecompBase, <PrecompLength>} or
{pfu1ExpBase, 2*u2ExpLength + 8}
{nu1PrecompBase, <PrecompLength>} overlaps {pfu1ExpBase, 2*u2ExpLength +8}
37.3.5.4.8 CRT Service Parameter Placement The parameters placements are described in detail in the following figures. Figure 37-2. Modulus P and Q in {nu1ModBase, 2*u2ModLength + 8}
Figure 37-3. Value X in {nu1XBase, 2*u2ModLength + 16}
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 829 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Figure 37-4. Exponents EP and EQ in {fnu1ExpBase, 2*u2ExpLength + 8}
Figure 37-5. Value Rval and Precomp in {nu1PrecompBase, RandPrecompLen}
37.3.5.4.9 CRT Service Modular Exponentiation Maximum Size The following table details the maximum size in bits of P or Q, of N and of EP or EQ. The maximum size in bits of P or Q equals:
<Max Size Bits P> = <Max Size Bits Q> = 8 * <Max u2ModLength bytes>
The maximum size in bits of N=P*Q equals:
<Max Size Bits N> = 2 * <Max Size Bits P>
The maximum size in bits of EP or EQ equals:
<Max Size Bits EP> = <Max Size Bits EQ> = 8 * <Max u2ExpLength bytes>
In case of the PUKCL_EXPMOD_EXPINPUKCCRAM option is specified, for the computation of the maximum acceptable size, it is assumed the Exponent is entirely in the Crypto RAM and its length equal the Modulus one. Otherwise, the Exponent is entirely out of the Crypto RAM and so the computation do not depend on its length. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 830 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Table 37-66. CRT Service Maximum Sizes Characteristics of the Operation P or Q Max Bit Sizes N Max Bit Sizes EP or EQ Max Bit Sizes Exponent in Crypto RAM, 1 bit window Exponent in Crypto RAM, 2 bits window Exponent in Crypto RAM, 3 bits window Exponent in Crypto RAM, 4 bits window 2912 2688 2464 2304 Exponent not in Crypto RAM, 1 bit window 3584 Exponent not in Crypto RAM, 2 bits window 3232 Exponent not in Crypto RAM, 3 bits window 2912 Exponent not in Crypto RAM, 4 bits window 2688 5824 5376 4928 4608 7168 6464 5824 5376 2912 2688 2464 2304
<application dependent>
<application dependent>
<application dependent>
<application dependent>
37.3.5.4.10 Status Returned Values Table 37-67. CRT Service Return Codes Returned Status PUKCL_OK Importance Information Meaning Service functioned correctly 37.3.6 Elliptic Curves Over GF(p) Services This section provides a complete description of the currently available elliptic curve over Prime Fields services. These services process integers in GF(p) only. The offered services cover the basic operations over elliptic curves such as:
Adding two points over a curve Doubling a point over a curve Multiplying a point by an integral constant Converting a points projective coordinates (resulting from a doubling or an addition) to the affine coordinates, and oppositely converting a points affine coordinates to the projective coordinates. Testing the point presence on the curve. Additionally, some higher level services covering the needs for signature generation and verification are offered:
Generating an ECDSA signature (compliant with FIPS186-2) Verifying an ECDSA signature (compliant with FIPS186-2) The supported curves use the following curve equation:
Y2 = X3 + aX + b 37.3.6.1 Coordinate Systems Related Links 37.3.5.1. Modular Reduction 37.3.6.1.1 General Considerations In this implementation, several choices have been made related to the coordinate systems managed by the elliptic curve primitives. There are two systems currently managed by the library:
Affine Coordinates System where each curve point has two coordinates (X, Y) Projective Coordinates System where each point is represented with three coordinates (X,Y, Z) Converting from the affine coordinates system to a projective coordinates system is performed by extending its representation with Z = 1:
(X, Y) (X, Y, Z= 1) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 831 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Converting from a projective coordinate to an affine one is a service offered by the PUKCL. The formula to perform this conversion is:
(X, Y, Z) (X / Z2, Y / Z3) 37.3.6.1.2 Points Representations Depending on the representation (Projective or Affine), points are represented tn memory, as shown in the following figure. Figure 37-6. Points Representation in Memory In this figure, the modulus is represented as a reference, and to show that coordinates are always to be provided on the length of the modulus plus one 32-bit word. The different types of representations are as follows:
Notes:
1. 2. The minimum value for u2ModLength is 12 bytes. Therefore, the significant length of the modulus must be at least three 32-bit words. In some cases the point can be the infinite point. In this case, it is represented with its Z coordinates equal or congruent to zero. 37.3.6.1.3 Modulus and Modular Constant Parameters In most of the services the following parameters must be provided:
P the Modulus (often pointed by {nu1ModBase,u2ModLength + 4}): This parameter contains the Modulus Integer prime P defining the Galois Field used in points coordinates computations. The Modulus must be u2ModLength bytes long, while having a supplemental zeroed 32-bit word on the MSB side. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 832 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Note:Most of the Elliptic Curve computations are reduced modulo P. In many functions the reductions are made with the Fast Reduction. Cns the Modular Constant (often pointed by {nu1CnsBase,u2ModLength + 12}): This parameter contains the Modular Constant associated to the Modulus Important:The Modular Constant must be calculated before using the GF(p) Elliptic Curves functions by a call to the Setup for Modular Reductions with the GF(p) option (see Modular Reduction Setup in the Modular Reduction from Related Links). 37.3.6.2 Point Addition 37.3.6.2.1 Purpose This service is used to perform a point addition, based on a given elliptic curve over GF(p). Please note that:
This service is not intended to add the same point twice. In this particular case, use the doubling service
(see 37.3.6.4. Fast Point Doubling). 37.3.6.2.2 How to Use the Service 37.3.6.2.3 Description The operation performed is:
PtC = PtA + PtB In this computation, the following parameters need to be provided:
A the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointABase,3*u2ModLength + 12}). This point can be the Infinite Point. B the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointBBase,3*u2ModLength + 12}). This point can be the Infinite Point. Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength +8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength +4}) The workspace not initialized (pointed by {nu1WorkSpace, 5*u2ModLength +32}
The resulting C point is represented in projective coordinates (X,Y,Z) and is stored at the very same place than the input point A. This Point can be the Infinite Point. The service name for this operation is ZpEccAddFast. This service uses Fast mode and Fast Modular Reduction for computations. Important:Before using this service, ensure that the constant Cns has been calculated with the Setup of the Modular Reduction functions. 37.3.6.2.4 Parameters Definition Table 37-68. ZpEccAddFast Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase nu1 nu1 u2ModLength u2 I I I Crypto RAM u2ModLength + 4 Base of Modulus P Base of Modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulo Length of modulo nu1PointABase nu1 I/O Crypto RAM 3*u2ModLength + 12 Input point A (projective coordinates) Resulting point C (projective coordinates) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 833 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1PointBBase nu1 nu1Workspace nu1 I I Crypto RAM 3*u2ModLength + 12 Input point Input point B B (projective coordinates) Crypto RAM 5*u2ModLength + 32 Corrupted workspace 37.3.6.2.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL (u2Option) = 0;
PUKCL _ZpEccAdd(nu1ModBase) = <Base of the ram location of P>;
PUKCL _ZpEccAdd(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _ZpEccAdd(u2ModLength) = <Byte length of P>;
PUKCL _ZpEccAdd(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL _ZpEccAdd(nu1PointBBase) = <Base of the ram location of the B point>;
PUKCL _ZpEccAdd(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEccAddFast,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.6.2.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1PointBBase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12},
{nu1PointBBase, 3*u2ModLength + 12}, {nu1Workspace, <WorkspaceLength>} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8},{nu1PointABase, 3*u2ModLength + 12}, {nu1PointBBase, 3*u2ModLength + 12} and {nu1Workspace, 5*u2ModLength + 32}
37.3.6.2.7 Status Returned Values Table 37-69. ZpEccAddFast Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 37.3.6.3 Point Addition and Subtraction 37.3.6.3.1 Purpose This service is used to perform a point addition and point subtraction, based on a given elliptic curve over GF(p). Please note that:
This service is not intended to add the same point twice. In this particular case, use the doubling service (see 37.3.6.4. Fast Point Doubling). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 834 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.6.3.2 How to Use the Service 37.3.6.3.3 Description The operation performed is:
PtC = PtA PtB In this computation, the following parameters need to be provided:
A the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointABase,3*u2ModLength + 12}). This point can be the Infinite Point. B the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointBBase,3*u2ModLength + 12}). This point can be the Infinite Point. Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength +8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength +4}) The workspace not initialized (pointed by {nu1WorkSpace, 5*u2ModLength +32}
The operator filled with the operation to perform (Addition or Subtraction) The resulting C point is represented in projective coordinates (X,Y,Z) and is stored at the very same place than the input point A. This Point can be the Infinite Point. The service name for this operation is ZpEccAddSubFast. This service uses Fast mode and Fast Modular Reduction for computations. Note: Before using this service, ensure that the constant Cns has been calculated with the setup of the modular reduction functions. 37.3.6.3.4 Parameters Definition Table 37-70. ZpEccAddSubFast Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase nu1 nu1 u2ModLength u2 I I I Crypto RAM u2ModLength + 4 Base of Modulus P Base of Modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulo Length of modulo nu1PointABase nu1 I/O Crypto RAM 3*u2ModLength + 12 Input point A (projective coordinates) Resulting point C (projective coordinates) nu1PointBBase nu1 u2Operator u2 nu1Workspace nu1 I I I Crypto RAM 3*u2ModLength + 12 Input point Input point B
B (projective coordinates) Addition or Subtraction Crypto RAM 5*u2ModLength + 32 Addition or Subtraction Corrupted workspace 37.3.6.3.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL (u2Option) = 0;
PUKCL _ZpEccAddSub(nu1ModBase) = <Base of the ram location of P>;
PUKCL _ZpEccAddSub(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _ZpEccAddSub(u2ModLength) = <Byte length of P>;
PUKCL _ZpEccAddSub(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL _ZpEccAddSub(nu1PointBBase) = <Base of the ram location of the B point>;
PUKCL _ZpEccAddSub(nu1Workspace) = <Base of the ram location of the workspace>;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 835 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) PUKCL _ZpEccAddSub(u2Operator) = <Operation to perform (PUKCL_ZPECCADD or PUKCL_ZPECCSUB)>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEccAddSubFast,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.6.3.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1PointBBase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12},
{nu1PointBBase, 3*u2ModLength + 12}, {nu1Workspace, <WorkspaceLength>} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8},{nu1PointABase, 3*u2ModLength + 12}, {nu1PointBBase, 3*u2ModLength + 12} and {nu1Workspace, 5*u2ModLength + 32}
37.3.6.3.7 Status Returned Values Table 37-71. ZpEccAddFast Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 37.3.6.4 Fast Point Doubling 37.3.6.4.1 Purpose This service is used to perform a Point Doubling, based on a given elliptic curve over GF(p). 37.3.6.4.2 How to Use the Service 37.3.6.4.3 Description These two services process the Point Doubling:
PtC = 2 PtA In this computation, the following parameters need to be provided:
A the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointABase,3*u2ModLength + 12}). This point can be the Infinite Point. Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength +8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength +4}) The workspace not initialized (pointed by {nu1WorkSpace, 4*u2ModLength +28}
The a parameter relative to the elliptic curve (pointed by {nu1ABase,u2ModLength +4}) The resulting C point is represented in projective coordinates (X,Y,Z) and is stored at the same location than the input point A. This point can be the Infinite Point. The service name for this operation is ZpEccDblFast. This service uses Fast mode and Fast Modular Reduction for computations. Important:Before using this service, ensure that the constant Cns has been calculated with the setup of the Fast Modular Reduction service. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 836 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.6.4.4 Parameters Definition Table 37-72. ZpEccDblFastService Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase u2ModLength nu1ABase nu1 nu1 u2 u2 I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM u2ModLength + 4 Parameter a of the elliptic curve Parameter a of the elliptic curve nu1PointABase nu1 I/O Crypto RAM 3*u2ModLength + 12 Input point A (projective coordinates) nu1Workspace nu1 I Crypto RAM 4*u2ModLength + 28 Resulting point C (projective coordinates) Corrupted workspace 37.3.6.4.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL (u2Option) = 0;
PUKCL _ZpEccDbl(nu1ModBase) = <Base of the ram location of P>;
PUKCL _ZpEccDbl(u2ModLength) = <Byte length of P>;
PUKCL _ZpEccDbl(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _ZpEccDbl(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL _ZpEccDbl(nu1ABase) = <Base of the a parameter of the elliptic curve>;
PUKCL _ZpEccDbl(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEccDblFast,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.6.4.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1ABase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength+ 12},
{nu1ABase, u2ModLength + 4}, {nu1Workspace, <WorkspaceLength>} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1ABase, u2ModLength + 4} and {nu1Workspace, 4*u2ModLength + 28}
37.3.6.4.7 Status Returned Values Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 837 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.6.5 Fast Multiplying by a Scalar Number of a Point 37.3.6.5.1 Purpose This service is used to multiply a point by an integral constant K on a given elliptic curve over GF(p). 37.3.6.5.2 How to Use the Service 37.3.6.5.3 Description These two services process the Multiplying by a scalar number:
PtC = K PtA In this computation, the following parameters need to be provided:
A the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointABase,3*u2ModLength + 12}). This point can be the Infinite Point. Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength +8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength +4}) The workspace not initialized (pointed by {nu1WorkSpace, 8*u2ModLength +44}
The a parameter relative to the elliptic curve (pointed by {nu1ABase,u2ModLength +4}) K the scalar number (pointed by {nu1ScalarNumber,u2ScalarLength +4}) The resulting C point is represented in projective coordinates (X,Y,Z) and is stored at the very same place than the input point A. This point can be the Infinite Point. The service name for this operation is ZpEccMulFast. This service uses Fast mode and Fast Modular Reduction for computations. Note: Before using this service, ensure that the constant Cns has been calculated with the setup of the Fast Modular Reduction service. 37.3.6.5.4 Parameters Definition Table 37-73. ZpEccMulFast Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase nu1 nu1 u2ModLength u2 nu1KBase nu1 u2KLength u2 I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM u2KLength Scalar number used to multiply the point A Unchanged Length of scalar K Length of scalar K nu1PointABase nu1 I/O Crypto RAM 3*u2ModLength + 12 Input point nu1ABas nu1 nu1Workspace nu1 I I Crypto RAM u2ModLength + 4 A (projective coordinates) Parameter a of the elliptic curve Crypto RAM 8*u2ModLength + 44 Resulting point C (projective coordinates) Unchanged Corrupted workspace 37.3.6.5.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL (u2Option) = 0;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 838 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) PUKCL _ZpEccMul(nu1ModBase) = <Base of the ram location of P>;
PUKCL _ZpEccMul(u2ModLength) = <Byte length of P>;
PUKCL _ZpEccMul(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _ZpEccMul(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL _ZpEccMul(nu1ABase) = <Base of the ram location of the parameter A of the elliptic curve>;
PUKCL _ZpEccMul(nu1KBase) = <Base of the ram location of the scalar number>;
PUKCL _ZpEccMul(nu1Workspace) = <Base of the ram location of the workspace>;
PUKCL_ZpEccMul(u2KLength) = <Byte length of the Scalar Number K>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEccMulFast,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.6.5.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase,nu1CnsBase, nu1PointABase, nu1ABase, nu1ScalarNumber, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength+ 12},
{nu1ABase, u2ModLength + 4}, {nu1ScalarNumber, u2ScalarLength} or {nu1Workspace, 8*u2ModLength + 44}
are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1ABase, u2ModLength + 4}, {nu1ScalarNumber, u2ScalarLength} and
{nu1Workspace, 8*u2ModLength + 44}
37.3.6.5.7 Status Returned Values Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 37.3.6.6 Quick Dual Multiplying by Two Scalar Numbers and Two Points 37.3.6.6.1 Purpose This service is used to multiply two points by two integral constants K1 and K2, and then provide the addition of these multiplications results. Important: This service has a quick implementation without additional security. 37.3.6.6.2 How to Use the Service 37.3.6.6.3 Description This service processes the dual Multiplying by two scalar numbers:
PtC = K1 PtA + K2 PtB In this computation, the following parameters need to be provided:
A the first input point is filled in projective coordinates (X,Y,Z) (pointed by {pu1PointABase,(3*(u2ModLength +
4)) * (2(WA-2))}). This point can be the Infinite Point. B the 2nd input point is filled in projective coordinates (X,Y,Z) (pointed by {pu1PointBBase,(3*(u2ModLength +
4)) * (2(WB-2))}). This point can be the Infinite Point. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 839 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) P the modulus filled and Cns the Fast Modular Constant filled (pointed by {pu1ModCnsBase,2*u2ModLength +
16}) The a parameter filled and the workspace not initialized (pointed by {pu1AWorkBase, 9*u2ModLength +48}
KAB the scalar numbers (pointed by {pu1KABBase, 2*u2KLength +8}) The options are set by the u2Options input parameter, which is composed of:
wA: Size of window for Point A between 2 and15 wB: Size of window for Point B between 2 and15 PUKCL_ZPECCMUL_SCAL_IN_CLASSIC_RAM flag: to set only if the scalars are entirely in Classic RAM with no part in PUKCC RAM The resulting C point is represented in projective coordinates (X,Y,Z) and is stored at (pu1AWorkBase +
u2ModLength + 4). This point can be the Infinite Point. Important:Before using this service, ensure that the constant Cns has been calculated with the setup of the Fast Modular Reduction service. 37.3.6.6.4 Parameters Definition WA is the Point A window size and WB is the Point B window size (see Options below for details). Important:Please calculate precisely the length of areas with the formulas. Ensure that the pu1 type is a pointer on 4 bytes and contains the full address (see 37.3.3.4. Aligned Significant Length ). Table 37-74. ZpEccQuickDualMulFast Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service pu1ModCnsBase pu1 u2Option u2 u2ModLength u2 pu1KABBase pu1 u2KLength u2 I I I I I pu1PointABase pu1 I/O pu1PointBBase pu1 I Crypto RAM 2 * u2ModLength +
16 Base of modulus P, Base of Cns Base of modulus P, Base of Cns Any RAM 2 * u2KLength + 8 Option related to the called service
(see below) Length of modulus P Length of modulus P Scalar numbers used to multiply the points A and B Unchanged Length of scalars KA and KB Length of scalars KA and KB Crypto RAM Crypto RAM
(3*(u2ModLength +
4)) * (2(WA-2)) (1)
(3*(u2ModLength +
4)) * (2(WB-2)) (2) Input point A (projective coordinates) Input point B (projective coordinates) Unchanged Unchanged 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 840 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service pu1AWorkBase pu1 I Crypto RAM 9*u2ModLength + 48 Parameter a of the elliptic curve Resulting point C (projective coordinates) in pu1AWorkBase Base +
u2ModLength + 4 Notes:
1. 2. The precalculus table size for the point A is calculated from chosen window size WA. The precalculus table size for the point B is calculated from chosen window size WB. 37.3.6.6.5 Options The options are set by the u2Options input parameter, which is composed of:
the mandatory windows sizes WA and WB the indication of the presence of the scalars in system RAM Note:Please check precisely if one part of the scalars is in Crypto RAM. If this is the case, the PUKCL_ZPECCMUL_SCAL_IN_CLASSIC_RAM option must not be used. The u2Options number is calculated by an Inclusive OR of the options. Some Examples in C language are:
// Scalars are in system RAM
// The Point A window size is 3
// The Point B window size is 4 PUKCL(u2Options) = PUKCL_ZPECCMUL_SCAL_IN_CLASSIC_RAM |
PUKCL_ZPECCMUL_WINSIZE_A_VAL_TO_OPT(3) |
PUKCL_ZPECCMUL_WINSIZE_B_VAL_TO_OPT(4);
// Scalars are in the PUKCC Cryptographic RAM
// The Point A window size is 2
// The Point B window size is 5 PUKCL(u2Options) = PUKCL_ZPECCMUL_WINSIZE_A_VAL_TO_OPT(2) |
PUKCL_ZPECCMUL_WINSIZE_B_VAL_TO_OPT(5);
For this service, many window sizes are possible. The window sizes in bits are those of the windowing method used for the scalar multiplying. The choice of the window sizes is a balance between the size of the parameters and the computation time:
Increasing the window size increases the precomputation table size. Increasing the window size to the optimum reduces the computation time. The following table details the size of the point and the precomputation table, depending on the chosen window size option. Table 37-75. ZpEccQuickDualMulFast Service Window Size Options and Precomputation Table Size Option Specified Size of the Point and the Precomputation Table PUKCL_ZPECCMUL_WINSIZE_A_VAL_TO_OPT(WA) WA in [2, 15]
(3*(u2ModLength + 4)) * (2(WA-2)) PUKCL_ZPECCMUL_WINSIZE_B_VAL_TO_OPT(WB) WB in [2, 15]
(3*(u2ModLength + 4)) * (2(WB-2)) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 841 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) The scalars can be located in PUKCC RAM or in system RAM. If both scalars are entirely in system RAM with no part in PUKCC RAM this can be signaled by using the option PUKCL_ZPECCMUL_SCAL_IN_CLASSIC_RAM. In all other cases this option must not be used. The following table describes this option. Table 37-76. ZpEccQuickDualMulFast Service System RAM Scalar Options Option Purpose PUKCL_ZPECCMUL_SCAL_IN_CLASSIC_RAM The scalars can be located in Crypto RAM or in system RAM. If both scalars are entirely in system RAM with no part in Crypto RAM this can be signaled by using this option . In all other cases this option must not be used. 37.3.6.6.6 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL(u2Option) = <Configure scalar numbers location and windows sizes>;
PUKCL_ZpEccQuickDualMulFast(pu1ModCnsBase) = <Base of the ram location of P and Cns>;
PUKCL_ZpEccQuickDualMulFast(u2ModLength) = <Byte length of P>;
PUKCL_ZpEccQuickDualMulFast(u2KLength) = <Byte length of scalars>;
PUKCL_ZpEccQuickDualMulFast(pu1PointABase) = <Base of the ram location of the A point>;
PUKCL_ZpEccQuickDualMulFast(pu1PointBBase) = <Base of the ram location of the B point>;
PUKCL_ZpEccQuickDualMulFast(pu1AWorkBase) = <Base of the ram location of the parameter A of the elliptic curve and workspace>;
PUKCL_ZpEccQuickDualMulFast(pu1KABBase) = <Base of the ram location of the scalar numbers KA and KB>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEccQuickDualMulFast, pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
else // Manage the error 37.3.6.6.7 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
pu1ModCnsBase,pu1PointABase, pu1PointBBase, pu1AWorkBase, pu1KABBase are not aligned on 32-bit boundaries
{pu1ModCnsBase, 2*u2ModLength + 16}, {pu1PointABase, (3*(u2ModLength + 4)) *(2(WA-2))}, {pu1PointBBase,
(3*(u2ModLength + 4)) * (2(WB-2))} or { pu1AWorkBase, 9*u2ModLength + 48} are not in PUKCC RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length Alloverlapping between {pu1ModCnsBase, 2*u2ModLength + 16}, {pu1PointABase, (3*(u2ModLength + 4)) *
(2(WA-2))}, {pu1PointBBase, (3*(u2ModLength + 4)) * (2(WB-2))} or {pu1AWorkBase, 9*u2ModLength + 48}. 37.3.6.6.8 Parameters Placement The parameters placement is described in the following figures. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 842 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Figure 37-7. Modulus P and Cns{pu1ModCnsBase, 2*u2ModLength + 16}
Figure 37-8. Points A and B {pu1PointABase, [(3*(u2ModLength + 4)) * (2(WA-2))] Or [(3*(u2ModLength + 4)) *
(2(WB-2))]}
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 843 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Figure 37-9. Scalars KA and KB {pu1KABBase, 2 * u2KLength + 8}
Figure 37-10. The a parameter and Workspace {pu1AWorkBase, 9*u2ModLength + 48}
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 844 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.6.6.9 Status Returned Values Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 37.3.6.7 Projective to Affine Coordinates Conversion 37.3.6.7.1 Purpose This service is used to perform a point coordinates conversion from projective representation to affine. 37.3.6.7.2 How to Use the Service 37.3.6.7.3 Description The operation performed is:
PtX Affine coordinate =
PtXProjective coordinate PtZ Projective coordinate 2 PtY Affine coordinate =
In this computation, the following parameters need to be provided:
PtZ Projective coordinate 3 PtY Projective coordinate A the input point is filled in projective coordinates (X,Y,Z) or affine coordinates for X and Y, and setting Z to 1(pointed by {nu1PointABase,3*u2ModLength + 12}). The Point A can be the point at infinity. In this case, the u2Status returned is PUKCL_POINT_AT_INFINITY. Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength +8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength +4}) The workspace not initialized (pointed by {nu1WorkSpace, 4*u2ModLength +48}
The result is the point A with its (X,Y) coordinates converted to affine, and the Z coordinate set to 1. The service for this operation is ZpEcConvProjToAffine. Important: Before using this service, ensure that the constant Cns has been calculated with the Setup of the fast Modular Reductions service. 37.3.6.7.4 Parameters Definition Table 37-77. ZpEccConvAffineToProjective Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase nu1 nu1 u2ModLength u2 nu1PointABase nu1 nu1Workspace nu1 I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM 3*u2ModLength + 12 Input point A Resulting point A in affine coordinates Crypto RAM 4*u2ModLength + 48 Workspace 37.3.6.7.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 845 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) PUKCL (u2Option) = 0;
PUKCL _ZpEcConvProjToAffine(nu1ModBase) = <Base of the ram location of P>;
PUKCL _ZpEcConvProjToAffine(u2ModLength) = <Byte length of P>;
PUKCL _ZpEcConvProjToAffine(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _ZpEcConvProjToAffine(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL _ZpEcConvProjToAffine(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEcConvProjToAffine,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.6.7.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8},{nu1PointABase, 3*u2ModLength+ 12},
{nu1Workspace, <WorkspaceLength>} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8},
{nu1PointABase, 3*u2ModLength + 12} and {nu1Workspace, 4*u2ModLength + 48}
37.3.6.7.7 Status Returned Values Table 37-78. ZpEccConvAffineToProjective Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. PUKCL_POINT_AT_INFINITY Warning The input point has its Z equal to zero, so its a representation of the infinite point. 37.3.6.8 Affine to Projective Coordinates Conversion 37.3.6.8.1 Purpose This service is used to perform a point coordinates conversion from an affine point representation to projective. 37.3.6.8.2 How to Use the Service 37.3.6.8.3 Description The operation performed is:
affine(Xa, Ya) projective(Xp, Yp, Zp) In this computation, the following parameters need to be provided:
A the input point is filled in affine coordinates for X and Y, and setting Z to 1 (pointed by
{nu1PointABase,3*u2ModLength + 4}). Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength +8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength +4}) The workspace not initialized (pointed by {nu1WorkSpace, 2*u2ModLength +16}
The result is the point A with its (X,Y,Z) projective coordinates. The service for this operation is ZpEcConvAffineToProjective 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 846 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Important: Before using this service, ensure that the constant Cns has been calculated with the setup of the Fast Modular Reductions service. 37.3.6.8.4 Parameters Definition Table 37-79. ZpEccConvAffineToProjective Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase nu1 nu1 u2ModLength u2 nu1PointABase nu1 nu1Workspace nu1 I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM 3*u2ModLength + 12 Input point A Resulting point A in affine coordinates Crypto RAM 2*u2ModLength + 16 Workspace 37.3.6.8.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL (u2Option) = 0;
PUKCL _ZpEcConvAffineToProjective(nu1ModBase) = <Base of the ram location of P>;
PUKCL _ZpEcConvAffineToProjective(u2ModLength) = <Byte length of P>;
PUKCL _ZpEcConvAffineToProjective(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _ZpEcConvAffineToProjective(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL _ZpEcConvAffineToProjective(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEcConvAffineToProjective,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.6.8.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength+ 12},
{nu1Workspace, <WorkspaceLength>} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointABase, 3*u2ModLength + 12}, and {nu1Workspace, 2*u2ModLength + 16}
37.3.6.8.7 Status Returned Values Table 37-80. ZpEccConvAffineToProjective Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 847 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.6.9 Randomize a Coordinate 37.3.6.9.1 Purpose This service is used to convert the projective representation of a point to another projective representation. 37.3.6.9.2 How to Use the Service 37.3.6.9.3 Description The operation performed is:
Projective(X1, Y1, Z1) Projective(X2, Y2, Z2) In this computation, the following parameters need to be provided:
The input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointBase,3*u2ModLength + 12}). This Point must not be the point at infinity. Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength +8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength +4}) The workspace not initialized (pointed by {nu1WorkSpace, 3*u2ModLength +28}
The random number (pointed by {nu1RandomBase, u2ModLength +4}). The result is the point nu1PointBase with its (X,Y,Z) coordinates randomized. The service for this operation is ZpEcRandomiseCoordinate. Important:Before using this service:
Ensure that the constant Cns has been calculated with the setup of the Modular Reduction service. Be sure to follow the directives given for the RNG on the chip you use (particularly initialization, seeding) and compulsorily start the RNG
. 37.3.6.9.4 Parameters Definition Table 37-81. ZpEccRandomiseCoordinate Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase u2ModLength nu1 nu1 u2 nu1PointBase nu1 nu1RandomBase nu1 nu1Workspace nu1 I I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM 3*u2ModLength + 12 Input point Resulting point Crypto RAM u2ModLength + 4 Random Crypto RAM 3*u2ModLength + 28 Corrupted Workspace 37.3.6.9.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL (u2Option) = 0;
// Depending on the option specified, not all fields must be filled PUKCL _ZpEccRandomiseCoordinate(nu1ModBase) = <Base of the ram location of P>;
PUKCL _ZpEccRandomiseCoordinate(u2ModLength) = <Byte length of P>;
PUKCL _ZpEccRandomiseCoordinate(nu1CnsBase) = <Base of the ram location of Cns>;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 848 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) PUKCL_ZpEccRandomiseCoordinate(nu1RandomBase) = <Base of the ram location where the the RNG is stored>;
PUKCL _ZpEccRandomiseCoordinate(nu1PointBase) = <Base of the ram location of the point>;
PUKCL _ZpEccRandomiseCoordinate(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEccRandomiseCoordinate,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.6.9.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1RandomBase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12},
{nu1RandomBase, u2ModLength + 4}, {nu1Workspace, <WorkspaceLength>} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1RandomBase, u2ModLength + 4} and {nu1Workspace, 3*u2ModLength + 28}
37.3.6.9.7 Status Returned Values Table 37-82. ZpEccRandomiseCoordinate Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 37.3.6.10 Point is on Elliptic Curve 37.3.6.10.1 Purpose This service is used to test whether or not the point is on the curve. 37.3.6.10.2 How to Use the Service 37.3.6.10.3 Description The operation performed is:
Status = IsPointOnCurve(X, Y, Z) In this computation, the following parameters need to be provided:
The input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointBase,3*u2ModLength + 4}). This Point can be the point at infinity. AParam and BParam are the Elliptic Curve Equation parameters. (pointed by{nu1AParam, u2ModLength+4} and
{nu1BParam, u2ModLength+4}). Cns the Fast Modular Constant filled (pointed by{nu1CnsBase,u2ModLength+8}). P the modulus filled (pointed by {nu1ModBase,u2ModLength +4}). The workspace not initialized (pointed by {nu1WorkSpace, 4*u2ModLength +28}. The result is the status of the point (X,Y,Z) regarding the Elliptic Curve Equation. The service name for this operation is ZpEcPointIsOnCurve. Note: Before using this service, ensure that the constant Cns has been calculated with the setup of the Fast Modular Reduction service. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 849 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.6.10.4 Parameters Definition Table 37-83. ZpEcPointIsOnCurve Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1 nu1CnsBase nu1 u2ModLength u2 nu1PointBase nu1 nu1AParam nu1BParam nu1 nu1 nu1Workspace nu1 I I I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM 3*u2ModLength + 12 Input point unchanged Crypto RAM u2ModLength + 4 The parameter a The parameter a Crypto RAM u2ModLength + 4 The parameter b The parameter b Crypto RAM 4*u2ModLength + 28 Workspace 37.3.6.10.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL (u2Option) = 0;
PUKCL _ZpEcPointIsOnCurve(nu1ModBase) = <Base of the ram location of P>;
PUKCL _ZpEcPointIsOnCurve(u2ModLength) = <Byte length of P>;
PUKCL _ZpEcPointIsOnCurve(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _ZpEcPointIsOnCurve(nu1AParam) = <Base of the ram location of the parameter a>;
PUKCL _ZpEcPointIsOnCurve(nu1BParam) = <Base of the ram location of the parameter b>;
PUKCL _ZpEcPointIsOnCurve(nu1PointBase) = <Base of the ram location of the point>;
PUKCL _ZpEcPointIsOnCurve(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEcPointIsOnCurve,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.6.10.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1AParam, nu1BParam, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength+4}, {nu1CnsBase, u2ModLength+8}, {nu1PointABase, 3*u2ModLength +12},
{nu1AParam, u2ModLength + 4}, {nu1BParam, u2ModLength + 4}, {nu1Workspace, <WorkspaceLength>} are not in Crypto RAM. u2ModLength is either: < 12, > 0xffc or not a 32-bit length. All overlapping between {nu1ModBase, u2ModLength+4}, {nu1CnsBase,u2ModLength+8}, {nu1PointABase, 3*u2ModLength+12}, {nu1AParam, u2ModLength+4}, {nu1AParam, u2ModLength + 4} and {nu1Workspace, 4*u2ModLength+28}. 37.3.6.10.7 Status Returned Values Table 37-84. ZpEcPointIsOnCurve Service Return Codes Returned Status PUKCL_OK Importance Meaning The point is on the curve. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 850 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Returned Status Importance Meaning PUKCL_POINT_IS_NOT_ON_ CURVE Warning The point is not on the curve. PUKCL_POINT_AT_INFINITY Warning The input point has its Z equal to zero, so its a representation of the infinite point. 37.3.6.11 Generating an ECDSA Signature (Compliant with FIPS 186-2) 37.3.6.11.1 Purpose This service is used to generate an ECDSA signature following the FIPS 186-2. It performs the second step of the Signature Generation. A hash value (HashVal) must be provided as input, it has to be previously computed from the message to be signed using a secure hash algorithm. A scalar number must be provided too as described in the FIPS 186-2. The result (R,S) is computed by this service. 37.3.6.11.2 How to Use the Service 37.3.6.11.3 Description The operation performed is:
(R, S) = EcDsaSign(PtA, HashVal, k, CurveParameters, PrivateKey) This service processes the following checks:
If the Scalar Number k is out of the range [1, PointOrder -1], the calculus is stopped and the status is set to PUKCL_WRONG_SELECT_NUMBER. If R equals zero, the calculus is stopped and the status is set to PUKCL_WRONG_SELECT_NUMBER. If S equals zero, the calculus is stopped and the status is set to PUKCL_WRONG_SELECT_NUMBER. In this computation, the following parameters need to be provided:
A the input point is filled in mixed coordinates (X,Y) with the affine values and Z = 1 (pointed by
{nu1PointABase,3*u2ModLength + 12}) Cns the working space for the Fast Modular Constant not initialized (pointed by {nu1CnsBase,u2ScalarLength +
8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength + 4}) The workspace not initialized (pointed by {nu1WorkSpace, 8*u2ModLength + 44}
The a parameter relative to the elliptic curve (pointed by {nu1ABase, u2ModLength + 4}) The order of the Point A on the elliptic curve (pointed by {nu1OrderPointBase, u2ScalarLength + 4}) HashVal the hash value beforehand generated and filled (pointed by {nu1HashBase, u2ScalarLength + 4}) The Private Key (pointed by {nu1PrivateKey, u2ScalarLength +4}) Generally, u2ScalarLength is equal to (u2ModLength) or (u2ModLength + 4) k the input Scalar Number beforehand generated and filled (pointed by{nu1ScalarNumber,u2ScalarLength + 4}) Important:
For the ECDSA signature generation be sure to follow the directives given for the RNG on the chip you use (particularly initialization, seeding) and compulsorily start the RNG. The scalar number k must be selected at random. This random must be generated before the call of the ECDSA signature. For this random generation be sure to follow the directives given for the RNG on the chip you use (particularly initialization, seeding) and compulsorily start the RNG. The operation performed is:
Compute the ECDSA (R,S) as described in FIPS 186-2, but leaving the user the role of computing the input Hash Value, thus leaving the freedom of using any other algorithm than SHA-1. Compute a R value using the input A point and the scalar number. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 851 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Compute a S value using R, the scalar number, the private key and the provided hash value. Note that the resulting signature (R,S) is stored at the place of the input A point. If all is correct and S is different from zero, the status is set to PUKCL_OK. If all is correct and S equals zero,the status is set to PUKCL_WRONG_SELECT_NUMBER. If an error occurs, the status is set to the corresponding error value (see Status Returned Values below). The service name for this operation is ZpEcDsaGenerateFast. This service uses Fast mode and Fast Modular Reduction for computation. The signature (R,S), when resulting from a computation is given back at address of the A point:
R output is at offset 0 and has length (u2ScalarLength + 4)bytes. S output is at offset (u2ScalarLength + 4) bytes and has length (u2ScalarLength + 4) bytes. The MSB 4 zero bytes may be suppressed to get the R and S values on u2ScalarLength bytes 37.3.6.11.4 Parameters Definition Table 37-85. ZpEcDsaGenerateFast Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service Base of modulus P nu1ModBase nu1 nu1CnsBase u2ModLength nu1 u2 nu1ScalarNumber nu1 nu1OrderPointBase nu1 I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Crypto RAM u2ScalarLength + 8 Base of Cns Base of Cns Length of modulus P Length of Crypto RAM u2ScalarLength + 4 Scalar Number used to multiply the point A modulus P Unchanged Crypto RAM u2ScalarLength + 4 Order of the Point A Unchanged in the elliptic curve nu1PrivateKey nu1 I/O Crypto RAM u2ScalarLength + 4 Base of the Private Unchanged Key 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 852 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service Crypto RAM u2ScalarLength + 4 Base of the hash Unchanged nu1HashBase(1) nu1 u2ScalarLength u2 I I value resulting from the previous SHA Length of scalar
(same length as the length of order) Length of scalar Input point A (three coordinates (X,Y) affine and Z = 1) Resulting signature
(R,S,0) Parameter a of the elliptic curve Unchanged nu1PointABase(2) nu1 I/O Crypto RAM 3*u2ModLength +
12 nu1ABase nu1 nu1Workspace nu1 I I Notes:
Crypto RAM u2ModLength + 4 Crypto RAM 8*u2ModLength +
44 Corrupted workspace 1. 2. The hash value calculus is defined by the ECDSA norm and depends on the elliptic curve domain parameters. To construct the input parameter, the 4 Most Significant Bytes must be set to zero. The resulting signature format is different from the point A format (see Description above for information on the point A format). 37.3.6.11.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL (u2Option) = 0;
// Depending on the option specified, not all fields must be filled PUKCL _ZpEcDsaGenerate(nu1ModBase) = <Base of the ram location of P>; PUKCL _ZpEcDsaGenerate(u2ModLength) = <Byte length of P>;
PUKCL _ZpEcDsaGenerate(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _ZpEcDsaGenerate(nu1PointABase) = <Base of the A point>;
PUKCL _ZpEcDsaGenerate(nu1PrivateKey) = <Base of the Private Key>;
PUKCL _ZpEcDsaGenerate(nu1ScalarNumber) = <Base of the ScalarNumber>;
PUKCL _ZpEcDsaGenerate(nu1OrderPointBase) = <Base of the order of A point>;
PUKCL _ZpEcDsaGenerate(nu1ABase) = <Base of the a parameter of the curve>;
PUKCL _ZpEcDsaGenerate(nu1Workspace) = <Base of the workspace>;
PUKCL _ZpEcDsaGenerate(nu1HashBase) = <Base of the SHA resulting hash>;
PUKCL_ZpEcDsaGenerate(u2ScalarLength) = < Length of ScalarNumber>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEcDsaGenerateFast, pvPUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.6.11.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 853 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) nu1ModBase, nu1CnsBase, nu1PointABase, nu1PrivateKey, nu1ScalarNumber, nu1OrderPointBase,nu1ABase, nu1Workspace or nu1HashBase are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength+
12},{nu1PrivateKey, u2ScalarLength + 4},{nu1ScalarNumber, u2ScalarLength + 4},{nu1OrderPointBase, u2ScalarLength + 4}, {nu1ABase, u2ModLength + 4}, {nu1Workspace, <WorkspaceLength>} or {nu1HashBase, u2ScalarLength + 4} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1PrivateKey, u2ScalarLength + 4}, {nu1ScalarNumber, u2ScalarLength
+ 4}, {nu1OrderPointBase, u2ScalarLength + 4}, {nu1ABase, u2ModLength + 4}, {nu1Workspace,
<WorkspaceLength>} and {nu1HashBase, u2ScalarLength + 4}
37.3.6.11.7 Status Returned Values Table 37-86. ZpEcDsaGenerateFast Service Return Codes Returned Status Importance Meaning PUKCL_OK PUKCL_WRONG_SELECTNUMBER Warning The computation passed without problem. The signature is the good one. The given value for nu1ScalarNumber is not good to perform this signature generation. 37.3.6.12 Verifying an ECDSA Signature (Compliant with FIPS186-2) 37.3.6.12.1 Purpose This service is used to verify an ECDSA signature following the FIPS 186-2. It performs the second step of the Signature Verification. A hash value (HashVal) must be provided as input, it has to be previously computed from the message to be signed using a secure hash algorithm. As second significant input, the Signature is provided to be checked. This service checks the signature and fills the status accordingly. 37.3.6.12.2 How to Use the Service 37.3.6.12.3 Description The operation performed is:
Verify = EcDsaVerifySignature(PtA, HashVal, Signature, CurveParameters, PublicKey) The points used for this operation are represented in different coordinate systems. In this computation, the following parameters need to be provided:
A the input point is filled with the affine values (X,Y) and Z = 1 (pointed by{nu1PointABase,3*u2ModLength +
12}) Cns the working space for the Fast Modular Constant not initialized (pointed by {nu1CnsBase,u2ScalarLength +
8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength + 4}) The workspace not initialized (pointed by {nu1WorkSpace, 8*u2ModLength + 44}
The a parameter relative to the elliptic curve (pointed by {nu1ABase,u2ModLength + 4}) The order of the Point A on the elliptic curve (pointed by {nu1OrderPointBase,u2ScalarLength + 4}) HashVal the hash value is generated prior and filled (pointed by {nu1HashBase,u2ScalarLength + 4}) The Public Key point is filled in mixed coordinates (X,Y) with the affine values and Z = 1 (pointed by
{nu1PointPublicKeyGen, 3*u2ModLength + 12}) The input signature (R,S), even if it is not a Point, is represented in memory like a point in affine coordinates
(X,Y) (pointed by {nu1PointSignature, 2*u2ScalarLength + 8}) Note: For the ECDSA signature verification be sure to follow the directives given for the RNG on the chip you use (particularly initialization, seeding) and compulsorily start the RNG. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 854 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) The operation consists in obtaining a V value with all these input parameters and checking that V equals the provided R. If all is correct and the signature is the good one, the status is set to PUKCL_OK. If all is correct and the signature is wrong, the status is set to PUKCL_WRONG_SIGNATURE. If an error occurs, the status is set to the corresponding error value (see Status Returned Values below). 37.3.6.12.4 Parameters Definition Table 37-87. ZpEcDsaVerifyFast Service Parameters Parameter Type Direction Location Data Length nu1ModBase nu1CnsBase u2ModLength nu1 nu1 u2 nu1OrderPointBase nu1 nu1PointSignature nu1HashBase(1) nu1 nu1 u2ScalarLength u2 I I I I I I I Before Executing the Service After Executing the Service Base of modulus P Base of modulus P Crypto RAM u2ModLength + 4 Crypto RAM u2ScalarLength + 12 Base of Cns Base of Cns Crypto RAM u2ScalarLength + 4 Length of modulus P Order of the Point A in the elliptic curve Length of modulus P Unchanged Crypto RAM 2*u2ScalarLength + 8 Signature(r, s) Corrupted Crypto RAM u2ScalarLength + 4 Base of the hash value resulting from the previous SHA Length of scalar Corrupted Length of scalar nu1PointABase nu1 nu1PointPublicKeyGen nu1 I/O I/O nu1ABase nu1Workspace nu1 nu1 I I Crypto RAM 3*u2ModLength + 12 Generator point Corrupted Crypto RAM 3*u2ModLength + 12 Public point Corrupted Crypto RAM u2ModLength + 4 Parameter a of the elliptic curve Unchanged Crypto RAM 8*u2ModLength + 44 Corrupted workspace Note:
1. The hash value calculus is defined by the ECDSA norm and depends on the elliptic curve domain parameters. To construct the input parameter, the 4 Most Significant Bytes must be set to zero. 37.3.6.12.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL(u2Option) = 0;
// Depending on the option specified, not all fields must be filled PUKCL_ZpEcDsaVerify(nu1ModBase) = <Base of the ram location of P>;
PUKCL_ZpEcDsaVerify(u2ModLength) = <Byte length of P>;
PUKCL_ZpEcDsaVerify(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL_ZpEcDsaVerify(nu1PointABase) = <Base of the A point>;
PUKCL_ZpEcDsaVerify(nu1PrivateKey) = <Base of the Private Key>;
PUKCL_ZpEcDsaVerify(nu1ScalarNumber) = <Base of the ScalarNumber>;
PUKCL_ZpEcDsaVerify(nu1OrderPointBase) = <Base of the order of A point>;
PUKCL_ZpEcDsaVerify(nu1ABase) = <Base of the a parameter of the curve>;
PUKCL_ZpEcDsaVerify(nu1Workspace) = <Base of the workspace>;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 855 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) PUKCL_ZpEcDsaVerify(nu1HashBase) = <Base of the SHA resulting hash>;
PUKCL_ZpEcDsaVerify(u2ScalarLength) = < Length of ScalarNumber>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEcDsaVerifyFast, pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
}ou else if(PUKCL(u2Status) == PUKCL_WRONG_SIGNATURE)
else // Manage the error 37.3.6.12.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1PointPublicKeyGen, nu1PointSignature, nu1OrderPointBase,nu1ABase, nu1Workspace or nu1HashBase are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength+
12}, {nu1PointPublicKeyGen, 3*u2ModLength + 12}, {nu1PointSignature,2*u2ScalarLength + 8},
{nu1OrderPointBase, u2ScalarLength + 4}, {nu1ABase, u2ModLength + 4}, {nu1Workspace,
<WorkspaceLength>} or {nu1HashBase, u2ScalarLength + 4} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1PointPublicKeyGen, 3*u2ModLength + 12}, {nu1PointSignature, 2*u2ScalarLength
+ 8}, {nu1OrderPointBase, u2ScalarLength + 4}, {nu1ABase, u2ModLength + 4}, {nu1Workspace,
<WorkspaceLength>} and {nu1HashBase, u2ScalarLength + 4}
37.3.6.12.7 Status Returned Values Table 37-88. ZpEcDsaVerifyFast Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. The signature is the good one. PUKCL_WRONG_SIGNATURE Warning The signature is wrong. 37.3.6.13 Quick Verifying an ECDSA Signature (Compliant with FIPS 186-2) 37.3.6.13.1 Purpose This service is used to verify an ECDSA signature following the FIPS 186-2. It performs the second step of the Signature Verification using Quick Dual Multiplying to perform computation. A hash value (HashVal) must be provided as input, it has to be previously computed from the message whose signature is verified using a secure hash algorithm. As second significant input, the Signature is provided to be checked. This service checks the signature and fills the status accordingly. Important:This service has a quick implementation without additional security. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 856 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.6.13.2 How to Use the Service 37.3.6.13.3 Description The operation performed is:
Verify = EcDsaVerifySignature(PtA, HashVal, Signature, CurveParameters, PublicKey) The points used for this operation are represented in different coordinate systems. In this computation, the following parameters need to be provided (such that u2MaxLength = max(u2ModLength, u2ScalarLength)):
A the input point is filled with the affine values (X,Y) and Z = 1 (pointed by {pu1PointABase,(3*(u2ModLength +
4)) * (2(WA-2))}) P the modulus filled and Cns the working space for the Fast Modular Constant not initialized (pointed by
{pu1ModBase, u2ModLength + u2MaxLength + 16}) The a parameter relative to the elliptic curve filled and workspace not initialized (pointed by
{pu1AWorkBase,8*u2MaxLength + u2ModLength + 48}) The order of the Point A on the elliptic curve (pointed by {pu1OrderPointBase,u2ScalarLength +4}) HashVal the hash value beforehand generated and filled (pointed by {pu1HashBase,u2MaxLength +4}) The Public Key point is filled in mixed coordinates (X,Y) with the affine values and Z = 1 (pointed by
{nu1PointPublicKeyGen, (3*(u2ModLength + 4)) * (2(WB-2))}) The input signature (R,S), even if it is not a Point, is represented in memory like a point in affine coordinates
(X,Y) (pointed by {nu1PointSignature, 2*u2ScalarLength + 8}) The operation consists of obtaining a V value with all input parameters and checks that V equals the provided R. If all is correct and the signature is the good one, the status is set to PUKCL_OK. If all is correct and the signature is wrong, the status is set to PUKCL_WRONG_SIGNATURE. If an error occurs, the status is set to the corresponding error value (see Status Returned Values below). 37.3.6.13.4 Parameters Definition To place the parameters correctly the maximum of u2ModLength and u2ScalarLength must be calculated:
u2MaxLength = max(u2ModLength, u2ScalarLength) WA is the Point A window size and WB is the Point Public Key window size (see Options below for details). Important:Please calculate precisely the length of areas with the formulas and the max() service which takes the maximum of two values. Ensure that the pu1 type is a pointer on 4 bytes and contains the full address (see 37.3.3.4. Aligned Significant Length for details). Table 37-89. ZpEcDsaQuickVerify Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service pu1ModCnsBase pu1 u2Option u2ModLength u2 u2 pu1OrderPointBase pu1 pu1PointSignature pu1 I I I I I Crypto RAM u2ModLength + 4 +
u2MaxLength + 12 Base of modulus P Base of modulus P Crypto RAM u2ScalarLength + 4 Option related to the called service
(see below) Length of modulus P Order of the Point A in the elliptic curve Length of modulus P Unchanged Any RAM 2*u2ScalarLength + 8 Signature(r, s) Corrupted 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 857 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Parameter Type Direction Location Data Length pu1HashBase (see Note 1) pu1 u2ScalarLength u2 I I pu1PointABase pu1 I/O pu1PointPublicKeyGen pu1 I/O pu1AWorkBase pu1 I Crypto RAM u2MaxLength + 4
(3*u2ModLength +
12) * (2(WA-2))
(3*u2ModLength +
12) * (2(WB-2)) Crypto RAM Crypto RAM Crypto RAM Before Executing the Service Base of the hash value resulting from the previous SHA Length of scalar After Executing the Service Corrupted Length of scalar Generator point Corrupted Public Key point Corrupted
(u2ModLength + 4)
+ (8*u2MaxLength +
44) Parameter a of the elliptic curve and Workspace Corrupted Note:
1. 1. The hash value calculus is defined by the ECDSA norm and depends on the elliptic curve domain parameters. To construct the input parameter, the 4 Most Significant Bytes must be set to zero. A suggested parameters placement in Crypto RAM is:
ModCnsBase OrderPointBase Signature may be placed here or in Classical RAM HashBase PointABase PointPublicKeyGen AWorkBase 37.3.6.13.5 Options The options are set by the u2Options input parameter, which is composed of:
the mandatory windows sizes WA (window for Point A) and WB (window for Point Public Key) the indication of the presence of the Point Signature in system RAM Important:Please check precisely if the Point Signature is in Crypto RAM. If this is the case the PUKCL_ZPECCMUL_SCAL_IN_CLASSIC_RAM must not be used. The u2Options number is calculated by an Inclusive OR of the options. Some Examples in C language are:
// Point Signature in system RAM
// The Point A window size is 3
// The Point Public Key window size is 4 PUKCL(u2Options) = PUKCL_ZPECCMUL_SCAL_IN_CLASSIC_RAM |
PUKCL_ZPECCMUL_WINSIZE_A_VAL_TO_OPT(3) |
PUKCL_ZPECCMUL_WINSIZE_B_VAL_TO_OPT(4);
// Point Signature in the Cryptographic RAM
// The Point A window size is 2 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 858 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
// The Point Public Key window size is 5 PUKCL(u2Options) = PUKCL_ZPECCMUL_WINSIZE_A_VAL_TO_OPT(2) |
PUKCL_ZPECCMUL_WINSIZE_B_VAL_TO_OPT(5);
For this service, many window sizes are possible. The window sizes in bits are those of the windowing method used for the scalar multiplying. The choice of the window sizes is a balance between the size of the parameters and the computation time:
Increasing the window size increases the precomputation table size. Increasing the window size to the optimum reduces the computation time. The following table details the estimated windows WA and WB optimum and possible for some curves. Table 37-90. ZpEcDsaQuickVerify Service Estimated WA and WB Window Size Curve Size (bits) Optimum Window size Possible Window Sizes (WA, WB) or (WB, WA) 192 256 384 521 5 5 6 6 5, 5 5, 5 5, 5 4, 5 The following table details the size of the point and the precomputation table, depending on the chosen window size option. Table 37-91. ZpEcDsaQuickVerify Service Window Size and Precomputation Table Size Options Option Specified Point and Precomputation Table Size PUKCL_ZPECCMUL_WINSIZE_A_VAL_TO_OPT(WA) WA in [2, 15]
(3*(u2ModLength + 4)) * (2(WA-2)) PUKCL_ZPECCMUL_WINSIZE_B_VAL_TO_OPT(WB) WB in [2, 15]
(3*(u2ModLength + 4)) * (2(WB-2)) The Point Signature can be located in PUKCC RAM or in system RAM. If the Point Signature is entirely in system RAM with no part in PUKCC RAM this can be signaled by us ing the option PUKCL_ZPECCMUL_SCAL_IN_CLASSIC_RAM. In all other cases this option must not be used. The following table describes this option. Table 37-92. ZpEcDsaQuickVerify Service Point Signature in Classical RAM Option Option Purpose PUKCL_ZPECCMUL_SCAL_IN_CLASSIC_RAM The Point Signature can be located in Crypto RAM or in system RAM. If the Point Signature is entirely in system RAM with no part in PUKCC RAM this can be signaled by using this option. In all other cases this option must not be used. 37.3.6.13.6 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL(u2Option) = <Point Signature location and windows sizes>;
PUKCL_ZpEcDsaQuickVerify(pu1ModCnsBase) = <Base of the ram location of P and Cns>;
PUKCL_ZpEcDsaQuickVerify(u2ModLength) = <Byte length of P>;
PUKCL_ZpEcDsaQuickVerify(pu1PointABase) = <Base of the ram location of the A point>;
PUKCL_ZpEcDsaQuickVerify(pu1PointPublicKeyGen) = <Base of the Public Key>;
PUKCL_ZpEcDsaQuickVerify(pu1PointSignature) = <Base of the Signature (r, s)>;
PUKCL_ZpEcDsaQuickVerify(pu1OrderPointBase) = <Base of the order of the A point>;
PUKCL_ZpEcDsaQuickVerify(pu1AWorkBase) = <Base of the ram location of the parameter A of the elliptic curve and workspace>;
PUKCL_ZpEcDsaQuickVerify(pu1HashBase) = <Base of the SHA resulting hash>;
PUKCL_ZpEcDsaQuickVerify(u2ScalarLength) = <Byte length of R and S in Point Signature>;
. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 859 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(ZpEcDsaQuickVerify, pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
else if ( PUKCL(u2Status) = PUKCL_WRONG_SIGNATURE )
else // Manage the error 37.3.6.13.7 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
pu1ModCnsBase, pu1PointABase, pu1PointPublicKeyGen, pu1PointSignature,pu1OrderPointBase, pu1AWorkBase or pu1HashBase are not aligned on 32-bit boundaries
{pu1ModCnsBase, u2ModLength + 4 + u2MaxLength + 12}, {pu1PointABase, (3 * u2ModLength + 12)*
(2(WA-2))}, {pu1PointPublicKeyGen, (3 * u2ModLength + 12) * (2(WPub-2))}, {pu1OrderPointBase, u2ScalarLength
+ 4}, {nu1ABase, u2ModLength + 4}, {pu1AWorkBase, (u2ModLength + 4) + (8 * u2MaxLength + 44)} or
{nu1HashBase, u2ScalarLength + 4} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {pu1ModCnsBase, u2ModLength + 4 + u2MaxLength + 12},{pu1PointABase,
(3 * u2ModLength + 12) * (2(WA-2))}, {pu1PointPublicKeyGen, (3 * u2ModLength + 12) *(2(WPub-2))},
{pu1OrderPointBase, u2ScalarLength + 4}, {pu1PointSignature, 2 * u2ScalarLength + 8}, {nu1ABase, u2ModLength + 4}, {pu1AWorkBase, (u2ModLength + 4) + (8 * u2MaxLength + 44)} and {nu1HashBase, u2ScalarLength + 4}
37.3.6.13.8 Status Returned Values Table 37-93. ZpEcDsaQuickVerify Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. The signature is the good one. PUKCL_WRONG_SIGNATURE Warning The signature is wrong. 37.3.6.13.9 Parameter Placement The parameters placement is described in detail in the following figures. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 860 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Figure 37-11. Modulus P and Cns{pu1ModCnsBase, u2ModLength + 4 + u2MaxLength + 12}
Figure 37-12. Points A {pu1PointABase, (3*(u2ModLength + 4)) * (2(WA-2))} and Public Key Gen
{pu1PointPublicKeyGen, (3*(u2ModLength + 4)) * (2(WB-2))}
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 861 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Figure 37-13. PointSignature {pu1PointSignature, 2 * u2ScalarLength + 8}
Figure 37-14. The a parameter and Workspace {pu1AWorkBase, 9*u2ModLength + 48}
37.3.7 Elliptic Curves Over GF(2n) Services This section provides a complete description of the currently available elliptic curve over Polynomials in GF(2n) services. These services process Polynomials in GF(2n) only. The offered services cover the basic operations over elliptic curves such as:
Adding two points over a curve Doubling a point over a curve Multiplying a point by an integral constant Converting a points projective coordinates (resulting from a doubling or an addition) to the affine coordinates, and oppositely converting a points affine coordinates to the projective coordinates. Testing the point presence on the curve. Additionally, some higher level services covering the needs for signature generation and verification are offered:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 862 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Generating an ECDSA signature (compliant with FIPS186-2) Verifying an ECDSA signature (compliant with FIPS 186-2) The supported curves use the following curve equation in GF(2n):
Y2 + XY = X3 + aX + b 37.3.7.1 Parameters Format Related Links 37.3.5.1. Modular Reduction 37.3.3.4. Aligned Significant Length 37.3.7.1.1 Polynomials in GF(2n) Polynomials in GF(2n) are binary polynomials reduced modulo the polynomial P[X]. This polynomial is called the modulus and may be abbreviated to P in this document. The storage of these polynomials in memory area is described in Aligned Significant Length (see Aligned Significant Length from Related Links). For notation simplicity the comparison signs < or > may be used for polynomials, this is to be interpreted as a comparison between the degree of the polynomials. In GF(2n) fully reduced polynomials are of degree strictly lower than degree(P[X]). In many cases the polynomials used in this library are only partially reduced and so have a degree higher or equal than degree(P[X]), but this degree is maintained strictly lower than (degree(P[X]) + 15). 37.3.7.1.2 Coordinates System In this implementation, several choices have been made related to the coordinate systems managed by the elliptic curve primitives. There are two systems currently managed by the library:
Affine Coordinates System where each curve point has two coordinates (X,Y) Projective Coordinates System where each point is represented with three coordinates (X,Y,Z) Converting from the affine coordinates system to a projective coordinates system and is performed by extending its representation having Z = 1:
(X,Y) (X,Y, Z= 1) Converting from a projective coordinate to an affine one is a service offered by the library. The formula to perform this conversion is:
(X,Y, Z) (X Z,Y/Z2) 37.3.7.1.3 Points Representation in Memory Depending on the representation (Projective or Affine), points are represented in memory as shown in the following figure. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 863 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Figure 37-15. Point Representation in Memory In this figure, the modulus is represented as a reference, and to show that coordinates are always to be provided on the length of the modulus plus one 32-bit word. Different types of representations are listed here:
Affine representation:
Pt =
XAffine < P X15 YAffine < P X15 Projective representation:
Notes:
Pt =
XProjective < P X15 YProjective < P X15 ZProjective < P X15 1. 2. The minimum value for u2ModLength is 12 bytes. Therefore, the significant length of the modulus must be at least three 32-bit words. In some cases the point can be the infinite point. In this case it is represented with its Z coordinates equal or congruent to zero. 37.3.7.1.4 Modulus and Modular Constant Parameters In most of the services the following parameters must be provided:
P the Modulus (often pointed by {nu1ModBase,u2ModLength + 4}): This parameter contains the Modulus Polynomial P[X] defining the Galois Field used in points coordinates computations. The Modulus must be u2ModLength bytes long, while having a supplemental zeroed 32-bit word on the MSB side. Note:Most of the Elliptic Curve computations are reduced modulo P. In many functions the reductions are made with the Fast Reduction. Cns the Modular Constant (often pointed by {nu1CnsBase,u2ModLength + 12}): This parameter contains the Modular Constant associated to the Modulus. Important:The Modular Constant must be calculated before using the GF(2n) Elliptic Curves functions by a call to the Setup for Modular Reductions with the GF(2n) option (see Modular Reduction from Related Links). 37.3.7.1.5 Curve Parameters in Memory Some services need one or both of the Elliptic Curve Equation Parameters a and b. In this case these values are organized in memory as follows:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 864 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) The a Parameter relative to the Elliptic Curve Equation (often pointed by {nu1ABase,u2ModLength +4}). The a Parameter is written in a classical way in memory. It is u2ModLength bytes long and has a supplemental zeroed 32-bit word on the MSB side. The a and b Parameters relative to the Elliptic Curve Equation (often pointed by {nu1ABBase,2*u2ModLength +
8}):
The a Parameter is written in memory on u2ModLength bytes long, with a supplemental zeroed 32-bit word on the MSB side. The b Parameter is written in memory after the a Parameter at an offset of (u2ModLength + 4) bytes. It is written in memory on u2ModLength bytes long, with a supplemental zeroed 32-bit word on the MSB side. 37.3.7.2 Point Addition 37.3.7.2.1 Purpose This service is used to perform a point addition, based on a given elliptic curve over GF(2n). Please note that this service is not intended to add the same point twice. In this particular case, use the doubling service (see 37.3.7.3. Point Doubling). 37.3.7.2.2 How to Use the Service 37.3.7.2.3 Description The operation performed is:
PtC = PtA + PtB In this computation, the following parameters need to be provided:
Point A the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointABase,3*u2ModLength +
12}). This point can be the Infinite Point. Point B the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointBBase,3*u2ModLength +
12}). This point can be the Infinite Point. Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength + 12}) P the modulus filled (pointed by {nu1ModBase,u2ModLength + 4}) The a parameter relative to the elliptic curve equation (pointed by {nu1ABase,u2ModLength + 4}) The workspace not initialized (pointed by {nu1WorkSpace, 7*u2ModLength + 40}
The resulting C point is represented in projective coordinates (X,Y,Z) and is stored at the same place than the input point A. This Point can be the Infinite Point. The services for this operation are:
Service GF2NEccAddFast: The fast mode is used, the fast modular reduction is used in the computations. Important: Before using this service, ensure that the constant Cns has been calculated with the setup of the Modular Reductions service. 37.3.7.2.4 Parameters Definition Table 37-94. GF2NEccAddFast Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase nu1 nu1 u2ModLength u2 I I I Crypto RAM u2ModLength + 4 Base of Modulus P Base of Modulus P Crypto RAM u2ModLength + 12 Base of Cns Base of Cns Length of modulo Length of modulo 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 865 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1PointABase nu1 I/O Crypto RAM 3*u2ModLength + 12 Input point A (projective coordinates) Resulting point C (projective coordinates) nu1PointBBase nu1 nu1ABBase nu1 nu1Workspace nu1 I I I Crypto RAM 3*u2ModLength + 12 Input point Input point B B (projective coordinates) Crypto RAM u2ModLength + 4 Parameter a of the elliptic curve Unchanged Crypto RAM 7*u2ModLength + 40 Corrupted workspace 37.3.7.2.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
//Depending on the function the Random Number Generator
//must be initialized and started
//following the directives given for the RNG on the chip PUKCL(u2Option) = 0;
PUKCL_GF2NEccAdd(nu1ModBase) = <Base of the ram location of P>;
PUKCL_GF2NEccAdd(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL_GF2NEccAdd(u2ModLength) = <Byte length of P>;
PUKCL_GF2NEccAdd(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL_GF2NEccAdd(nu1PointBBase) = <Base of the ram location of the B point>;
PUKCL_GF2NEccAdd(nu1ABBase) = <Base of the ram location of the a Parameter>;
PUKCL_GF2NEccAdd(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(GF2NEccAddFast, pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
else // Manage the error 37.3.7.2.6 Constraints No overlapping between either input and output are allowed The following conditions must be avoided to ensure the service works correctly:
nu1ModBase,nu1CnsBase, nu1PointABase, nu1PointBBase, nu1ABBase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength+ 12},
{nu1PointBBase, 3*u2ModLength + 12}, {nu1ABase,u2ModLength + 4}, {nu1Workspace, <WorkspaceLength>}
are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1PointBBase, 3*u2ModLength + 12}, {nu1ABase,u2ModLength + 4} and
{nu1Workspace, 5*u2ModLength + 32}
37.3.7.2.7 Status Returned Values Table 37-95. GF2NEccAddFast Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without errors. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 866 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.7.3 Point Doubling 37.3.7.3.1 Purpose This service is used to perform a Point Doubling, based on a given elliptic curve over GF(2n). 37.3.7.3.2 How to Use the Service 37.3.7.3.3 Description The operation performed is:
PtC = 2 PtA In this computation, the following parameters need to be provided:
A the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointABase,3*u2ModLength + 12}). This point can be the Infinite Point. Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength +8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength +4}) The workspace not initialized (pointed by {nu1WorkSpace, 4*u2ModLength +28}
The a and b Parameters relative to the Elliptic Curve Equation (pointed by {nu1ABBase,2*u2ModLength+ 8}) The resulting C point is represented in projective coordinates (X,Y,Z) and is stored at the very same place than the input point A. This point can be the Infinite Point. The service name for this operation is GF2NEccDblFast. This service uses Fast mode and Fast Modular Reduction for computation. Important: Before using this service, ensure that the constant Cns has been calculated with the setup of the Fast Modular Reductions service. 37.3.7.3.4 Parameters Definition Table 37-96. GF2NEccDblFast Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase u2ModLength nu1ABBase nu1 nu1 u2 u2 I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 12 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM 2*u2ModLength + 8 Parameters a and b of the elliptic curve nu1PointABase nu1 I/O Crypto RAM 3*u2ModLength + 12 Input point A (projective coordinates) nu1Workspace nu1 I Crypto RAM 4*u2ModLength + 28 Parameter a and b of the elliptic curve Resulting point C (projective coordinates) Corrupted workspace 37.3.7.3.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL (u2Option) = 0;
PUKCL _GF2NEccDbl(nu1ModBase) = <Base of the ram location of P>;
PUKCL _GF2NEccDbl(u2ModLength) = <Byte length of P>;
PUKCL _GF2NEccDbl(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _GF2NEccDbl(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL _GF2NEccDbl(nu1ABBase) = <Base of the a and b parameters of the elliptic curve>;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 867 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) PUKCL _GF2NEccDbl(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(GF2NEccDblFast,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.7.3.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1ABBase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength+ 12},
{nu1ABBase, 2*u2ModLength + 8}, {nu1Workspace, <WorkspaceLength>} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1ABase, u2ModLength + 4} and {nu1Workspace, 4*u2ModLength + 28}
37.3.7.3.7 Status Returned Values Table 37-97. GF2NEccDblFast Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 37.3.7.4 Scalar Point Multiply 37.3.7.4.1 Purpose This service is used to multiply a point by an integral constant K on a given elliptic curve over GF(2n). 37.3.7.4.2 How to Use the Service 37.3.7.4.3 Description The operation performed is:
PtC = K PtA In this computation, the following parameters need to be provided:
A the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointABase,3*u2ModLength + 12}). This point can be the Infinite Point. Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength + 8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength + 4}) The workspace not initialized (pointed by {nu1WorkSpace, 8*u2ModLength + 44}
The a and b parameters relative to the elliptic curve (pointed by {nu1ABBase,2*u2ModLength + 8}) K the scalar number (pointed by {nu1ScalarNumber,u2ScalarLength + 4}) The resulting C point is represented in projective coordinates (X,Y,Z) and is stored at the very same place than the input point A. This point can be the Infinite Point. The service name for this operation is GF2NEccMulFast. This service uses Fast mode and Fast Modular Reduction for computation. Important:Before using this service, ensure that the constant Cns has been calculated with the setup of the Fast Modular Reductions service. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 868 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.7.4.4 Parameters Definition Table 37-98. GF2NEccMulFast Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1 nu1CnsBase nu1 u2ModLength u2 nu1KBase nu1 u2KLength u2 I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 12 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM u2KLength Scalar number used to multiply the point A Unchanged Length of scalar K Length of scalar K nu1PointBase nu1 I/O Crypto RAM 3*u2ModLength + 12 Input point A (projective coordinates) Resulting point C (projective coordinates) nu1ABase nu1 nu1Workspace nu1 I I Crypto RAM 2*u2ModLength + 8 Parameters a and b of Unchanged the elliptic curve Crypto RAM 8*u2ModLength + 44 Corrupted workspace 37.3.7.4.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
PUKCL (u2Option) = 0;
PUKCL _GF2NEccMul(nu1ModBase) = <Base of the ram location of P>;
PUKCL _GF2NEccMul(u2ModLength) = <Byte length of P>;
PUKCL _GF2NEccMul(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _GF2NEccMul(nu1PointBase) = <Base of the ram location of the A point>;
PUKCL _GF2NEccMul(nu1ABase) = <Base of the ram location of the parameters a and b of the elliptic curve>;
PUKCL _GF2NEccMul(nu1KBase) = <Base of the ram location of the scalar number>;
PUKCL _GF2NEccMul(nu1Workspace) = <Base of the ram location of the workspace>;
PUKCL _GF2NEccMul(u2KLength) = <Length of the ram location of the scalar number>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(GF2NEccMulFast,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.7.4.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointBase, nu1ABase, nu1KBase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointBase, 3*u2ModLength+ 12},
{nu1ABase, 2*u2ModLength + 8}, {nu1KBase, u2KLength} or {nu1Workspace, 8*u2ModLength + 44} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 869 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointBase, 3*u2ModLength + 12}, {nu1ABase, 2*u2ModLength + 8}, {nu1KBase, u2KLength} and {nu1Workspace, 8*u2ModLength + 44}
37.3.7.4.7 Status Returned Values Table 37-99. GF2NEccMulFast Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 37.3.7.5 Projective to Affine Coordinates Conversion 37.3.7.5.1 Purpose This service is used to perform a point coordinates conversion from a projective representation to an affine. 37.3.7.5.2 How to Use the Service 37.3.7.5.3 Description The operation performed is:
PtX Affine coordinate =
PtXProjective coordinate PtZ Projective coordinate PtY Affine coordinate =
In this computation, the following parameters need to be provided:
PtZ Projective coordinate 2 PtY Projective coordinate A the input point is filled in projective coordinates (X,Y,Z) or affine coordinates for X and Y, and setting Z to 1
(pointed by {nu1PointABase,3*u2ModLength + 12}). The Point A can be the point at infinity. In this case, the u2Status returned is PUKCL_POINT_AT_INFINITY. Cns the Modular Constant filled (pointed by {nu1CnsBase,u2ModLength + 8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength + 4}) The workspace not initialized (pointed by {nu1WorkSpace, 4*u2ModLength + 48}
The result is the point A with its (X,Y) coordinates converted to affine, and the Z coordinate set to 1. The service name for this operation is GF2NEcConvProjToAffine. Important: Before using this service, ensure that the constant Cns has been calculated with the setup of the Fast Modular Reductions service. 37.3.7.5.4 Parameters Definition Table 37-100. GF2NEcConvProjToAffine Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase nu1 nu1 u2ModLength u2 nu1PointABase nu1 I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 12 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM 3*u2ModLength + 12 Input point A Resulting point A in affine coordinates 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 870 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1Workspace nu1 I Crypto RAM 4*u2ModLength + 48 Workspace 37.3.7.5.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL (u2Option) = 0;
PUKCL _GF2NEcConvProjToAffine(nu1ModBase) = <Base of the ram location of P>;
PUKCL _GF2NEcConvProjToAffine(u2ModLength) = <Byte length of P>;
PUKCL _GF2NEcConvProjToAffine(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _GF2NEcConvProjToAffine(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL _GF2NEcConvProjToAffine(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(GF2NEcConvProjToAffine,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.7.5.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8},{nu1PointABase, 3*u2ModLength + 12},
{nu1Workspace, <WorkspaceLength>} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12} and {nu1Workspace, 4*u2ModLength + 48}
37.3.7.5.7 Status Returned Values Table 37-101. GF2NEcConvProjToAffine Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. PUKCL_POINT_AT_INFINITY Warning The input point has its Z equal to zero, so it is a representation of the infinite point. 37.3.7.6 Affine to Projective Coordinates Conversion 37.3.7.6.1 Purpose This service is used to perform a point coordinates conversion from an affine point representation to projective. 37.3.7.6.2 How to Use the Service 37.3.7.6.3 Description The operation performed is:
affine(Xa, Ya) projective(Xp, Yp, Zp) In this computation, the following parameters need to be provided:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 871 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) A the input point is filled in affine coordinates for X and Y, and setting Z to 1 (pointed by
{nu1PointABase,3*u2ModLength + 4}). Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength + 8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength + 4}) The workspace not initialized (pointed by {nu1WorkSpace, 2*u2ModLength +16} The result is the point A with its
(X,Y,Z) projective coordinates. The service name for this operation is GF2NEcConvAffineToProjective. Important: Before using this service, ensure that the constant Cns has been calculated with the setup of the Fast Modular Reductions service. 37.3.7.6.4 Parameters Definition Table 37-102. GF2NEcConvAffineToProjective Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase nu1 nu1 u2ModLength u2 nu1PointABase nu1 nu1Workspace nu1 I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM 3*u2ModLength + 12 Input point A Resulting point A in affine coordinates Crypto RAM 2*u2ModLength + 16 Workspace 37.3.7.6.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL (u2Option) = 0;
PUKCL _GF2NEcConvAffineToProjective(nu1ModBase) = <Base of the ram location of P>;
PUKCL _GF2NEcConvAffineToProjective(u2ModLength) = <Byte length of P>;
PUKCL _GF2NEcConvAffineToProjective(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _GF2NEcConvAffineToProjective(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL _GF2NEcConvAffineToProjective(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(GF2NEcConvAffineToProjective,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.7.6.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1Workspace are not aligned on 32-bit boundaries 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 872 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12},
{nu1Workspace, <WorkspaceLength>} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12}, and {nu1Workspace, 2*u2ModLength + 16}
37.3.7.6.7 Status Returned Values Table 37-103. GF2NEcConvAffineToProjective Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 37.3.7.7 Randomize Coordinate 37.3.7.7.1 Purpose This service is used to convert the Projective representation of a point to another Projective representation. 37.3.7.7.2 How to Use the Service 37.3.7.7.3 Description The operation performed is:
Projective(X1, Y1, Z1) Projective(X2, Y2, Z2) In this computation, the following parameters need to be provided:
The input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointBase,3*u2ModLength + 12}). This Point must not be the point at infinity. Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength + 8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength + 4}) The workspace not initialized (pointed by {nu1WorkSpace, 3*u2ModLength + 28}
The random number (pointed by {nu1RandomBase, u2ModLength + 4}) The result is the point nu1PointBase with its (X,Y,Z) coordinates randomized. The service for this operation is GF2NEcRandomiseCoordinate. Important:
Before using this service:
Ensure that the constant Cns has been calculated with the Setup of the fast Modular Reductions service. Be sure to follow the directives given for the RNG on the chip you use (particularly initialization, seeding) and compulsorily start the RNG. 37.3.7.7.4 Parameters Definition Table 37-104. GF2NEcRandomiseCoordinate Service Parameters Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1CnsBase u2ModLength nu1 nu1 u2 nu1PointBase nu1 nu1RandomBase nu1 nu1Workspace nu1 I I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM 3*u2ModLength + 12 Input point Resulting point Crypto RAM u2ModLength + 4 Random Crypto RAM 3*u2ModLength + 28 Corrupted Workspace 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 873 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.7.7.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL (u2Option) = 0;
// Depending on the option specified, not all fields must be filled PUKCL _GF2NEcRandomiseCoordinate(nu1ModBase) = <Base of the ram location of P>;
PUKCL _GF2NEcRandomiseCoordinate(u2ModLength) = <Byte length of P>;
PUKCL _GF2NEcRandomiseCoordinate(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL_GF2NEcRandomiseCoordinate(nu1RandomBase) = <Base of the ram location where the the rng is stored>;
PUKCL _GF2NEcRandomiseCoordinate(nu1PointBase) = <Base of the ram location of the point>;
PUKCL _GF2NEcRandomiseCoordinate(nu1Workspace) =
<Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(GF2NEcRandomiseCoordinate,&PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.7.7.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1RandomBase, nu1Workspace are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12},
{nu1RandomBase, u2ModLength + 4}, {nu1Workspace, <WorkspaceLength>} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1RandomBase, u2ModLength + 4} and {nu1Workspace, 3*u2ModLength + 28}
37.3.7.7.7 Status Returned Values Table 37-105. GF2NEcRandomiseCoordinate Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. 37.3.7.8 Point is on Elliptic Curve 37.3.7.8.1 Purpose This service is used to test whether the point is on the curve. 37.3.7.8.2 How to Use the Service 37.3.7.8.3 Description The operation performed is:
Status = IsPointOnCurve(X, Y, Z);
In this computation, the following parameters need to be provided:
The input points filled in projective coordinates (X, Y, Z) (pointed by {nu1PointBase, 3*U2ModLength + 4}). This point can be point at infinity. AParam and BParam are the Elliptic Curve Equation parameters (pointed by {nu1AParam, u2ModLength+ 4}
and {nu1BParam, u2ModLength + 4}). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 874 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Cns the Fast Modular Constant filled (pointed by {nu1CnsBase, u2ModLength + 8}) P the modulus filled (pointed by {nu1ModBase, u2ModLength + 8}) The workspace not initialized (pointed by {nu1WorkSpace, 4*u2ModLength + 28}) The service name for this operation is GF2NEcPointIsOnCurve. Important:Before using this service, the constant Cns must have been calculated with the Fast Modular Reduction service. 37.3.7.8.4 Parameters Definition Table 37-106. GF2NEcPointIsOnCurve Service Parameters Parameter Type Dir. Location Data Length Before Executing the Service After Executing the Service nu1ModBase nu1 nu1CnsBase nu1 u2ModLength u2 nu1PointBase nu1 nu1AParam nu1BParam nu1 nu1 nu1Workspace nu1 I I I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P Crypto RAM u2ModLength + 8 Base of Cns Base of Cns Length of modulus P Length of modulus P Crypto RAM 3*u2ModLength + 12 Input point Unchanged Crypto RAM u2ModLength + 4 The parameter a Unchanged Crypto RAM u2ModLength + 4 The parameter b Unchanged Crypto RAM 4*u2ModLength + 28 N/A Workspace 37.3.7.8.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL (u2Option) = 0;
// Depending on the option specified, not all fields must be filled PUKCL _GF2NEcPointIsOnCurve(nu1ModBase) = <Base of the ram location of P>;
PUKCL _GF2NEcPointIsOnCurve(u2ModLength) = <Byte length of P>;
PUKCL _GF2NEcPointIsOnCurve(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _GF2NEcPointIsOnCurve(nu1PointABase) = <Base of the A point>;
PUKCL _GF2NEcPointIsOnCurve(nu1AParam) = <Base of the ram location of the parameter a>;
PUKCL _GF2NEcPointIsOnCurve(nu1BParam) = <Base of the ram location of the parameter b>;
PUKCL _GF2NEcPointIsOnCurve(nu1PointBase) = <Base of the ram location of the point>;
PUKCL _GF2NEcPointIsOnCurve(nu1Workspace) = <Base of the ram location of the workspace>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKC L_Process(GF2NEcPointIsOnCurve, pvPUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.7.8.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure that the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1AParam, nu1BParam and nu1Workspace are not aligned on 32-bit boundaries 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 875 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12},
{nu1AParam, u2ModLength + 4}, {nu1BParam, u2ModLength + 4}, {nu1Workspace, 4*u2ModLength + 28} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1AParam, u2ModLength + 4}, {nu1BParam, u2ModLength + 4} and {nu1Workspace, 4*u2ModLength + 28}
37.3.7.8.7 Status Returned Values Table 37-107. GF2NEcPointIsOnCurve Service Return Codes Returned Status PUKCL_OK Importance Meaning The point is on the curve. PUKCL_POINT_IS_NOT_ON_CURVE Warning The point is not on the curve. PUKCL_POINT_AT_INFINITY Warning The input point has its Z equal to zero, so its a representation of the infinite point. 37.3.7.9 Generating an ECDSA Signature (Compliant with FIPS 186-2) 37.3.7.9.1 Purpose This service is used to generate an ECDSA signature following the FIPS 186-2. It performs the second step of the Signature Generation. A hash value (HashVal) must be provided as input, it has to be previously computed from the message to be signed using a secure hash algorithm. A scalar number must be provided, as described in the FIPS 186-2. The result (R,S) is computed by this service. If S equals zero, the status is set to PUKCL_WRONG_SELECT_NUMBER. 37.3.7.9.2 How to Use the Service 37.3.7.9.3 Description The operation performed is:
(R, S) = EcDsaSign(PtA, HashVal, k, CurveParameters, PrivateKey) This service processes the following checks:
If the Scalar Number k is out of the range [1, PointOrder -1], the calculus is stopped and the status is set to PUKCL_WRONG_SELECT_NUMBER. If R equals zero, the calculus is stopped and the status is set to PUKCL_WRONG_SELECT_NUMBER. If S equals zero, the calculus is stopped and the status is set to PUKCL_WRONG_SELECT_NUMBER. In this computation, the following parameters need to be provided:
A the input point is filled in mixed coordinates (X,Y) with the affine values and Z = 1 (pointed by
{nu1PointABase,3*u2ModLength + 12}) Cns the working space for the Fast Modular Constant not initialized (pointed by {nu1CnsBase,u2ScalarLength +
8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength + 4}) The workspace not initialized (pointed by {nu1WorkSpace, 8*u2ModLength + 44}
The a and b parameters relative to the elliptic curve equation (pointed by {nu1ABBase, 2*u2ModLength + 8}) The order of the Point A on the elliptic curve (pointed by {nu1OrderPointBase, u2ScalarLength + 4}) HashVal the hash value beforehand generated and filled (pointed by {nu1HashBase, u2ScalarLength +4}) The Private Key (pointed by {nu1PrivateKey, u2ScalarLength +4}) Generally u2ScalarLength is equal to (u2ModLength) or (u2ModLength + 4) k the input Scalar Number beforehand generated and filled (pointed by{nu1ScalarNumber,u2ScalarLength + 4}) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 876 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Important:
For the ECDSA signature generation be sure to follow the directives given for the RNG on the chip you use (particularly initialization, seeding) and compulsorily start the RNG. The scalar number k must be selected at random. This random must be generated before the call of the ECDSA signature. For this random generation be sure to follow the directives given for the RNG on the chip you use (particularly initialization, seeding) and compulsorily start the RNG. The operation performed is:
Compute the ECDSA (R,S) as described in FIPS 186-2, but leaving the user the role of computing the input Hash Value, thus leaving the freedom of using any other algorithm than SHA-1. Compute a R value using the input A point and the scalar number. Compute a S value using R, the scalar number, the private key and the provided hash value. Note that the resulting signature (R,S) is stored at the place of the input A point. If all is correct and S is different from zero, the status is set to PUKCL_OK. If all is correct and S equals zero,the status is set to PUKCL_WRONG_SELECT_NUMBER. If an error occurs, the status is set to the corresponding error value (see Status Returned Values below). The service name for this operation is GF2NEcDsaGenerateFast. The fast mode is used, the fast modular reduction is used in the computations. The signature (R,S), when resulting from a computation is given back at address of the A point:
The R value result with u2ModLength + 4 bytes (padded with zeros). The S value result with u2ModLength + 4 bytes (padded with zeros) The u2NLength + 4 following bytes (space for the third coordinate of A) are filled with zeros. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 877 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) After Executing the Service Base of modulus P 37.3.7.9.4 Parameters Definition Table 37-108. GF2NEcDsaGenerateFast Service Parameters Parameter Type Direction Location Data Length Before Executing the Service nu1ModBase nu1 nu1CnsBase nu1 u2ModLength u2 nu1ScalarNumber nu1 nu1OrderPointBase nu1 I I I I I Crypto RAM u2ModLength + 4 Base of modulus P Crypto RAM u2ScalarLength +
12 Base of Cns Base of Cns Length of modulus P Length of Crypto RAM u2ScalarLength + 4 Scalar Number used to multiply the point A modulus P Unchanged Crypto RAM u2ScalarLength + 4 Order of the Point A Unchanged in the elliptic curve nu1PrivateKey nu1 I/O Crypto RAM u2ScalarLength + 4 Base of the Private Unchanged Key nu1HashBase(1) nu1 u2ScalarLength u2 I I nu1PointABase nu1 I/O nu1ABase nu1 nu1Workspace nu1 I I Note:
Crypto RAM u2ScalarLength + 4 Base of the hash Unchanged value resulting from the previous SHA Length of scalar
(same length as the length of order) Length of scalar Crypto RAM 3*u2ModLength +
12 Input point A (three coordinates (X,Y) affine and Z = 1) Resulting signature
(R,S,0) Crypto RAM 2*u2ModLength + 8 Parameter a of the Unchanged elliptic curve Crypto RAM 8*u2ModLength +
44 Corrupted workspace 1. Whatever the chosen SHA, the resulting hash value may have a length inferior or equal to the modulo length and be padded with zeros until its total length is u2ModLength + 4. 37.3.7.9.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL (u2Option) = 0;
// Depending on the option specified, not all fields must be filled PUKCL _GF2NEcDsaGenerate(nu1ModBase) = <Base of the ram location of P>;
PUKCL _GF2NEcDsaGenerate(u2ModLength) = <Byte length of P>;
PUKCL _GF2NEcDsaGenerate(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _GF2NEcDsaGenerate(nu1PointABase) = <Base of the A point>;
PUKCL _GF2NEcDsaGenerate(nu1PrivateKey) = <Base of the Private Key>;
PUKCL _GF2NEcDsaGenerate(nu1ScalarNumber) = <Base of the ScalarNumber>;
PUKCL _GF2NEcDsaGenerate(nu1OrderPointBase) = <Base of the order of A point>;
PUKCL _GF2NEcDsaGenerate(nu1ABase) = <Base of the a parameter of the curve>; PUKCL _GF2NEcDsaGenerate(nu1Workspace) = <Base of the workspace>;
PUKCL _GF2NEcDsaGenerate(nu1HashBase) = <Base of the SHA resulting hash>;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 878 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(GF2NEcDsaGenerateFast, pvPUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else // Manage the error 37.3.7.9.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1PrivateKey, nu1ScalarNumber, nu1OrderPointBase,nu1ABase, nu1Workspace or nu1HashBase are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength+
12},{nu1PrivateKey, u2ScalarLength + 4},{nu1ScalarNumber, u2ScalarLength + 4},{nu1OrderPointBase, u2ScalarLength + 4}, {nu1ABase, u2ModLength + 4}, {nu1Workspace, <WorkspaceLength>} or {nu1HashBase, u2ScalarLength + 4} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1PrivateKey, u2ScalarLength + 4}, {nu1ScalarNumber, u2ScalarLength
+ 4}, {nu1OrderPointBase, u2ScalarLength + 4}, {nu1ABase, u2ModLength + 4}, {nu1Workspace,
<WorkspaceLength>} and {nu1HashBase, u2ScalarLength + 4}
37.3.7.9.7 Status Returned Values Table 37-109. GF2NEcDsaGenerate Fast Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without problem. PUKCL_WRONG_SELECTNUMBER Warning The given value for nu1ScalarNumber is not good to perform this signature generation. 37.3.7.10 Verifying an ECDSA Signature (Compliant with FIPS 186-2) 37.3.7.10.1 Purpose This service is used to verify an ECDSA signature following the FIPS 186-2. It performs the second step of the Signature Verification. A hash value (HashVal) must be provided as input, it has to be previously computed from the message to be signed using a secure hash algorithm. As second significant input, the Signature is provided to be checked. This service checks the signature and fills the status accordingly. 37.3.7.10.2 How to Use the Service 37.3.7.10.3 Description The operation performed is:
Verify = EcDsaVerifySignature(PtA, HashVal, Signature, CurveParameters, PublicKey) The points used for this operation are represented in different coordinate systems. In this computation, the following parameters need to be provided:
A the input point is filled with the affine values (X,Y) and Z = 1 (pointed by{nu1PointABase,3*u2ModLength +
12}) Cns the working space for the Fast Modular Constant not initialized (pointed by {nu1CnsBase,u2ScalarLength +
8}) P the modulus filled (pointed by {nu1ModBase,u2ModLength +4}) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 879 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) The workspace not initialized (pointed by {nu1WorkSpace, 8*u2ModLength +44} The a and b parameters relative to the elliptic curve (pointed by {nu1ABase,2*u2ModLength + 8}) The order of the Point A on the elliptic curve (pointed by {nu1OrderPointBase,u2ScalarLength +4}) HashVal the hash value beforehand generated and filled (pointed by {nu1HashBase,u2ScalarLength +4}) The Public Key point is filled in mixed coordinates (X,Y) with the affine values and Z = 1 (pointed by
{nu1PointPublicKeyGen, 3*u2ModLength + 12}) The input signature (R,S), even if it is not a Point, is represented in memory like a point in affine coordinates
(X,Y) (pointed by {nu1PointSignature, 2*u2ScalarLength + 8}) Important: For the ECDSA signature verification be sure to follow the directives given for the RNG on the chip you use (particularly initialization, seeding) and compulsorily start the RNG. The operation consists in obtaining a V value with all these input parameter and check that V equals the provided R. If all is correct and the signature is the good one, the status is set to PUKCL_OK. If all is correct and the signature is wrong, the status is set to PUKCL_WRONG_SIGNATURE. If an error occurs, the status is set to the corresponding error value (see Status Returned Values below). The service name for this operation is GF2NEcDsaVerifyFast. This service uses Fast mode and Fast Modular Reduction for computation. 37.3.7.10.4 Parameters Definition Table 37-110. GF2NEcDsaVerifyFast Service Parameters Parameter Type Direction Location Data Length nu1ModBase nu1CnsBase u2ModLength nu1 nu1 u2 nu1OrderPointBase nu1 nu1PointSignature nu1HashBase(1) nu1 nu1 u2ScalarLength u2 nu1PointABase nu1 nu1PointPublicKeyGen nu1 nu1ABase nu1 nu1Workspace nu1 I I I I I I I I/O I/O I I Before Executing the Service After Executing the Service Base of modulus P Base of modulus P Crypto RAM u2ModLength + 4 Crypto RAM u2ScalarLength + 8 Base of Cns Base of Cns Crypto RAM u2ScalarLength + 4 Length of modulus P Order of the Point A in the elliptic curve Length of modulus P Unchanged Crypto RAM 2*u2ScalarLength + 8 Signature(r, s) Corrupted Crypto RAM u2ScalarLength + 4 Base of the hash value resulting from the previous SHA Length of scalar Corrupted Length of scalar Crypto RAM 3*u2ModLength + 12 Generator point Corrupted Crypto RAM 3*u2ModLength + 12 Public point Corrupted Crypto RAM 2*u2ModLength + 8 Parameter a and b of the elliptic curve Unchanged Crypto RAM 8*u2ModLength + 44 Corrupted workspace 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 880 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Note:
1. Whatever the chosen SHA, the resulting hash value may have a length inferior or equal to the modulo length and be padded with zeros until its total length is u2ModLength + 4. 37.3.7.10.5 Code Example PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL (u2Option) = 0;
// Depending on the option specified, not all fields must be filled PUKCL _GF2NEcDsaVerify(nu1ModBase) = <Base of the ram location of P>;
PUKCL _GF2NEcDsaVerify(u2ModLength) = <Byte length of P>;
PUKCL _GF2NEcDsaVerify(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL _GF2NEcDsaVerify(nu1PointABase) = <Base of the A point>;
PUKCL _GF2NEcDsaVerify(nu1PrivateKey) = <Base of the Private Key>;
PUKCL _GF2NEcDsaVerify(nu1ScalarNumber) = <Base of the ScalarNumber>;
PUKCL _GF2NEcDsaVerify(nu1OrderPointBase) = <Base of the order of A point>;
PUKCL _GF2NEcDsaVerify(nu1ABase) = <Base of the a parameter of the curve>; PUKCL _GF2NEcDsaVerify(nu1Workspace) = <Base of the workspace>;
PUKCL _GF2NEcDsaVerify(nu1HashBase) = <Base of the SHA resulting hash>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library... vPUKCL_Process(GF2NEcDsaVerifyFast, &PUKCLParam);
if (PUKCL (u2Status) == PUKCL_OK)
else if(PUKCL(u2Status) == PUKCL_WRONG_SIGNATURE)
else // Manage the error 37.3.7.10.6 Constraints No overlapping between either input and output are allowed. The following conditions must be avoided to ensure the service works correctly:
nu1ModBase, nu1CnsBase, nu1PointABase, nu1PointPublicKeyGen, nu1PointSignature, nu1OrderPointBase,nu1ABBase, nu1Workspace or nu1HashBase are not aligned on 32-bit boundaries
{nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength
+ 12}, {nu1PointPublicKeyGen, 3*u2ModLength + 12}, {nu1PointSignature,2*u2ScalarLength + 8},
{nu1OrderPointBase, u2ScalarLength + 4}, {nu1ABBase, 2*u2ModLength + 8}, {nu1Workspace,
<WorkspaceLength>} or {nu1HashBase, u2ScalarLength + 4} are not in Crypto RAM u2ModLength is either: < 12, > 0xffc or not a 32-bit length All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1PointPublicKeyGen, 3*u2ModLength + 12}, {nu1PointSignature, 2*u2ScalarLength
+ 8}, {nu1OrderPointBase, u2ScalarLength + 4}, {nu1ABBase, 2*u2ModLength + 8}, {nu1Workspace,
<WorkspaceLength>} and {nu1HashBase, u2ScalarLength + 4}
37.3.7.10.7 Status Returned Values Table 37-111. GF2NEcDsaVerifyFast Service Return Codes Returned Status Importance Meaning PUKCL_OK The computation passed without errors. The signature is correct. PUKCL_WRONG_SIGNATURE Warning The signature is incorrect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 881 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.8 PUKCL Requirements and Performance 37.3.8.1 Services Stack Usage This library is using the main core to execute its computations, and therefore is also sharing some resources with the application. It may be important for the application to know RAM usage by the library functions and to be aware that the library does not use any global variables. The following table provides the minimum number of bytes used by the library that have to be available on the stacks to ensure that the functionality can be executed correctly. In some cases, the library may use less bytes than the specified number for some options. This table contains estimated values. Table 37-112. Services Stack Usage PUKCL Service STACK Usage (Bytes) SelfTest ClearFlags Swap Fill CondCopy FastCopy Smult Smult (with reduction) Comp Fmult Fmult (with reduction) Square Square (with reduction) Div GCD RedMod (Setup) RedMod (using fast reduction) RedMod (randomize) RedMod (Normalize) RedMod (Using Division) ExpMod PrimeGen CRT ZpEccAddFast ZpEccAddSubFast ZpEcConvProjToAffine ZpEcConvAffineToProjective 112 0 8 8 24 16 16 88 8 24 96 16 88 144 136 160 80 80 80 184 200 416 304 104 92 280 64 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 882
...........continued PUKCL Service ZpEccDblFast ZpEccMulFast ZpEccQuickDualMulFast ZpEcDsaGenerateFast ZpEcDsaVerifyFast ZpEcDsaQuickVerify ZpEcRandomiseCoordinate GF2NEccAddFast GF2NEcConvProjToAffine GF2NEcConvAffineToProjective GF2NEccDblFast GF2NEccMulFast GF2NEcDsaGenerateFast GF2NEcDsaVerifyFast GF2NEcRandomiseCoordinate PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) STACK Usage (Bytes) 96 168 216 392 456 368 56 128 264 56 136 208 376 440 56 37.3.8.2 Parameter Size Limits for Different Services The following table lists parameter size limits for different services. For the services ModExp, PrimeGen, and CRT, additional details are available in the service description. Table 37-113. Parameter Size Limits API SelfTest ClearFlags Swap Fill Min/Max Sizes Comments 4 bytes to 2044 bytes 4 bytes to 4088 bytes Per block to be swapped Fast Copy/Clear 4 bytes to 2044 bytes Supposing Length(R) = Length(X) Conditional Copy/Clear 4 bytes to 2044 bytes Supposing Length(R) = Length(X) Smult 4 bytes to 2040 bytes Supposing Length(R) = Length(X) + 4 Bytes, No Z Parameter, No Reduction Compare FMult 4 bytes to 2044 bytes Supposing Length(X) = Length(Y) Input: 4 bytes to 1020 bytes Output: 4bytes to 2040 bytes Supposing Length(Y) = Length(X), No Z Parameter, No Reduction Square Input: 4 bytes to 1020 bytes Output: 4 bytes to 2040 bytes Euclidean Division Divider: 8 to 1016 bytes Num.: 8 to 2032 bytes Supposing No Z Parameter, No Reduction Supposing Length(Num) =
2*Length(Divider) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 883 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued API Min/Max Sizes Mod. inv. / GCD 8 to 1012 bytes Comments ModRed Modulus: 12 to 1016 bytes Supposing RBase = XBase Input: 24 to 2032 bytes Fast ModExp Exp in Crypto RAM 12 to 576 bytes
(96 to 4608 bits) Fast ModExp 12 to 672 bytes Exp not in Crypto RAM
(96 to 5376 bits) Supposing Length(Exponent) =
Length(Modulus), Window Size = 1 With the Exponent in Crypto RAM Supposing Length(Exponent) =
Length(Modulus), Window Size = 1 With the Exponent not in Crypto RAM Prime Gen. Prime Number: 12 to 448 bytes Supposing Window Size = 1
(96 to 3584 bits) CRT Modulus = Two Primes:
Size of one prime from 24 to 448 bytes Modulus = from 48 to 896 bytes
(384 to 7168 bits) Modulus: 12 to 308 bytes ECC Addition qnd Subtraction GF(p) ECC Doubling GF(p) Modulus: 12 to 400 bytes ECC Multiplication GF(p) Modulus: 12 to 264 bytes Supposing Length(Exponent) =
Length(Modulus), Window Size = 1 Supposing Length(Scalar) =
Length(Modulus) ECC Quick Dual Multiplication GF(p) Modulus: 12 to 152 bytes ECDSA Generate GF(p) Modulus: 12 to 220 bytes
(up to 521 bits for common curves) ECDSA Verify GF(p) Modulus: 12 to 188 bytes
(up to 521 bits for common curves) Supposing Length(Scalar) =
Length(Modulus) Supposing Length(Scalar) =
Length(Modulus) ECC Addition GF(2n) Modulus: 12 to 248 bytes ECC Doubling GF(2n) Modulus: 12 to 364 bytes ECC Multiplication GF(2n) Modulus: 12 to 250 bytes ECDSA Generate GF(2n) Modulus: 12 to 208 bytes
(up to 571 bits for common curves) ECDSA Verify GF(2n) Modulus: 12 to 180 bytes
(up to 571 bits for common curves) ECDSA Quick Verify GF(2n) Modulus: 12 to 140 bytes
(up to 571 bits for common curves) Supposing Length(Scalar) =
Length(Modulus) Supposing Length(Scalar) =
Length(Modulus) Supposing Length(Scalar) =
Length(Modulus) Supposing Length(Scalar) =
Length(Modulus) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 884 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) 37.3.8.3 Service Timing The values in the following tables are estimated performances for CPU clock of 64 MHz. The CPU and PUKCC are operated at the same frequency. Due to possible change in the parameters values, the measurements show approximated values. Other test conditions:
PUKCL library data in Crypto RAM Test code and test data in SRAM ICache and DCache are disabled 37.3.8.3.1 Service Timing for RSA RSA uses the ExpMod service for encryption and decryption. Following tables show service timing, where W indicates window size. Table 37-114. RSA1024 Operation Clock Cycles Timing one block RSA 1024 decryption / signature generation. No CRT, Regular implementation, W=4 3.05 MCycles 47.799 ms RSA 1024 decryption / signature generation. 1.09 MCycles 17.109 ms With CRT, Regular implementation, W=4 RSA 1024 encryption / signature verification. 0.07 MCycles 1.141 ms No CRT, Fast implementation, W=1 Exponent=3 RSA 1024 encryption / signature verification. 0.07 MCycles 1.129 ms No CRT, Fast implementation, W=1 Exponent=0x10001 Table 37-115. RSA2048 Operation Clock Cycles Timing One block RSA 2048 decryption / signature generation. 21.6 MCycles 338.249 ms No CRT, Regular implementation, W=4 RSA 2048 decryption / signature generation. With CRT, Regular implementation, W=4 6.36 MCycles 99.408 ms RSA 2048 encryption / signature verification. 0.24 MCycles 3.843 ms No CRT, Fast implementation, W=1 Exponent=3 RSA 2048 encryption / signature verification. 0.24 MCycles 3.827 ms No CRT, Fast implementation, W=1 Exponent=0x10001 Table 37-116. RSA4096 Operation Clock Cycles Timing One block RSA 4096 Decryption / signature generation. No CRT, Regular implementation, W=1 209 MCycles 3.2742s RSA 4096 Decryption / signature generation. With CRT, Regular implementation, W=3 46.1 MCycles 720.95 ms RSA 4096 encryption / signature verification. 0.91 MCycles 14.346 ms No CRT, Fast implementation, W=1 Exponent=3 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 885 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC)
...........continued Operation Clock Cycles Timing One block RSA 4096 encryption / signature verification. 0.91 MCycles 14.337 ms No CRT, Fast implementation, W=1 Exponent=0x10001 37.3.8.3.2 Service Timing for Prime Generation Prime generation uses the PrimeGen service. Table 37-117. Prime Generation Operation Regular Generation of two primes, Prime_Length=512 bits, W=4, Rabin Miller Iterations Number = 3, (average of 200 samples) Clock Cycles Timing One Block Mean = 47.4 MCycles Mean = 0.4s Regular Generation of two primes, Prime_Length=512 bits, W=4, Rabin Miller Iterations Number = 3, (Standard Deviation for 200 samples) Std Dev = 30.3 Mcycles Std Dev = 0.47s Regular Generation of two primes, Prime_Length=1024 bits, W=4, Rabin Miller Iterations Number = 3, (average of 200 samples) Mean = 419.71 MCycles Mean = 6.558s Regular Generation of two primes, Prime_Length=1024 bits, W=4, Rabin Miller Iterations Number = 3, (Standard Deviation for 200 samples) Std Dev = 294 Mcycles Std Dev = 4.59s Regular Generation of two primes, Prime_Length=2048 bits, W=4, Rabin Miller Iterations Number = 3, (average of 200 samples) Mean = 4.78 GCycles Mean = 74.68s Regular Generation of two primes, Prime_Length=2048 bits, W=4, Rabin Miller Iterations Number = 3, (Standard Deviation for 200 samples) Std Dev = 3.05 GCycles Std Dev = 47.65s 37.3.8.3.3 Service Timing for ECDSA on Prime Field In the following table, ECDSA signature generation uses the ZpEcDsaGenerateFast service and signature verification uses ZpEcDsaQuickVerify Table 37-118. ECDSA GF(p) Operation Clock Cycles Timing One block ECDSA GF(p) 256 Generate Fast ECDSA GF(p) 256 Verify Quick W=(4,4) Scalar in PUKCC RAM ECDSA GF(p) 384 Generate Fast ECDSA GF(p) 384 Verify Quick W=(4,4) Scalar in PUKCC RAM 2.67 MCycles 1.84 MCycles 6.18 MCycles 4.15 MCycles 41.864 ms 28.888 ms 96.712 ms 64.868 ms ECDSA GF(p) 521 Generate Fast 13.36 MCycles 208.869 ms ECDSA GF(p) 521 Verify Quick W=(4,4) 8.81 MCycles 137.711 ms Scalar in PUKCC RAM 37.3.8.3.4 Service Timing for ECDSA on Binary Field In the following table, ECDSA signature generation uses the GF2NEcDsaGenerateFast service and signature verification uses GF2NEcDsaVerifyFast 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 886 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) Table 37-119. ECDSA GF(2n) Operation CPU Cycles Timing One block ECDSA GF(2n) B283 Generate Fast 3.21 MCycles 50.301 ms ECDSA GF(2n) B283 Verify ECDSA GF(2n) B409 Generate Fast ECDSA GF(2n) B409 Verify ECDSA GF(2n) B571 Generate Fast ECDSA GF(2n) B571 Verify 6.40 MCycles 6.94 Mcycles 13.73 Mcycles 15.08 Mcycles 100.150 ms 108.554 ms 214.571 ms 235.704 ms 30.07 MCycles 469.972 ms 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 887 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38. Analog-to-Digital Converter (ADC) 38.1 Overview The PIC32CX-BZ2 12-bit High Speed Successive Approximation Register (SAR) Analog-to-Digital Converter (ADC) includes the following features:
12-bit resolution One ADC module, up to 2 Msps conversion rate Single-ended and/or differential input Supported in Sleep mode Two digital comparators Two digital filters supporting two modes:
Oversampling mode Averaging mode Designed for motor control, power conversion and general purpose applications The PIC32CX-BZ2 has one shared ADC module. This ADC module incorporates a multiplexer on the input to facilitate a group of inputs and provides a flexible automated scanning option through the input scan logic. For the ADC module, the analog inputs are connected to the Sample and Hold (S&H) capacitor. The ADC module performs the conversion of the input analog signal based on the configurations set in the registers. When the conversion is complete, the final result is stored in the result buffer for the specific analog input and is passed to the digital filter and digital comparator if configured to use data from this particular sample. Equation 38-1.ADC Throughput Rate FTP =
Where, TAD TSAMP + TCONV TAD = The frequency of the individual ADC module. A block diagram of the ADC module is illustrated in the following figure. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 888 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Figure 38-1. ADC Block Diagram K L C _ 2 B P 3 K L C F E R AVDD AVSS ADCSEL [1:0]
00 01 10 11 TCLK CONCLKDIV [5:0]
(ADCCON3) TAD ADCDIV [6:0]
(ADCCON2 [6:0] )
(ADCCON3)
(ADINSEL[5:0]) IVref (AN8) IVtest_vdd1v2 (AN9) IVddcore_ana (AN10) IVpmu_test (AN11) ANN0 1
(ADIMOD1) VREFSEL[2:0]
(ADCCON3) AN1 AN6 AN7 ADC7 ADCDATA0
... ADCDATA11 Triggers, Scan Control Logic Trigger Digital Filter Data Digital Comparator Interrupt/Event S U B M E T S Y S Status and Control Registers Interrupt 38.2 ADC Operation The High Speed Successive Approximation Register (SAR) ADC is designed to support power conversion and motor control applications and consists of one shared ADC module. The shared ADC module has multiple analog inputs connected to its S&H circuit through a multiplexer. Multiple analog inputs share this ADC; therefore, it is termed the shared ADC module. The shared ADC module is used to measure analog signals of lower frequencies and signals that are static in nature (in other words, do not change significantly with time). However, this ADC module is capable of up to 2 Msps sample rate. The analog inputs connected to the shared ADC module are Class 2 and Class 3 inputs. The number of inputs designated for each class depends on the specific device. For the PIC32CX-BZ2, the following arrangement is provided. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 889 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Class 2 = AN0 to AN5 Class 3 = AN6 to AN7 The property of each class of analog input is described in the following table. Table 38-1. Analog Input Class ADC Module Analog Input Class Trigger Trigger Action Shared ADC module Class 2 Individual trigger source or scan trigger Starts sampling sequence or begins scan sequence Shared ADC module with input scan Class 3 Scan trigger Starts scan sequence Class 2 and Class 3 analog input properties:
Class 2 inputs are used on the shared ADC module, either individually triggered or as part of a scan list. When used individually, they are triggered by their unique trigger selected by the ADCTRGx register. The analog inputs on the shared ADC have a natural order of priority (for example, AN6 has a higher priority than AN7). Class 3 inputs are used exclusively for scanning and share a common trigger source (scan trigger). Class 3 analog inputs share both the ADC module and the trigger source; therefore, the only method possible to convert them is to scan them sequentially for each incoming scan trigger event, where scanning occurs in the natural order of priority. The arrival of a trigger in the shared ADC module only starts the sampling. When the trigger arrives, the ADC module goes into sampling mode for the sampling time decided by the SAMC[9:0] bits (ADCCON2[25:16]). At the end of sampling, the ADC starts conversion. Upon completion of conversion, the ADC module is used to convert the next in line Class 2 or Class 3 inputs according to the natural order of priority. When a shared analog input (Class 2 or Class 3) has completed all conversion and no trigger is pending, the ADC module is disconnected from all analog inputs Figure 38-2. Sample and Conversion Sequence for Shared ADC Modules 38.2.1 Class 2 Triggering When a single Class 2 input is triggered, it is sampled and converted by the shared S&H using the sequence illustrated in Sample and Conversion Sequence for the Shared ADC Modules figure; see Sample and Conversion Sequence for Shared ADC Modules figure in the ADC Operation from Related Links. When multiple Class 2 inputs are triggered, it is important to understand the consequences of trigger timing. If a conversion is underway and 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 890 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) another Class 2 trigger occurs, then the sample-hold-conversion for the new trigger is stalled until the in-process, sample-hold cycle is complete, as shown in the following figure. Figure 38-3. Multiple Independent Class 2 Trigger Conversion Sequence AN1 AN1 AN2 AN2 AN1 AN1 AN2 AN2 AN1 AN2 When multiple inputs to the shared S&H are triggered simultaneously, the processing order is determined by their natural priority (the lowest numbered input has the highest priority). As an example, if AN1, AN2 and AN3 are triggered simultaneously, AN1 is sampled and converted first, followed by AN2 and finally, AN3. When using the independent Class 2 triggering on the shared S&H, the SAMC[9:0] bits (ADCCON2[25:16]) determine the sample time for all inputs while the appropriate TRGSRC[4:0] bits in the ADCTRGx Register (see ADCTRG1 register from Related Links) determine the trigger source for each input. Related Links 38.11.15. ADCTRG1 38.2. ADC Operation 38.2.2 Input Scan Input scanning is a feature that allows an automated scanning sequence of multiple Class 2 or Class 3 inputs. All Class 2 and Class 3 inputs are scanned using the single shared S&H. The selection of analog inputs for scanning is done with the CSSx bits of the ADCCSS1 registers. Class 2 inputs are triggered using STRIG selection in the ADCTRGx register, and Class 3 inputs are triggered using the STRGSRC[4:0] of the ADCCON1[20:16] register. When a trigger occurs for Class 2 or Class 3 inputs, the sampling and conversion occur in the natural input order is used; lower number inputs are sampled before higher number inputs. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 891 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Figure 38-4. Input Scan Conversion Sequence for Three Class 2 Inputs AN1 AN1 AN2 AN2 AN3 AN3 AN1 AN2 AN3 When using the shared analog inputs in scan mode, the SAMC[9:0] bits in the ADC Control Register 2
(ADCCON2[25:16]) determine the sample time for all inputs, while the Scan Trigger Source Selection bits
(STRGSRC[4:0]) in the ADC Control Register 1 (ADCCON1[20:16]) determine the trigger source. To ensure predictable results, a scan must not be retriggered until a sampling of all inputs is complete. Ensure system design to preclude retriggering a scan while a scan is in progress. Individual Class 2 triggers that occur during a scan preempts the scan sequence if they are a higher priority than the sample currently being processed. In the following figure, a scan of AN5, AN6 and AN7 is underway when an independent trigger of Class 2 input AN2 takes place. The scan is interrupted for the sampling and conversion of AN2. Figure 38-5. Scan Conversion Pre-empted by Class 2 Input Trigger AN5 AN6 AN2 AN7 AN2 AN7 AN2 AN2 AN6 AN6 AN5 AN5 AN6 AN6 AN2 AN2 AN7 AN7 AN5 AN6 AN2 AN7 38.3 ADC Module Configuration Operation of the ADC module is directed through bit settings in the specific registers. The following instructions summarize the actions and the settings. The options and details for each configuration step are provided in the subsequent sections. To configure the ADC module, perform the following steps:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 892 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 3. 4. 5. 6. 7. 1. Configure the analog port pins as described in 38.3.1. Configuring the Analog Port Pins. 2. Select the analog inputs to the ADC multiplexers as described in 38.3.2. Selecting the ADC Multiplexer Analog Inputs. Select the format of the ADC result as described in 38.3.3. Selecting the Format of the ADC Result. Select the conversion trigger source as described in 38.3.4. Selecting the Conversion Trigger Source. Select the voltage reference source as described in 38.3.5. Selecting the Voltage Reference Source. Select the scanned inputs as described in 38.3.6. Selecting the Scanned Inputs. Select the analog-to-digital conversion clock source and prescaler as described in 38.3.7. Selecting the Analog-to-Digital Conversion Clock Source and Prescaler. Specify any additional acquisition time (if required) as described in 38.9. ADC Sampling Requirements. Turn on the ADC module as described in 38.3.8. Turning ON the ADC. 8. 9. 10. Poll (or wait for the interrupt) for the voltage reference to be ready as described in 38.3.5. Selecting the Voltage Reference Source. 11. Enable the analog and bias circuit for the required ADC modules, and, after the ADC module wakes up, enable the digital circuit as described in 38.6.3. Low-Power Mode. 12. Configure the ADC interrupts (if required) as described in 38.5. Interrupts. 38.3.1 Configuring the Analog Port Pins The ANSELx registers for the I/O ports associated with the analog inputs are used to configure the corresponding pin as an analog or a digital pin. A pin is configured as an analog input when the corresponding ANSELx bit = 1. When the ANSELx bit = 0, the pin is set to digital control. The ANSELx registers are set when the device comes out of Reset, causing the ADC input pins to be configured as analog inputs by default. The TRISx registers control the digital function of the port pins. The port pins that are required as analog inputs must have their corresponding bit set in the specific TRISx register, configuring the pin as an input. If the I/O pin associated with an ADC input is configured as an output by clearing the TRISx bit, the ports digital output level (VOH or VOL) is converted. After a device Reset, all of the TRISx bits are set. For more information on port pin configuration, see I/O Ports and Peripheral Pin Select (PPS) from Related Links. Note:When reading a PORT register that shares pins with the ADC, any pin configured as an analog input reads as 0 when the PORT latch is read. Analog levels on any pin that is defined as a digital input but not configured as an analog input, may cause the input buffer to consume the current that exceeds the device specification. Related Links 6. I/O Ports and Peripheral Pin Select (PPS) 38.3.2 Selecting the ADC Multiplexer Analog Inputs The ADC module has two inputs, referred to as the positive and negative inputs. Input selection options vary as described in the following sections. 38.3.2.1 Selection of Positive Inputs For the shared ADC module, the positive input is shared among all Class 2 and Class 3 inputs. Input connection of the analog input ANx to the shared ADC is automatic for either the Class 2 input trigger or during a scan of Class 2 and or Class 3 inputs. Selecting inputs for scanning is described in Selecting the Scanned Inputs from Related Links. Related Links 38.3.6. Selecting the Scanned Inputs 38.3.2.2 Selection of Negative Inputs Negative input selection is determined by the setting of the DIFFx bit of the ADCIMCON1 register. The DIFFx bit allows the inputs to be rail-to-rail and either single-ended or differential. The SIGNx and DIFFx bits in the ADCIMCON1 register scale the internal ADC analog inputs and reference voltages and configure the digital result to align with the expected full-scale output range. For the shared ADC module, the analog inputs have individual settings for the DIFFx bit. Therefore, the user has the ability to select certain inputs as single-ended and others as differential while being connected to the same shared ADC module. While sampling, the signal changes on-the-fly as single-ended or differential according to its corresponding DIFFx bit setting. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 893 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Table 38-2. Negative Input Selection ADCIMCON1 Input Configuration Input Voltage DIFFx SIGNx 1 1 0 0 1 0 1 0 Differential 2s complement Minimum input VINP - VINN = -VREF Maximum input VINP - VINN = VREF Differential unipolar Minimum input VINP - VINN = -VREF 0 Single-ended 2s complement Maximum input VINP - VINN = VREF Minimum input VINP = VREF Maximum input VINP - VINN = VREF Single-ended unipolar Minimum input VINP = VREF
+4095
-2048
+2047 0 Maximum input VINP - VINN = VREF
+4095 Output
-2048
+2047 Legend:
VINP = Positive S&H input VINN = Negative S&H input VREF = VREFH - VREFL Note:For proper operation and to prevent device damage, input voltage levels must not exceed the limits listed in the Electrical Specifications. 38.3.3 Selecting the Format of the ADC Result The data in the ADC Result register can be read in any of the four supported data formats. The user can select from unsigned integer, signed integer, unsigned fractional or signed fractional. Integer data is right-justified and fractional data is left-justified. The integer or fractional data format selection is specified globally for all analog inputs using the Fractional Data Output Format bit, FRACT (ADCCON1[23]). The signed or unsigned data format selection can be independently specified for each individual analog input using the SIGNx bits in the ADCIMCONx registers
. The following table provides how a result is formatted. Table 38-3. ADC Result Format FRACT SIGNx Description 32-bit Output Data Format 0 0 1 1 0 1 0 1 Unsigned integer Signed integer Fractional Signed fractional 0000 0000 ssss ssss dddd 0000 sddd 0000 0000 dddd ssss sddd dddd 0000 dddd 0000 0000 dddd ssss dddd dddd 0000 dddd 0000 0000 dddd ssss dddd 0000 0000 dddd 0000 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 894 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) The following code is an example for ADC Class 2 configuration and fractional format. int main(int argc, char** argv) {
int result[3];
/* Configure ADCCON1 */
ADCCON1bits.FRACT = 1; // use Fractional output format ADCCON1bits.SELRES = 3; // ADC resolution is 12 bits ADCCON1bits.STRGSRC = 0; // No scan trigger.
/* Configure ADCCON2 */
ADCCON2bits.SAMC = 5; // ADC sampling time = 5 * TAD7 ADCCON2bits.ADCDIV = 1; // ADC clock freq is half of control clock = TAD7
/* Initialize warm up time register */ ADCANCON = 0;
ADCANCONbits.WKUPCLKCNT = 5; // Wakeup exponent = 32 * TADx
/* Clock setting */ ADCCON3 = 0;
ADCCON3bits.ADCSEL = 0; // Select input clock source ADCCON3bits.CONCLKDIV = 1; // Control clock frequency is half of input clock ADCCON3bits.VREFSEL = 0; // Select AVDD and AVSS as reference source
/* No selection for dedicated ADC modules, no presync trigger, not sync sampling */
ADCTRGMODEbits = 0;
/* Select ADC input mode */
ADCIMCON1bits.SIGN7 = 0; // unsigned data format ADCIMCON1bits.DIFF7 = 0; // Single ended mode ADCIMCON1bits.SIGN8 = 0; // unsigned data format ADCIMCON1bits.DIFF8 = 0; // Single ended mode ADCIMCON1bits.SIGN9 = 0; // unsigned data format ADCIMCON1bits.DIFF9 = 0; //
Single ended mode
/* Configure ADCGIRQENx */
ADCGIRQEN1 = 0; // No interrupts are used ADCGIRQEN2 = 0;
/* Configure ADCCSSx */
ADCCSS1 = 0; // No scanning is used ADCCSS2 = 0;
/* Configure ADCCMPCONx */
ADCCMPCON1 = 0; // No digital comparators are used. Setting the ADCCMPCONx ADCCMPCON2 = 0; // register to '0' ensures that the comparator is disabled. ADCCMPCON3 = 0; // Other registers are don't care. ADCCMPCON4 = 0;
ADCCMPCON5 = 0; ADCCMPCON6 = 0;
/* Configure ADCFLTRx */
ADCFLTR1 = 0; // No oversampling filters are used. ADCFLTR2 = 0;
ADCFLTR3 = 0; ADCFLTR4 = 0; ADCFLTR5 = 0; ADCFLTR6 = 0;
/* Set up the trigger sources */
ADCTRGSNSbits.LVL7 = 0; // Edge trigger ADCTRGSNSbits.LVL8 = 0; // Edge trigger ADCTRGSNSbits.LVL9 = 0; // Edge trigger ADC1TRG2bits.TRGSRC7 = 1; // Set AN7 to trigger from software ADC2TRG3bits.TRGSRC8 = 1; // Set AN8 to trigger from software ADC2TRG3bits.TRGSRC9 = 1; // Set AN9 to trigger from software
/* Early interrupt */
ADCEIEN1 = 0; // No early interrupt ADCEIEN2 = 0;
/* Turn the ADC on */ ADCCON1bits.ON = 1;
/* Wait for voltage reference to be stable */
while(!ADCCON2bits.BGVRRDY); // Wait until the reference voltage is ready while(ADCCON2bits.REFFLT); // Wait if there is a fault with the reference voltage
/* Enable clock to analog circuit */
ADCANCONbits.ANEN7 = 1; // Enable the clock to analog bias
/* Wait for ADC to be ready */
while(!ADCANCONbits.WKRDY7); // Wait until ADC7 is ready
/* Enable the ADC module */ ADCCON3bits.DIGEN7 = 1; // Enable ADC7 while (1) {
/* Trigger a conversion */ ADCCON3bits.GSWTRG = 1;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 895 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC)
/* Wait the conversions to complete */
while (ADCDSTAT1bits.ARDY7 == 0);
/* fetch the result */
result[0] = ADCDATA7;
while (ADCDSTAT1bits.ARDY8 == 0);
/* fetch the result */
result[1] = ADCDATA8;
while (ADCDSTAT1bits.ARDY9 == 0);
/* fetch the result */
result[2] = ADCDATA9;
* Process results here
* Note 1: Loop time determines the sampling time since all inputs are Class 2.
* If the loop time happens is small and the next trigger happens before the
* completion of set sample time, the conversion will happen only after the
* sample time has elapsed.
* Note 2: Results are in fractional format
return (1);
38.3.4 Selecting the Conversion Trigger Source Class 2 inputs to the ADC module can be triggered for conversion either individually or as part of a scan sequence. Class 3 inputs can only be triggered as part of a scan sequence. Individual or scan triggers can originate from an on-board timer or output compare peripheral event, from external digital circuits connected to INT0, from external analog circuits connected to an analog comparator or through software by setting a trigger bit in an SFR. Note:When conversion triggers for multiple Class 2 analog inputs occur simultaneously, they are prioritized according to a natural order priority scheme based on the analog input used. AN6 has the highest priority, AN7 has the next highest priority and so on. 38.3.4.1 Trigger Selection Class 2 Inputs For each one of the Class 2 inputs, the user application can independently specify a conversion trigger source. The individual trigger source for an analog input x is specified by the TRGSRC[4:0] bits located in registers ADCTRG1 through ADCTRG3. For example, these trigger sources may include:
General Purpose (GP) Timers: When a period match occurs for the 32-bit timer, Timer3/2 or Timer5/4, or the 16-bit Timer1, Timer3 or Timer5, a special ADC trigger event signal is generated by the timer. This feature does not exist for other timers. For more information, see Timer/Counter (TC) from Related Links. Output Compare: The Output Compare peripherals, OC1, OC3 and OC5, can be used to generate an ADC trigger, then the output transitions from a low to high state. For more information, see Timer/Counter (TC) from Related Links. Comparators: The analog Comparators can be used to generate an ADC trigger when the output transitions from a low state to a high state. For more information, see Digital Comparator from Related Links. External INT0 Pin Trigger: In this mode, the ADC module starts a conversion on an active transition on the INT0 pin. The INT0 pin may be programmed for either a rising edge input or a falling edge input to trigger the conversion process. Global Software Trigger: The ADC module can be configured for manually triggering a conversion for all inputs that have selected this trigger option. The user can manually trigger a conversion by setting the Global Software Trigger bit, GSWTRG (ADCCON3[6]). Related Links 38.4.1. Digital Comparator 40. Timer/Counter (TC) 38.3.4.2 Conversion Trigger Sources and Control The following are the possible sources for each trigger signal:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 896 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) External trigger selection through the TRGSRCx[4:0] bits in the ADCTRGx registers. This capability is supported only for Class 2 analog inputs. Typically, the user specifies a particular trigger source to initiate a conversion for specific input. All of the analog inputs may select the same trigger source if desired. In such an event, the result resembles a scanned conversion, which has its order of completion enforced by the priority of the inputs associated with the same trigger source. The first trigger selection is 00000 (no trigger), which amounts to temporarily disabling that particular trigger and, consequently, temporarily disabling that analog input from being converted. The next two selections for trigger source (GSWTRG and GLSWTRG) are software-generated trigger sources. The second software-generated trigger selection is the Global Software Trigger (GSWTRG). This trigger links to the GSWTRG bit in the ADCCON3 register, which may be used to enable the user application to initiate a single conversion. GSWTRG is a self-clearing bit; therefore, it clears itself on the next ADC clock cycle after being set by the user application. The third software-generated trigger selection is the Global Level Software Trigger (GLSWTRG), which is linked to the GLSWTRG bit in the ADCCON3 register. This trigger may be used by the user application to initiate a burst of consecutive samples as the GLSWTRG bit is not self-clearing. The fourth trigger selection is a special selection, the Scan Trigger selection, which allows the Class 2 analog inputs to be included as members of a global scan of all inputs. Scanned trigger selection via the STRGSRC[4:0] bits in the ADCCON1 register and select bits in the ADCCSS1 registers. This mode is typically used to initiate the conversion of a group of analog inputs. This capability works for 2 and 3 analog inputs but is typically used for Class 3 inputs because they do not have individual associated TRGSRC bits. One of the trigger selections is the GSWTRG bit in the ADCCON3 register, which may be used to enable the user software to initiate a conversion. User initiated trigger via the ADINSEL[5:0] bits and the RQCNVRT bit in the ADCCON3 register. This mode enables the user application to create an individual conversion trigger request for a specified analog input. Using this mode enables the user application to trigger the conversion of an input without changing the trigger source configuration of the ADC. This is useful in handling error situations where another software module wants ADC information without disrupting the normal operation of the ADC. This is also the preferred method to generate the initial trigger to start a digital filter sequence. User-controlled sampling of Class 2 and Class 3 inputs via the ADINSEL[5:0] bits and the SAMP bit in the ADCCON3 register. Setting the SAMP bit causes the Class 2 and Class 3 inputs to be in Sampling mode while ignoring the selection of the SAMC[9:0] bits. This mode is also useful in software conversion of ADC with software-selectable sample time. External module (such as PTG) may specify an analog input for conversion via the setting of the ECRIEN bit in the ADCCON2 register. This method operates independently of the normal TRGSRC and STRGSRC methods. External modules may still use individual trigger signals and initiate conversions via the normal TRGSRC and STRGSRC methods. 38.3.4.3 User-Requested Individual Conversion Trigger (Software ADC Conversion) (Only for Class 2 and Class 3 Inputs) The user can explicitly request a single conversion (by software) of any selected analog input at any time during program execution without changing the trigger source configuration of the ADC. The steps to be followed for conversion are as follows:
The analog input ID to be converted is specified by the ADC Input Select bits, ADINSEL[5:0] (ADCCON3[5:0]). The sampling of analog input is started by setting the SAMP bit (ADCCON3[9]). After the required sampling time (time delay), the SAMP bit is cleared. The conversion of sampled signal is started by setting the RQCNVRT bit (ADCCON3[8]). 1. 2. 3. 4. 5. Once the conversion is complete, the ARDYx bit of the ADCDSTATx register is set. The data can be read from the ADCDATAx register. The following figure illustrates the conversion process in graphical form. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 897 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Figure 38-6. Individual Conversion Trigger Process AN6 AN7 AN6 AN6 AN7 AN7 AN6 AN7 38.3.5 Selecting the Voltage Reference Source The user application can select the voltage reference for the ADC module, which can be internal or external. The Voltage Reference Input Selection bits, VREFSEL[2:0] (ADCCON3[15:13]), select the voltage reference for analog-to-digital conversions. The upper voltage reference (VREFH) and the lower voltage reference (VREFL) may be the internal AVDD and AVSS voltage rails or the band gap reference generator or the external VREFH+ and VREF-
input pins. When the voltage reference and band gap reference are ready, the BGVRRDY (ADCCON2[31]) bit is set. If a Fault occurs in the voltage reference (such as a brown-out), the REFFLT bit (ADCCON2[30]) is set. The BGVRRDY and REFFLT bits can also generate interrupts if the BGVRIEN bit (ADCCON2[15]) and REFFLTIEN bit
(ADCCON2[14]) are set, respectively. The voltages applied to the external reference pins must comply with certain specifications. See Electrical Characteristics from Related Links. The Analog Input Charge Pump Enable bit, AICPMPEN (ADCCON1[12]), must be set when the difference between the selected reference voltages (VREFH - VREFL) is less than 0.65 * (AVDD - AVSS). Setting this bit does not increase the magnitude of the reference voltage; however, setting this bit reduces the series source resistance to the sampling capacitors. This maximizes the SNR for analog-to-digital conversions using small reference voltage rails. Related Links 43. Electrical Characteristics 38.3.6 Selecting the Scanned Inputs All available analog inputs can be configured for scanning. Class 2 and Class 3 inputs are sampled using the shared ADC module. A single conversion trigger source is selected for all of the inputs selected for scanning using the STRGSRC[4:0] bits (ADCCON1[20:16]). On each conversion trigger, the ADC module starts converting (in the natural priority) all inputs specified in the user-specified scan list (ADCCSS1 or ADCCSS2). For Class 2 and Class 3 inputs, the trigger initiates a sequential sample/conversion process in the natural priority order. An analog input belongs to the scan if it is:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 898 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) A Class 3 input. For Class 3 inputs, scan is the only mechanism for conversion. A Class 2 input that has the scan trigger selected as the trigger source by selecting the STRIG option in the TRGSRCx[4:0] bits located in the ADCTRG1 through ADCTRG8 registers. The trigger options available for scan are identical to those available for independent triggering of Class 2 inputs. Any Class 2 inputs that are part of the scan must have the STRIG option selected as their trigger source in the TRGSRCx[4:0] bits. Note:The end-of-scan (EOS) is generated only if the last shared input conversion has completed. Until this condition is met, the scan sequence is still in effect. Therefore, the EOS Interrupt can be used for any scan sequence with any combination of input types. The following code is an example for ADC scanning multiple inputs. int main(int argc, char** argv) {
int result[3];
/* Configure ADCCON1 */
ADCCON1 = 0; // No ADCCON1 features are enabled including: Stop-in-Idle, turbo,
// CVD mode, Fractional mode and scan trigger source. ADCCON1bits.SELRES = 3; // ADC7 resolution is 12 bits ADCCON1bits.STRGSRC = 1; // Select scan trigger.
/* Configure ADCCON2 */
ADCCON2bits.SAMC = 5; // ADC7 sampling time = 5 * TAD7 ADCCON2bits.ADCDIV = 1; // ADC7 clock freq is half of control clock = TAD7
/* Initialize warm up time register */ ADCANCON = 0;
ADCANCONbits.WKUPCLKCNT = 5; // Wakeup exponent = 32 * TADx
/* Clock setting */
ADCCON3bits.ADCSEL = 0; // Select input clock source ADCCON3bits.CONCLKDIV = 1; // Control clock frequency is half of input clock ADCCON3bits.VREFSEL = 0; // Select AVDD and AVSS as reference source ADC0TIMEbits.ADCDIV = 1; // ADC0 clock frequency is half of control clock = TAD0 ADC0TIMEbits.SAMC = 5; // ADC0 sampling time = 5 * TAD0 ADC0TIMEbits.SELRES = 3; // ADC0 resolution is 12 bits
/* Select analog input for ADC modules, no presync trigger, not sync sampling */
ADCTRGMODEbits.SH0ALT = 0; // ADC0 = AN0
/* Select ADC input mode */
ADCIMCON1bits.SIGN0 = 0; // unsigned data format ADCIMCON1bits.DIFF0 = 0; //
Single ended mode ADCIMCON1bits.SIGN8 = 0; // unsigned data format ADCIMCON1bits.DIFF8
= 0; // Single ended mode ADCIMCON1bits.SIGN40 = 0; // unsigned data format ADCIMCON1bits.DIFF40 = 0; // Single ended mode
/* Configure ADCGIRQENx */
ADCGIRQEN1 = 0; // No interrupts are used. ADCGIRQEN2 = 0;
/* Configure ADCCSSx */
ADCCSS1 = 0; // Clear all bits ADCCSS2 = 0;
ADCCSS1bits.CSS0 = 1; // AN0 (Class 1) set for scan ADCCSS1bits.CSS8 = 1; //
AN8 (Class 2) set for scan ADCCSS2bits.CSS40 = 1; // AN40 (Class 3) set for scan
/* Configure ADCCMPCONx */
ADCCMPCON1 = 0; // No digital comparators are used. Setting the ADCCMPCONx ADCCMPCON2 = 0; // register to '0' ensures that the comparator is disabled. ADCCMPCON3 = 0; // Other registers are don't care. ADCCMPCON4 = 0;
ADCCMPCON5 = 0; ADCCMPCON6 = 0;
/* Configure ADCFLTRx */
ADCFLTR1 = 0; // No oversampling filters are used. ADCFLTR2 = 0;
ADCFLTR3 = 0; ADCFLTR4 = 0; ADCFLTR5 = 0; ADCFLTR6 = 0;
/* Set up the trigger sources */
ADCTRG1bits.TRGSRC0 = 3; // Set AN0 (Class 1) to trigger from scan source ADCTRG3bits.TRGSRC8 = 3; // Set AN8 (Class 2) to trigger from scan source
// AN40 (Class 3) always uses scan trigger source
/* Early interrupt */
ADCEIEN1 = 0; // No early interrupt 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 899 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) ADCEIEN2 = 0;
/* Turn the ADC on */ ADCCON1bits.ON = 1;
/* Wait for voltage reference to be stable */
while(!ADCCON2bits.BGVRRDY); // Wait until the reference voltage is ready while(ADCCON2bits.REFFLT); // Wait if there is a fault with the reference voltage
/* Enable clock to analog circuit */
ADCANCONbits.ANEN0 = 1; // Enable the clock to analog bias ADC0 ADCANCONbits.ANEN7 = 1; // Enable, ADC7
/* Wait for ADC to be ready */
while(!ADCANCONbits.WKRDY0); // Wait until ADC0 is ready while(!
ADCANCONbits.WKRDY7); // Wait until ADC7 is ready
/* Enable the ADC module */
ADCCON3bits.DIGEN0 = 1; // Enable ADC0 ADCCON3bits.DIGEN7 = 1; // Enable ADC7 while (1) {
/* Trigger a conversion */ ADCCON3bits.GSWTRG = 1;
/* Wait the conversions to complete */
while (ADCDSTAT1bits.ARDY0 == 0);
/* fetch the result */
result[0] = ADCDATA0;
while (ADCDSTAT1bits.ARDY8 == 0);
/* fetch the result */
result[1] = ADCDATA8;
while (ADCDSTAT2bits.ARDY40 == 0);
/* fetch the result */
result[2] = ADCDATA40;
* Process results here
return (1);
38.3.7 Selecting the Analog-to-Digital Conversion Clock Source and Prescaler The ADC module can use the internal Fast RC (FRC) oscillator output, system clock (SYSCLK), reference clock
(REFCLK3) or peripheral bus clock (PBCLK) as the conversion clock source (TQ). See ADCCON3 register from Related Links. When the ADCSEL[1:0] bits (ADCCON2[31:30]) = 01, the internal FRC oscillator is used as the ADC clock source. When using the internal FRC oscillator, the ADC module can continue to function in Sleep and Idle modes. Note:It is recommended that applications that require precise timing of ADC acquisitions use SYSCLK as the clock source for the ADC. For correct analog-to-digital conversions, the conversion clock limits must not be exceeded. Clock frequencies from 1 MHz to 28 MHz are supported by the ADC module. The maximum rate that analog-to-digital conversions may be completed by the ADC module (effective conversion throughput) is 2 Msps. However, the maximum rate that a single input can be converted is dependent on the sampling time requirements. In addition, the sampling time depends on the output impedance of the analog signal source. For more information on sampling time, see ADC Sampling Requirements from Related Links. The input clock source for the ADC is selected using the ADCSEL[1:0] bits (ADCCON3[31:30]). The input clock is further divided by the control clock divider CONCLKDIV[5:0] bits (ADCCON3[29:24]). The output clock is called the ADC control clock with a time period of TQ. The ADC control clock is divided by the ADCDIV[6:0] bits (ADCxTIME[22:16]). This acts as the clock source for the respective dedicated ADC modules with a time period of TADX. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 900 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) The ADC control clock is divided before it is used for the shared ADC by the ADCDIV[6:0] bits (ADCCON2[6:0]). The time period for this clock is denoted as TAD7. Figure 38-7. Clock Derivation for Shared ADC Modules Equation 38-2.Sample Time for the Shared ADC Module tSAMC = ADCCON2 < 25: 16 > TAD Related Links tconversion = 2 + ADCCON2 < 22: 21 > TAD 38.11.4. ADCCON3 38.9. ADC Sampling Requirements 38.3.8 Turning ON the ADC Turning ON the ADC module involves the following procedure. When the ADC module enable bit, ON (ADCCON1[15]), is set to 1, the module is in Active mode and is fully powered and functional. When the ON bit is 0, the ADC module is disabled. Once disabled, the digital and analog portions of the ADC are turned off for maximum current savings. In addition to setting the ON bit, the analog and digital circuits of ADC must be turned ON. See Low-power Mode from Related Links. Note:Writing to the ADC control bits that control the ADC clock, input assignments, scanning, voltage reference selection, S&H circuit operating modes and interrupt configuration is not recommended while the ADC module is enabled. Related Links 38.6.3. Low-Power Mode 38.3.9 ADC Status Bits The ADC module includes the WKRDYx/WKRDY7 status bit in the ADCANCON register, which indicates the current state of ADC Analog and bias circuit. The user application must not perform any ADC operations until this bit is set. 38.4 Additional ADC Functions This section describes some additional features of the ADC module, which includes:
Digital comparator Oversampling filter 38.4.1 Digital Comparator The ADC module features digital comparators that can be used to monitor selected analog input conversion results and generate interrupts when a conversion result is within the user-specified limits. Conversion triggers are still required to initiate conversions. The comparison occurs automatically once the conversion is complete. This feature is enabled by setting the Digital Comparator Module Enable bit, ENDCMP (ADCCMPCONx[7]). The user application makes use of an interrupt that is generated when the analog-to-digital conversion result is higher or lower than the specified high and low limit values in the ADCCMPx register. The high and low limit values are specified in the DCMPHI[15:0] bits (ADCCMPx[31:16]) and the DCMPLO[15:0] bits (ADCCMPx[15:0]). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 901 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) The CMPEx bits (x = 0 through 31) in the ADCCMPENx registers are used to specify which analog inputs are monitored by the digital comparator (for the first 8 analog inputs, ANx, where x = 0 through 31). The ADCCMPCONx register specifies the comparison conditions that generates an interrupt, as follows:
When IEBTWN = 1, an interrupt is generated when DCMPLO ADCDATA < DCMPHI When IEHIHI = 1, an interrupt is generated when DCMPHI ADCDATA When IEHILO = 1, an interrupt is generated when ADCDATA < DCMPHI When IELOHI = 1, an interrupt is generated when DCMPLO ADCDATA When IELOLO = 1, an interrupt is generated when ADCDATA < DCMPLO The comparator event generation is illustrated in the following figure. When the ADC module generates a conversion result, the conversion result is provided to the comparator. The comparator uses the DIFFx and SIGNx bits of the ADCIMCONx register (depending on the analog input used) to determine the data format used and to appropriately select whether the comparison must be signed or unsigned. The global ADC setting, which is specified by the FRACT bit (ADCCON1[23]), is also used to set the fractional or integer format. The digital comparator compares the ADC result with the high and low limit values (depending on the selected comparison criteria) in the ADCCMPx register. Depending on the comparator results, a digital comparator interrupt event may be generated. If a comparator event occurs, the Digital Comparator Interrupt Event Detected status bit, DCMPED (ADCCMPCONx[5]), is set, and the Analog Input Identification (ID) bits, AINID[4:0] (ADCCMPCONx[12:8]), are automatically updated so that the user application knows which analog input generated the interrupt event. Note:The user software must format the values contained in the ADCCMPx registers to match converted data format as either signed or unsigned, and fractional or integer. Figure 38-8. Digital Comparator 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 902 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) The following code is an example for ADC digital comparator. int main(int argc, char** argv) {
int result = 0, eventFlag = 0;
/* Configure ADCCON1 */
ADCCON1 = 0; // No ADCCON1 features are enabled including: Stop-in-Idle,
// turbo, CVD mode, Fractional mode and scan trigger source. ADCCON1bits.SELRES = 3; //
ADC resolution is 12 bits ADCCON1bits.STRGSRC = 0; // No scan trigger.
/* Configure ADCCON2 */
ADCCON2bits.SAMC = 5; // ADC7 sampling time = 5 * TAD7 ADCCON2bits.ADCDIV = 1; // ADC7 clock freq = TAD7
/* Initialize warm up time register */ ADCANCON = 0;
/* No selection for dedicated ADC modules, no presync trigger, not sync sampling */
ADCTRGMODEbits = 0;
/* Select ADC input mode */
ADCIMCON1bits.SIGN8 = 0; // unsigned data format ADCIMCON1bits.DIFF8 = 0; // Single ended mode
/* Configure ADCGIRQENx */
ADCGIRQEN1 = 0; // No interrupts are used ADCGIRQEN2 = 0;
/* Configure ADCCSSx */
ADCCSS1 = 0; // No scanning is used ADCCSS2 = 0;
/* Configure ADCCMPCONx */
ADCCMP1 = 0; // Clear the register ADCCMP1bits.DCMPHI = 0xC00; // High limit is a 3072 result. ADCCMP1bits.DCMPLO = 0x500; // Low limit is a 1280 result. ADCCMPCON1bits.IEBTWN = 1; // Create an event when the measured result is
// >= low limits and < high limit. ADCCMPEN1 = 0; // Clear all enable bits ADCCMPEN1bits.CMPE8 = 1; // set the bit corresponding to AN8 ADCCMPCON1bits.ENDCMP = 1; // enable comparator ADCCMPCON2 = 0; ADCCMPCON3 = 0; ADCCMPCON4 = 0; ADCCMPCON5 = 0; ADCCMPCON6 = 0;
/* Configure ADCFLTRx */
ADCFLTR1 = 0; // No oversampling filters are used. ADCFLTR2 = 0;
ADCFLTR3 = 0; ADCFLTR4 = 0; ADCFLTR5 = 0; ADCFLTR6 = 0;
/* Set up the trigger sources */
ADCTRG3bits.TRGSRC8 = 3; // Set AN8 (Class 2) to trigger from scan source
/* Early interrupt */
ADCEIEN1 = 0; // No early interrupt ADCEIEN2 = 0;
/* Turn the ADC on */ ADCCON1bits.ON = 1;
/* Wait for voltage reference to be stable */
while(!ADCCON2bits.BGVRRDY); // Wait until the reference voltage is ready while(ADCCON2bits.REFFLT); // Wait if there is a fault with the reference voltage
/* Enable clock to analog circuit */
ADCANCONbits.ANEN7 = 1; // Enable the clock to analog bias
/* Wait for ADC to be ready */
while(!ADCANCONbits.WKRDY7); // Wait until ADC7 is ready
/* Enable the ADC module */
ADCCON3bits.DIGEN7 = 1; // Enable ADC7 while (1) {
/* Trigger a conversion */ ADCCON3bits.GSWTRG = 1;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 903 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) while (ADCDSTAT1bits.ARDY8 == 0);
/* fetch the result */
result = ADCDATA8;
/* Note: It is not necessary to fetch the result for the digital
* comparator to work. In this example we are triggering from
* software so we are using the ARDY8 to gate our loop. Reading the
* data clears the ARDY bit.
/* See if we have a comparator event*/
if (ADCCMPCON1bits.DCMPED == 1) {
eventFlag = 1;
* Process results here
return (1);
38.4.2 Oversampling Digital Filter The ADC module supports two oversampling digital filters. The oversampling digital filter consists of an accumulator and a decimator (down-sampler), which function together as a low-pass filter. By sampling an analog input at a higher-than-required sample rate, then processing the data through the oversampling digital filter, the effective resolution of the ADC module can be increased at the expense of decreased conversion throughput. To obtain x bits of extra resolution, the number of samples required (over and above the Nyquist rate) = (2x)2:
4x oversampling yields one extra bit of resolution (total 13 bits resolution) 16x oversampling yields two extra bits of resolution (total 14 bits resolution) 64x oversampling provides three extra bits of resolution (total 15 bits resolution) 256x oversampling provides four extra bits of resolution (total 16 bits resolution) The digital filter also has an averaging mode, where it accumulates the samples and divides it by the number of samples. Note:
1. Only Class 2 analog inputs can engage the digital filter. Therefore, the CHNLID[2:0] bits are 3 bits wide (0 to 7). 2. During the burst conversion process (repeated trigger until all required data for oversampling is obtained), in the case of filtering Class 2 input using the shared ADC module, higher priority ADC inputs may still process conversions; lower priority ADC conversion requests are held waiting until the filter burst sequence is completed. If higher priority requests occur during the digital filter sequence, they delay the completion of the filtering process. This delay may affect the accuracy of the result because the multiple samples cannot be contiguous. The user must arrange the initiation trigger for the oversampling filters to occur while there are no expected interruptions from higher priority ADC conversion requests. 3. The user application must configure the following bits to perform an oversampling conversion:
Select the amount of oversampling through the Oversampling Filter Oversampling Ratio (OVRSAM[2:0]) bits in the ADC Filter register (ADCFLTRx[28:26]). Set the filter mode to either Oversampling mode or Averaging mode using the DFMODE bit(ADCFLTRx[29]). If the filter is set to Averaging mode and the data format is set to fractional (FRACT bit), set or clear the DATA16EN bit (ADCFLTRx[30]) to set the output resolution. Set the sample time for subsequent samples:
If using Class 2 inputs, select the sample time using the SAMC[9:0] bits (ADC- CON2[25:16]). Select the specific analog input to be oversampled by configuring the Analog Input ID Selection bits, CHNLID[4:0] (ADCFLTRx[20:16]). If needed, include the oversampling filter interrupt event in the global ADC interrupt by setting the Accumulator Filter Global Interrupt Enable bit, AFGIEN (ADCFLTRx[25]). Enable the oversampling filter by setting the Oversampling Filter Accumulator Enable bit, AFEN
(ADCFLTRx[31]). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 904 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) When the digital filter module is configured, the filters control logic waits for an external trigger to initiate the process. The trigger signal for the analog input to be oversampled causes the accumulator to be cleared and initiates the first conversion. The trigger also forces the trigger sensitivity into level mode and forces the trigger itself to 1 as long as the filter needs to acquire the user-specified number of samples via the OVRSAM[2:0] bits (ADCFLTRx[28:26]). The time delay between each acquired sample is decided by the set sample time in the SAMC[9:0] bits in the ADCCON2 register for Class 2 and the time for conversion. When the required number set by OVRSAM[2:0] are received and processed, the data stored in the FLTRDATA[15:0] bit (ADCFLTRx[15:0]) and the AFRDY bit (ADCFLTRx[24]) is set and the interrupt is generated (if enabled). The following figure illustrates 4x oversampling using a Class 2 input. Triggering a Class 2 input initiates sampling for the length of time defined by the SAMC[9:0] bits. Retriggers generated by the oversampling logic use the SAMC[9:0]
bits to set the sample time. Class 2 inputs use the shared S&H; therefore, oversampling blocks lower priority Class 2 and Class 3 triggers. Higher priority Class 2 triggers completely disrupt the oversampling process; therefore, they must be avoided completely. The same priority rule applies to two Class 2 inputs that use two digital filters. In such a case, the higher priority input also uses the shared ADC module in Burst mode and prevents the lower priority input from using the shared ADC. Only after all required samples are obtained by the higher priority input can the lower priority input use the shared ADC to acquire samples for its own digital filtering. Figure 38-9. 4x Oversampling of a Class 2 Input The following code is an example for ADC digital oversampling filter. int main(int argc, char** argv) {
int result;
/* Configure ADCCON1 */
ADCCON1 = 0; // No ADCCON1 features are enabled including: Stop-in-Idle, turbo,
// CVD mode, Fractional mode and scan trigger source.
/* Configure ADCCON2 */
ADCCON2 = 0; // Since, we are using only the Class 1 inputs, no setting is
// required for ADCDIV
/* Initialize warm up time register */ ADCANCON = 0;
ADCANCONbits.WKUPCLKCNT = 5; // Wake-up exponent = 32 * TADx
/* Clock setting */ ADCCON3 = 0;
ADCCON3bits.ADCSEL = 0; // Select input clock source ADCCON3bits.CONCLKDIV = 1; // Control clock frequency is half of input clock ADCCON3bits.VREFSEL = 0; // Select AVDD and AVSS as reference source 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 905 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) ADC0TIMEbits.ADCDIV = 1; // ADC0 clock frequency is half of control clock = TAD0 ADC0TIMEbits.SAMC = 5; // ADC0 sampling time = 5 * TAD0 ADC0TIMEbits.SELRES = 3; // ADC0 resolution is 12 bits
/* Select analog input for ADC modules, no presync trigger, not sync sampling */
ADCTRGMODEbits.SH0ALT = 0; // ADC0 = AN0
/* Select ADC input mode */
ADCIMCON1bits.SIGN0 = 0; // unsigned data format ADCIMCON1bits.DIFF0 = 0; // Single ended mode
/* Configure ADCGIRQENx */
ADCGIRQEN1 = 0; // No interrupts are used ADCGIRQEN2 = 0;
/* Configure ADCCSSx */
ADCCSS1 = 0; // No scanning is used ADCCSS2 = 0;
/* Configure ADCCMPCONx */
ADCCMPCON1 = 0; // No digital comparators are used. Setting the ADCCMPCONx ADCCMPCON2 = 0; // register to '0' ensures that the comparator is disabled. ADCCMPCON3 = 0; // Other registers are don't care. ADCCMPCON4 = 0; ADCCMPCON5 = 0; ADCCMPCON6 = 0;
/* Configure ADCFLTRx */
ADCFLTR1 = 0; // Clear all bits ADCFLTR1bits.CHNLID = 0; // Use AN0 as the source ADCFLTR1bits.OVRSAM = 3; // 16x oversampling ADCFLTR1bits.DFMODE = 0; //
Oversampling mode ADCFLTR1bits.AFEN = 1; // Enable filter 1 ADCFLTR2 = 0; // Clear all bits ADCFLTR3 = 0; ADCFLTR4 = 0; ADCFLTR5 = 0; ADCFLTR6 = 0;
/* Set up the trigger sources */ ADCTGSNSbits.LVL0 = 0; // Edge trigger ADCTRG1bits.TRGSRC0 = 1; // Set AN0 to trigger from software.
/* Turn the ADC on */ ADCCON1bits.ON = 1;
/* Wait for voltage reference to be stable */
while(!ADCCON2bits.BGVRRDY); // Wait until the reference voltage is ready while(ADCCON2bits.REFFLT); // Wait if there is a fault with the reference voltage
/* Enable clock to analog circuit */
ADCANCONbits.ANEN0 = 1; // Enable the clock to analog bias and digital control
/* Wait for ADC to be ready */
while(!ADCANCONbits.WKRDY0); // Wait until ADC0 is ready
/* Enable the ADC module */ ADCCON3bits.DIGEN0 = 1; // Enable ADC0 while (1) {
/* Trigger a conversion */ ADCCON3bits.GSWTRG = 1;
/* Wait for the oversampling process to complete */
while (ADCFLTR1bits.AFRDY == 0);
/* fetch the result */
result = ADCFLTR1bits.FLTRDATA;
* Process result Here
* Note 1: Loop time determines the sampling time for the first sample.
* remaining samples sample time is determined by set sampling + conversion time.
* Note 2: The first 5 samples may have reduced accuracy.
return (1);
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 906 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Figure 38-10. ADC Filter Comparisons Example 38.5 Interrupts The ADC module supports interrupts triggered from a variety of sources that can be processed individually or globally. An early interrupt feature is also available to compensate for interrupt servicing latency. After an enabled interrupt is generated, the CPU jumps to the vector assigned to that interrupt. The CPU begins executing code at the vector address. The user software at this vector address must perform the required operations, such as processing the data results, clearing the interrupt flag, then exiting. See Nested Vector Interrupt Controller
(NVIC) from Related Links for more information on interrupts and the vector address table details. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 38.5.1 Interrupt Sources The ADC is capable of generating interrupts from the events listed in the following table. Table 38-4. ADC Interrupt Sources Interrupt Event Description Interrupt Enable Bit Interrupt Status Bit ANx Data Ready Event Interrupt is generated upon a completion of a conversion from an analog input source (ANx). Each of the ARDYx bits is capable of generating a unique interrupt when set using the ADCBASE register. AGIENx of ADCGIRQEN1 ARDYx of ADCDSTAT1 register 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 907 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC)
...........continued Interrupt Event Description Interrupt Enable Bit Interrupt Status Bit Digital Comparator Event Oversampling Filter Data Ready Event Both Band Gap Voltage and ADC Reference Voltage Ready Event Band Gap Fault/
Reference Voltage Fault/AVDD Brown-out Fault Event When an conversion's comparison criteria are met by a configured and enabled digital comparator. Each of the digital comparators is capable of generating a unique interrupt when its DCMPED bit is set. When an oversampling filter has completed the accumulation/decimation process and has stored the result. Interrupt is generated when both band gap voltage and ADC reference voltage are ready. DCMPGIEN of ADCCMPCONx register DCMPED of ADCCMPCONx register AFGIEN of ADCFLTRx register AFRDY of ADCFLTRx register BGVRIEN of ADCCON2 register BGVRRDY of ADCCON2 register Interrupt is generated when Band Gap Fault/Reference Voltage Fault/AVDD Brown-out occurs. REFFLTIEN of ADCCON2 register REFFLT of ADCCON2 register ADC Module Wake-up Event Interrupt is generated when ADC wakes up after being enabled. WKIEN0 of ADCANCON register WKRDY0 of ADCANCON register Update Ready Event Interrupt is generated when ADC SFRs are ready to be (and can be safely) updated with new values. UPDIEN of ADCCON3 register UPDRDY of ADCCON3 register 38.5.2 ADC Base Register (ADCBASE) Usage After conversion of ADC is complete, if the interrupt is vectored to a function that is common to all analog inputs, it takes some significant time to find the ADC input by evaluating the ARDYx bits in the ADCDSTATx. To avoid this time spent, the ADCBASE register is provided, which contains the base address of the users ADC ISR jump table. When read, the ADCBASE register provides a sum of the contents of the ADCBASE register plus an encoding of the ARDYx bits set in the ADCDSTATx registers. This use of the ADCBASE register supports the creation of an interrupt vector address that can be used to improve the performance of an ISR. The ARDYx bits are binary priority encoded with ARDY1 being the highest priority and ARDY8 being the lowest priority. The encoded priority result is, then, shifted left the amount specified by the number of bit positions specified by the IRQVS[2:0] bits in the ADCCON1 register, then added to the contents of the ADCBASE register. If there are no ARDYx bits set, then reading the ADCBASE register equals the value written into the ADCBASE register. The ADCBASE register is typically loaded with the base address of a jump table that contains the address of the appropriate ISR. The kth interrupt request is enabled via the AGIENx bit (1-8) in one of ADCGIRQENx SFRs (x = 1 or 2). The following codes are examples for the ADCBASE register usage. Case 1:
ADCBASE = 0x1234; // Set the address ADCCON1bits.IRQVS = 2; // left shift by 2 ADCGIRQEN1bits.AGIEN0 = 1; // enable interrupt when AN0 completion is done. When the ADC conversion for AN0 is complete, bit 0 of ADCDSTAT1 = ARDY0 is set. Read value of ADCBASE = 0x1234 + (0 << 2) = 0x1234. Therefore, the ISR must be placed at address 0x1234 for AN0. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 908 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Case 2:
ADCBASE = 0x1234; // Set the address ADCCON1bits.IRQVS = 2; // left shift by 2 ADCGIRQEN1bits.AGIEN0 = 2; // enable interrupt when AN2 completion is done. When the ADC conversion for AN2 is complete, bit 2 of ADCDSTAT1 = ARDY2 is set. Read value of ADCBASE = 0x1234 + (2 << 2) = 0x123C. Therefore, the ISR must be placed at address 0x123C for AN2. Note:The contents of the ADCBASE register are not altered. Summation is performed when the ADCBASE register is read and the summation result is the returned read value from the ADCBASE SFR. 38.5.3 Interrupt Enabling, Priority and Vectoring Each of the ADC events previously mentioned generates an interrupt when its associate Interrupt Enable bit, IE, is set. Each of the ADC events previously listed also has an associated interrupt vector. See Nested Vector Interrupt Controller (NVIC) from Related Links for more information on the vector location and control/status bits associated with each individual interrupt. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 38.5.4 Individual and Global Interrupts The use of the individual interrupts previously listed can significantly optimize the servicing of multiple ADC events by keeping each ISR focused on efficiently handling a specific event. In addition, different ISRs can be easily segregated according to the tasks performed, thereby making user software easier to implement and maintain. There may be cases where it is desirable to have a single ISR service multiple interrupt events. To facilitate this, each ADC event can be logically ORed to create a single global ADC interrupt. When an ADC event is enabled for a global interrupt, it vectors to a single interrupt routine. It is the responsibility of this single global ISR to determine the source of the interrupt through polling and process it accordingly. Use of the Global Interrupt requires configuration of its own unique IE, IF, IP and IS bits as well as configuration of its interrupt vector as described in Interrupt Enabling, Priority and Vectoring. See Interrupt Enabling, Priority and Vectoring from Related Links. Interrupts for the ADC can be configured as individual or global, or utilized as both where some are processed individually and others in the global ISR. Related Links 38.5.3. Interrupt Enabling, Priority and Vectoring 38.6 Power-Saving Modes of Operation The Power-Saving, Sleep and Idle modes are useful for reducing the conversion noise by minimizing the digital activity of the CPU, buses and other peripherals. 38.6.1 Sleep Mode When the device enters Sleep mode, the system clock (SYCCLK) is halted. If an ADC module selects SYSCLK as its clock source or selects REFCLK3 as its clock source (REFCLK3 is generated from SYSCLK), the ADC enters the Sleep mode. When the SYSCLK is the source (directly or indirectly) and Sleep mode occurs during a conversion, the conversion is aborted. The converter cannot resume a partially completed conversion on exiting from Sleep mode. The ADC register contents are not affected by the device entering or leaving Sleep mode. The ADC module can operate during Sleep mode if the ADC clock source is derived from a source other than SYSCLK that is active during Sleep mode. The FRC clock source is a logical choice for operation during Sleep; however, the REFCLK3 clock source can also be used, provided it has an input clock that is operational during Sleep mode. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 909 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) ADC operation during Sleep mode reduces the digital switching noise from the conversion. When the conversion is completed, the ARDYx status bit for that analog input is set and the result is loaded into the corresponding ADC Result register (ADCDATAx). If any of the ADC interrupts are enabled, the device is woken up from Sleep mode when the ADC interrupt occurs. The program execution resumes at the ADC ISR if the ADC interrupt is greater than the current CPU priority. Otherwise, execution continues from the instruction after the WAIT instruction that placed the device in Sleep mode. To minimize the effects of digital noise on the ADC module operation, the user must select a conversion trigger source that ensures that the analog-to-digital conversion take places in Sleep mode. For example, the external interrupt pin (INT0) conversion trigger option (TRGSRC[4:0] = 00100) can be used for performing sampling and conversion while the device is in Sleep mode. Note:For the ADC module to operate in Sleep mode, the ADC clock source must be set to Internal FRC
(ADCSEL[1:0] bits (ADCCON2[31:30]) = 01). Alternately, the REFCLK3 source can be used; however, the clock source used for REFCLK3 must operate during Sleep mode. Any changes to the ADC clock configuration require that the ADC be disabled. 38.6.2 Operation During Idle Mode For the ADC, the stop in Idle Mode bit, SIDL (ADCCON1[13]), specifies whether the ADC module stops on Idle or continues on Idle. If SIDL = 0, the ADC module continues normal operation when the device enters Idle mode. If any of the ADC interrupts are enabled, the device wakes up from Idle mode when the ADC interrupt occurs. The program execution resumes at the ADC ISR if the ADC interrupt is greater than the current CPU priority. Otherwise, execution continues from the instruction after the WAIT instruction that placed the device in Idle mode. If SIDL = 1, the ADC module stops in Idle mode. If the device enters Idle mode during a conversion, the conversion is aborted. The converter cannot resume a partially completed conversion on exiting from Idle mode. 38.6.3 Low-Power Mode The ADC module can be placed in a low-power state by disabling the digital circuit for individual ADC modules that are not running. This is possible by clearing the DIGENx bits and the DIGEN7 bit in the ADCCON3 register. (See ADCCON3 register from Related Links.) An even lower power state is possible by disabling the analog and bias circuit for individual ADC modules that are not running. This is possible by clearing the ANENx bits and the ANEN7 bit in the ADCANCON register.
(See ADCANCON register from Related Links.) Disabling the digital circuit to achieve Low-Power mode provides a significantly faster module restart compared to disabling and re-enabling the analog and bias circuit of the ADC module. This is because disabling and re-enabling the analog and bias circuit using the ANENx bits and the ANEN7 bit requires a wake-up time (typical minimum wake-up time of 20 s) for the ADC module before it can be used. Refer to the Electrical Specifications in the specific device data sheet for more information on the stabilization time. When the analog and bias circuit for an ADC module is enabled, the wake-up must be polled (or through an interrupt) using the wake-up ready bits, WKRDY6:WKRDY0 and WKRDY7, which must be equal to 1. Related Links 38.11.4. ADCCON3 38.11.24. ADCANCON 43. Electrical Characteristics 38.7 Effects of Reset Following any Reset event, all the ADC control and status registers are reset to their default values with control bits in a non-active state. This disables the ADC module and sets the analog input pins to Analog Input mode. Any conversion that was in progress terminates, and the result cannot be written to the result buffer. The values in the ADCDATAx registers are initialized to 0x00000000 during a device Reset. The bias circuits are also turned off, so the ADC resuming operations wait for the bias circuits to stabilize by polling (or requesting to be interrupted by) the BGVRRDY bit (ADCCON2 register). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 910 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.8 Transfer Function A typical transfer function of the 12-bit ADC is illustrated in the following figure. The difference of the input voltages
(VINH - VINL) is compared with the reference (VREFH - VREFL). The first code transition (A) occurs when the input voltage is (VREFH - VREFL/8192) or 0.5 LSb. The 0000 0000 0001 code is centered at (VREFH - VREFL/4096) or 1.0 LSb (B). The 1000 0000 0000 code is centered at (2048 * (VREFH - VREFL)/4096) (C). An input voltage less than (1 * (VREFH - VREFL)/8192) converts as 0000 0000 0000 (D). An input greater than (8192 * (VREFH - VREFL)/8192) converts as 1111 1111 1111 (E). Figure 38-11. Analog-to-Digital Transfer Function 38.9 ADC Sampling Requirements The analog input model of the 12-bit ADC is illustrated in the following figure. The total acquisition time for the analog-to-digital conversion is a function of the internal circuit settling time and the holding capacitor charge time. For the ADC module to meet its specified accuracy, the charge holding capacitor (CHOLD) must be allowed to fully charge to the voltage level on the analog input pin. The analog output source impedance (RS), the interconnect impedance (RIC) and the internal sampling switch (RSS) impedance combine to directly affect the time required to charge the CHOLD. The combined impedance of the analog sources must, therefore, be small enough to fully charge
(to within one-fourth LSB of the desired voltage) the holding capacitor within the selected sample time. The internal holding capacitor is in the discharged state prior to each sample operation. At least 1 TAD time period must be allowed between conversions for the acquisition time. Refer to the Electrical Characteristics from the Related Links. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 911 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Figure 38-12. 12-bit ADC Analog Input Model Note:The CPIN value depends on the device package and is not tested. The effect of the CPIN is negligible if Rs 5 k. Legend:
CPIN = Input capacitance RSS = Sampling switch resistance RS = Source resistance VT = Threshold voltage RIC = Interconnect resistance CHOLD = Sample/hold capacitance ILEAKAGE = Leakage current at the pin due to various junctions Related Links 43. Electrical Characteristics 38.10 Connection Considerations Because the analog inputs employ Electrostatic Discharge (ESD) protection, they have diodes to VDD and VSS;
therefore, the analog input must be between VDD and VSS. If the input voltage exceeds this range by greater than 0.3V (either direction), one of the diodes becomes forward biased, and it may damage the device if the input current specification is exceeded. An external RC filter is sometimes added for antialiasing of the input signal. The R (resistive) component must be selected to ensure that the acquisition time is met. Any external components connected (through high-impedance) to an analog input pin (capacitor, Zener diode and so on) must have very little leakage current at the pin. 38.11 Register Description Notes:The following conventions are used in the following registers:
R = Readable bit W = Writable bit U = Unimplemented bit, read as 0 1= Bit is set0= Bit is cleared x = Bit is unknown
-n = Value at POR HS = Hardware Set HC = Hardware Cleared Note:CLR/SET/INV registers for each register are located at offset <register offset> + 0x04, 0x08, 0x0C, respectively. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 912 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.1 Register Summary The PIC32CX-BZ2 12-bit High Speed SAR ADC module has the following Special Function Registers (SFRs):
Offset 0x00
... 0x13FF Name Bit Pos. 7 6 5 4 3 2 1 0 Reserved 0x1400 ADCCON1 0x1404
... 0x140F Reserved 0x1410 ADCCON2 0x1414
... 0x141F Reserved 0x1420 ADCCON3 0x1424
... 0x143F Reserved 0x1440 ADCIMCON1 0x1444
... 0x147F Reserved 0x1480 ADCGIRQEN1 0x1484
... 0x149F Reserved 0x14A0 ADCCSS1 0x14A4
... 0x14BF Reserved 0x14C0 ADCDSTAT1 0x14C4
... 0x14DF Reserved 0x14E0 ADCCMPEN1 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 IRQVS[2:0]
STRGLVL DMABL[2:0]
ON FRACT FRZ SIDL SELRES[1:0]
FSYDMA FSYUPB SCANEN STRGSRC[4:0]
BGVRIEN REFFLTIEN EOSIEN ADCDIV[6:0]
ENXCNVRT SAMC[7:0]
BGVRRDY REFFLT EOSRDY SAMC[9:8]
GLSWTRG GSWTRG ADINSEL[5:0]
VREFSEL[2:0]
TRGSUSP UPDIEN UPDRDY SAMP RQCNVRT CHN_EN_SH R ADCSEL[1:0]
CONCLKDIV[5:0]
DIFF3 DIFF7 DIFF11 SIGN3 SIGN7 SIGN11 DIFF2 DIFF6 DIFF10 SIGN2 SIGN6 SIGN10 DIFF1 DIFF5 DIFF9 SIGN1 SIGN5 SIGN9 DIFF0 DIFF4 DIFF8 SIGN0 SIGN4 SIGN8 AGIEN7 AGIEN6 AGIEN5 AGIEN4 AGIEN3 AGIEN2 AGIEN11 AGIEN10 AGIEN1 AGIEN9 AGIEN0 AGIEN8 CSS7 CSS6 CSS5 CSS4 CSS3 CSS11 CSS2 CSS10 CSS1 CSS9 CSS0 CSS8 ARDY7 ARDY6 ARDY5 ARDY4 ARDY3 ARDY11 ARDY2 ARDY10 ARDY1 ARDY9 ARDY0 ARDY8 CMPEx[7:0]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 913 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC)
...........continued Offset 0x14E4
... 0x14EF Name Bit Pos. 7 6 5 4 3 2 1 0 Reserved DCMPLO[7:0]
DCMPLO[15:8]
DCMPHI[7:0]
DCMPHI[15:8]
CMPEx[7:0]
DCMPLO[7:0]
DCMPLO[15:8]
DCMPHI[7:0]
DCMPHI[15:8]
FLTRDATA[7:0]
FLTRDATA[15:8]
AFEN DATA16EN DFMODE OVRSAM[2:0]
AFGIEN AFRDY CHNLID[4:0]
AFEN DATA16EN DFMODE OVRSAM[2:0]
AFGIEN AFRDY FLTRDATA[7:0]
FLTRDATA[15:8]
CHNLID[4:0]
TRGSRC0[4:0]
TRGSRC1[4:0]
TRGSRC2[4:0]
TRGSRC3[4:0]
TRGSRC4[4:0]
TRGSRC5[4:0]
TRGSRC6[4:0]
TRGSRC7[4:0]
ENDCMP DCMPGIEN DCMPED IEBTWN IEHIHI IEHILO IELOHI IELOLO AINID[5:0]
7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 0x14F0 ADCCMP1 0x14F4
... 0x14FF Reserved 0x1500 ADCCMPEN2 0x1504
... 0x150F Reserved 0x1510 ADCCMP2 0x1514
... 0x159F Reserved 0x15A0 ADCFLTR1 0x15A4
... 0x15AF Reserved 0x15B0 ADCFLTR2 0x15B4
... 0x15FF Reserved 0x1600 ADCTRG1 0x1604
... 0x160F Reserved 0x1610 ADCTRG2 0x1614
... 0x167F Reserved 0x1680 ADCCMPCON1 0x1684
... 0x168F Reserved 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 914 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 ENDCMP DCMPGIEN DCMPED IEBTWN IEHIHI IEHILO IELOHI IELOLO AINID[4:0]
DMACNTEN 23:16 WROVRERR 31:24 DMAEN 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 0x1690 ADCCMPCON2 0x1694
... 0x16FF Reserved 0x1700 ADCBASE 0x1704
... 0x170F Reserved 0x1710 ADCDMASTAT 0x1714
... 0x171F Reserved 0x1720 ADCCNTB 0x1724
... 0x172F Reserved 0x1730 ADCDMAB 0x1734
... 0x173F Reserved 0x1740 ADCTRGSNS 0x1744
... 0x17FF Reserved 0x1800 ADCANCON 0x1804
... 0x1AFF Reserved 0x1B00 ADCSYSCFG0 0x1B04
... 0x1DFF Reserved RAF0 RAF0IEN RBF0 RBF0IEN ADCBASE[7:0]
ADCBASE[15:8]
ADCCNTB[7:0]
ADCCNTB[15:8]
ADCCNTB[23:16]
ADCCNTB[31:24]
ADDMAB[7:0]
ADDMAB[15:8]
ADDMAB[23:16]
ADDMAB[31:24]
LVL7 LVL6 LVL5 LVL4 LVL3 LVL2 LVL1 LVL0 ANEN7 WKRDY7 WKIEN7 ANEN0 WKRDY0 WKIEN0 WKUPCLKCNT[3:0]
AN[7:0]
AN[15:8]
AN[19:16]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 915 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x1E00 ADCDATAx 7:0 15:8 23:16 31:24 DATA[7:0]
DATA[15:8]
DATA[23:16]
DATA[31:24]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 916 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.2 ADCCON1 ADC Control Register 1 Name:
Offset:
Reset:
Property:
ADCCON1 0x1400 0x00601000
This register controls the basic operation of the ADC module, including behavior in Sleep and Idle modes, and data formatting. This register also specifies the vector shift amounts for the Interrupt Controller. Additional ADCCON1 functions include the RAM buffer length in DMA mode. Bit 31 30 29 28 27 26 25 24 Access Reset Bit Access Reset Bit Access Reset 23 FRACT R/W 0 15 ON R/W 0 Bit 7 Access Reset 22 21 SELRES[1:0]
R/W 0 14 FRZ R/W 0 6 R/W 0 R/W 1 13 SIDL R/W 0 5 IRQVS[2:0]
R/W 0 20 R/W 0 12 4 R/W 0 19 R/W 0 11 18 STRGSRC[4:0]
R/W 0 17 R/W 0 16 R/W 0 10 FSYDMA R/W 0 9 FSYUPB R/W 0 8 SCANEN R/W 0 3 STRGLVL R/W 0 2 R/W 0 1 DMABL[2:0]
R/W 0 0 R/W 0 Bit 23 FRACTFractional Data Output Format bit Value 0 1 Description Integer Fractional Bits 22:21 SELRES[1:0]Shared ADC (ADC2) Resolution bits Note:Changing the resolution of the ADC does not shift the result in the corresponding ADCDATAx register. The result occupies 12 bits, with the corresponding lower unused bits set to 0. For example, a resolution of 6 bits results in ADCDATAx[5:0] being set to 0 and ADCDATAx[11:6] holding the result. Value 11 10 01 00 Description 12 bits (default) 10 bits 8 bits 6 bits Bits 20:16 STRGSRC[4:0]ScanTrigger Source Select bits Value 10001 - 11111 10000 01111 01110 01101 01100 01011 01010 Description Reserved EVSYS_47 EVSYS_46 EVSYS_45 EVSYS_44 EVSYS_43 EVSYS_42 EVSYS_41 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 917 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Value 01001 01000 00111 00110 00101 00100 00011 00010 00001 00000 Description EVSYS_40 EVSYS_39 EVSYS_38 EVSYS_37 EVSYS_36 INT0 External interrupt Reserved Global level software trigger (GLSWTRG) Global software edge trigger (GSWTRG) No Trigger Bit 15 ONADC Module Enable bit Note:The ON bit must be set only after the ADC module is configured. Value 0 1 Description ADC module is disabled ADC module is enabled Bit 14 FRZ Freeze in Debug Mode Value 0 1 Description Do not freeze in Debug mode Freeze in Debug mode Bit 13 SIDLStop in Idle Mode bit Description Continue module operation in Idle mode Discontinue module operation when device enters Idle mode Value 0 1 Bit 10 FSYDMAFast Synchronous DMA System Clock bit Description Fast synchronous DMA system clock is disabled Fast synchronous DMA system clock is enabled Value 0 1 Bit 9 FSYUPBFast Synchronous UPB Clock bit Value 0 1 Description Fast synchronous UPB clock is disabled Fast synchronous UPB clock is enabled Bit 8 SCANENSCAN Enable bit Bits 6:4 IRQVS[2:0]Interrupt Vector Shift bits To determine the interrupt vector address, this bit specifies the amount of left-shift done to the ARDYx status bits in the ADCDSTAT1 and ADCDSTAT2 registers prior to adding with the ADCBASE register. Interrupt Vector Address = Read Value of ADCBASE, and Read Value of ADCBASE = Value written to ADCBASE +
x << IRQVS[2:0], where x is the smallest active input ID from the ADCDSTAT1 or ADCDSTAT2 registers (which has highest priority). Value 111 110 101 100 011 010 001 000 Description Shift x left 7 bit position Shift x left 6 bit position Shift x left 5 bit position Shift x left 4 bit position Shift x left 3 bit position Shift x left 2 bit position Shift x left 1 bit position Shift x left 0 bit position 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 918 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Bit 3 STRGLVLScanTrigger High Level/Positive Edge Sensitivity bit Value 0 1 Description Scan trigger is positive edge sensitive. Once STRIG mode is selected (TRGSRCx[4:0] in the ADCTRGx register), only a single scan trigger is generated, which completes the scan of all selected analog inputs. Scan trigger is high level sensitive. Once STRIG mode is selected (TRGSRCx[4:0] in the ADCTRGx register), the scan trigger continues for all selected analog inputs, until the STRIG option is removed. Bits 2:0 DMABL[2:0]DMA to System RAM Buffer Length Size Defines the number of locations in system memory allocated per analog input for DMA interface use. As each output data is 16-bit wide, one location consists of 2 bytes. Therefore, the actual size reserved in the system RAM follows the formula: RAM Buffer Length in bytes = 2(DMABL+1). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 919 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.3 ADCCON2 ADC Control Register 2 Name:
Offset:
Reset:
Property:
ADCCON2 0x1410 0x00000000
This register controls the reference selection for the ADC module, the sample time for the shared ADC module, interrupt enable for reference, early interrupt selection and clock division selection for the shared ADC. Bit 31 BGVRRDY R/HS/HC 0 Access Reset 30 REFFLT R/HS/HC 0 29 EOSRDY R/HS/HC 0 Bit 23 Access Reset R/W 0 22 R/W 0 21 R/W 0 Bit Access Reset 15 BGVRIEN R/W 0 14 REFFLTIEN R/W 0 13 EOSIEN R/W 0 Bit 7 Access Reset 6 R/W 0 5 R/W 0 28 27 26 20 R/W 0 12 4 R/W 0 SAMC[7:0]
19 R/W 0 11 ENXCNVRT R/W 0 3 ADCDIV[6:0]
R/W 0 18 R/W 0 10 2 R/W 0 SAMC[9:8]
25 R/W 0 17 R/W 0 9 1 24 R/W 0 16 R/W 0 8 0 R/W 0 R/W 0 Bit 31 BGVRRDYBand Gap Voltage/ADC Reference Voltage Status bit Data processing is valid only after BGVRRDY is set by hardware, so the application code must check that the BGVRRDY bit is set to ensure data validity. This bit set to 0 when ON (ADCCON1[15]) = 0. Value 0 1 Description Either or both band gap voltage and ADC reference voltages (VREF) are not ready Both band gap voltage and ADC reference voltages (VREF) are ready Bit 30 REFFLTBand Gap/VREF/AVDD BOR Fault Status bit This bit is cleared when the ON bit (ADCCON1[15]) = 0 and the BGVRRDY bit = 1. Value 0 1 Description Band gap and VREF voltage are working properly Fault in band gap or the VREF voltage while the ON bit (ADCCON1[15]) was set. Most likely a band gap or VREF fault is caused by a BOR of the analog VDDsupply. Bit 29 EOSRDYEnd of Scan Interrupt Status bit This bit is cleared when ADCCON2[31:24] are read in software. Value 0 1 Description Scanning has not completed All analog inputs are considered for scanning through the scan trigger (all analog inputs specified in the ADCCSS1 and ADCCSS2 registers) have completed scanning Bits 25:16 SAMC[9:0]SampleTime for the Shared ADC (ADC2) bits Where TAD7 = Period of the ADC conversion clock for the Shared ADC (ADC2) controlled by the ADCDIV[6:0] bits. Value 11111111 11
... Description 1025 TAD7 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 920 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Value 00000000 01 00000000 00 Description 3 TAD7 2 TAD7 Bit 15 BGVRIENBand Gap/VREF Voltage Ready Interrupt Enable bit Value 0 1 Description No interrupt is generated when the BGVRRDY bit is set Interrupt is generated when the BGVRDDY bit is set Bit 14 REFFLTIENBand Gap/VREF Voltage Fault Interrupt Enable bit Value 0 1 Description No interrupt is generated when the REFFLT bit is set Interrupt is generated when the REFFLT bit is set Bit 13 EOSIENEnd of Scan Interrupt Enable bit Value 0 1 Description No interrupt is generated when the EOSRDY bit is set Interrupt is generated when the EOSRDY bit is set Bit 11 ENXCNVRTEnable External Conversion Request Interface Setting this bit enables another module (such as the PTG) to specify and request conversion of an ADC input. Note:The external module (such as the PTG) is responsible for asserting only the proper trigger signals. This ADC module has no method to block specific trigger requests from the external module. Bits 6:0 ADCDIV[6:0]Division Ratio for the Shared SAR ADC Core Clock bits Description 254 * TQ = TAD2 The ADCDIV[6:0] bits divide the ADC control clock (TQ) to generate the clock for the shared SAR ADC. Value 1111111
... 0000011 0000010 0000001 0000000 Reserved 6 * TQ = TAD2 4 * TQ = TAD2 2 * TQ = TAD2 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 921 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.4 ADCCON3 ADC Control Register 3 Name:
Offset:
Reset:
Property:
ADCCON3 0x1420 0x00000000
This register enables ADC clock selection, enables/disables the digital feature for the shared ADC module and controls the manual (software) sampling and conversion. Bit 31 30 ADCSEL[1:0]
Access Reset R/W 0 Bit 23 CHN_EN_SHR R/W 0 Access Reset R/W 0 22 Bit 15 Access Reset R/W 0 14 VREFSEL[2:0]
R/W 0 Bit 7 GLSWTRG Access Reset R/W 0 6 GSWTRG R/W, HC 0 29 R/W 0 21 13 R/W 0 5 R/W 0 28 R/W 0 20 26 27 CONCLKDIV[5:0]
R/W 0 19 R/W 0 18 12 TRGSUSP R/W 0 11 UPDIEN R/W 0 10 UPDRDY R/HS/HC 0 4 R/W 0 3 2 ADINSEL[5:0]
R/W 0 R/W 0 25 R/W 0 17 9 SAMP R/W 0 1 R/W 0 24 R/W 0 16 8 RQCNVRT R/HS/HC 0 0 R/W 0 Bits 31:30 ADCSEL[1:0]Analog-to-Digital Clock Source (TCLK) bits Value 00 01 10 11 Description Peripheral Bus Clock FRC Clock REFO3 Clock Output System Clock (SYS_CLK) Bits 29:24 CONCLKDIV[5:0]Analog-to-Digital Control Clock (TQ) Divider bits Value 111111
... 000011 000010 000001 000000 Description 64 * TCLK= TQ 4 * TCLK= TQ 3 * TCLK= TQ 2 * TCLK= TQ TCLK= TQ Bit 23 CHN_EN_SHRShared ADC Digital Enable bit Value 1 0 Description ADC is digital enabled ADC is digital disabled Bits 15:13 VREFSEL[2:0]Voltage Reference (VREF) Input Selection bits Table 38-5. VREFSEL[2:0]
000 001-111 ADREF+
AVDD RESERVED FOR FUTURE USE ADREF-
AVSS 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 922 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Bit 12 TRGSUSPTrigger Suspend bit Value 1 0 Description Triggers are blocked from starting a new analog-to-digital conversion, but the ADC module is not disabled Triggers are not blocked Bit 11 UPDIENUpdate Ready Interrupt Enable bit Value 1 0 Description Interrupt is generated when the UPDRDY bit is set by hardware No interrupt is generated Bit 10 UPDRDYADC Update Ready Status bit Note:This bit is only active while the TRGSUSP bit is set and there are no more running conversions of any ADC modules. Value 1 0 Description ADC SFRs can be updated ADC SFRs cannot be updated Bit 9 SAMPClass 2 and Class 3 Analog Input Sampling Enable bit(1,2,3,4) Value 1 0 Description The ADC S&H amplifier is sampling The ADC S&H amplifier is holding Bit 8 RQCNVRTIndividual ADC Input Conversion Request bit This bit and its associated ADINSEL[5:0] bits enable the user to individually request an analog-to-digital conversion of an analog input through software. Note:This bit is automatically cleared in the next ADC clock cycle. Value 1 0 Description Trigger the conversion of the selected ADC input as specified by the ADINSEL[5:0] bits Do not trigger the conversion Bit 7 GLSWTRGGlobal Level Software Trigger bit Value 1 0 Description Trigger conversion for ADC inputs that have selected the GLSWTRG bit as the trigger signal, either through the associated TRGSRC[4:0] bits in the ADCTRGx registers or through the STRGSRC[4:0]bits in the ADCCON1 register Do not trigger an analog-to-digital conversion Bit 6 GSWTRGGlobal Software Trigger bit This bit is automatically cleared in the next ADC clock cycle. Value 0 Description Trigger conversion for ADC inputs that have selected the GSWTRG bit as the trigger signal, either through the associated TRGSRC[4:0] bits in the ADCTRGx registers or through the STRGSRC[4:0]bits in the ADCCON1 register Do not trigger an analog-to-digital conversion 1 Bits 5:0 ADINSEL[5:0]Analog Input Select bits These bits select the analog input to be converted when the RQCNVRT bit is set. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 923 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Note:
1. 2. 3. The SAMP bit has the highest priority and setting this bit keeps the S&H circuit in Sample mode until the bit is cleared. Also, usage of the SAMP bit causes settings of SAMC[9:0] bits (ADCCON2[25:16]) to be ignored. The SAMP bit only connects Class 2 and Class 3 analog inputs to the shared ADC. The SAMP bit is not a self-clearing bit and it is the responsibility of application software to first clear this bit and, only after setting the RQCNVRT bit, to start the analog-to-digital conversion. 4. Normally, when the SAMP and RQCNVRT bits are used by software routines, all TRGSRCx[4:0] bits and STRGSRC[4:0] bits must be set to 00000 to disable all external hardware triggers and prevent them from interfering with the software-controlled sampling command signal SAMP and with the software-controlled trigger RQCNVRT. Value 111111
... 001011 001010 001001 001000 000111
... 000001 000000 Description Reserved PMU Test Output VddCore (Internal) CP_Test_1.2V (Internal) BandGap Reference (Internal) AN7 is being monitored AN1 is being monitored AN0 is being monitored 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 924 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.5 ADCIMCON1 ADC Input Mode Control Register 1 Name:
Offset:
Reset:
Property:
ADCIMCON1 0x1440 0x00000000
This register enables the user to select between single-ended and differential operation as well as select between signed and unsigned data format. Bit 31 30 29 28 27 26 25 24 Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 23 DIFF11 R/W 0 15 DIFF7 R/W 0 7 DIFF3 R/W 0 22 SIGN11 R/W 0 14 SIGN7 R/W 0 6 SIGN3 R/W 0 21 DIFF10 R/W 0 13 DIFF6 R/W 0 5 DIFF2 R/W 0 20 SIGN10 R/W 0 12 SIGN6 R/W 0 4 SIGN2 R/W 0 19 DIFF9 R/W 0 11 DIFF5 R/W 0 3 DIFF1 R/W 0 18 SIGN9 R/W 0 10 SIGN5 R/W 0 2 SIGN1 R/W 0 17 DIFF8 R/W 0 9 DIFF4 R/W 0 1 DIFF0 R/W 0 16 SIGN8 R/W 0 8 SIGN4 R/W 0 0 SIGN0 R/W 0 Bit 23 DIFF11AN11 Mode bit Value 1 0 Description AN11 is using Differential mode AN11 is using Single-ended mode Bit 22 SIGN11AN11 Signed Data Mode bit Value 1 0 Description AN11 is using Signed Data mode AN11 is using Unsigned Data mode Bit 21 DIFF10AN10 Mode bit Value 1 0 Description AN10 is using Differential mode AN10 is using Single-ended mode Bit 20 SIGN10AN10 Signed Data Mode bit Value 1 0 Description AN10 is using Signed Data mode AN10 is using Unsigned Data mode Bit 19 DIFF9AN9 Mode bit Value 1 0 Description AN9 is using Differential mode AN9 is using Single-ended mode Bit 18 SIGN9AN9 Signed Data Mode bit 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 925 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Value 1 0 Description AN9 is using Signed Data mode AN9 is using Unsigned Data mode Bit 17 DIFF8AN8 Mode bit Value 1 0 Description AN8 is using Differential mode AN8 is using Single-ended mode Bit 16 SIGN8AN8 Signed Data Mode bit Value 1 0 Description AN8 is using Signed Data mode AN8 is using Unsigned Data mode Bit 15 DIFF7AN7 Mode bit Value 1 0 Description AN7 is using Differential mode AN7 is using Single-ended mode Bit 14 SIGN7AN7 Signed Data Mode bit Value 1 0 Description AN7 is using Signed Data mode AN7 is using Unsigned Data mode Bit 13 DIFF6AN6 Mode bit Value 1 0 Description AN6 is using Differential mode AN6 is using Single-ended mode Bit 12 SIGN6AN6 Signed Data Mode bit Value 1 0 Description AN6 is using Signed Data mode AN6 is using Unsigned Data mode Bit 11 DIFF5AN5 Mode bit Value 1 0 Description AN5 is using Differential mode AN5 is using Single-ended mode Bit 10 SIGN5AN5 Signed Data Mode bit Value 1 0 Description AN5 is using Signed Data mode AN5 is using Unsigned Data mode Bit 9 DIFF4AN4 Mode bit Value 1 0 Description AN4 is using Differential mode AN4 is using Single-ended mode Bit 8 SIGN4AN4 Signed Data Mode bit Value 1 0 Description AN4 is using Signed Data mode AN4 is using Unsigned Data mode Bit 7 DIFF3AN3 Mode bit 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 926 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Value 1 0 Description AN3 is using Differential mode AN3 is using Single-ended mode Bit 6 SIGN3AN3 Signed Data Mode bit Value 1 0 Description AN3 is using Signed Data mode AN3 is using Unsigned Data mode Bit 5 DIFF2AN2 Mode bit Value 1 0 Description AN2 is using Differential mode AN2 is using Single-ended mode Bit 4 SIGN2AN2 Signed Data Mode bit Value 1 0 Description AN2 is using Signed Data mode AN2 is using Unsigned Data mode Bit 3 DIFF1AN1 Mode bit Value 1 0 Description AN1 is using Differential mode AN1 is using Single-ended mode Bit 2 SIGN1AN1 Signed Data Mode bit Value 1 0 Description AN1 is using Signed Data mode AN1 is using Unsigned Data mode Bit 1 DIFF0AN0 Mode bit Value 1 0 Description AN0 is using Differential mode AN0 is using Single-ended mode Bit 0 SIGN0AN0 Signed Data Mode bit Value 1 0 Description AN0 is using Signed Data mode AN0 is using Unsigned Data mode 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 927 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.6 ADCGIRQEN1 ADC Global Interrupt Enable Register 1 Name:
Offset:
Reset:
Property:
ADCGIRQEN1 0x1480 0x00000000
This register specifies which of the individual input conversion interrupts can generate the global ADC interrupt. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 Access Reset Bit Access Reset 7 AGIEN7 R/W 0 6 AGIEN6 R/W 0 5 AGIEN5 R/W 0 4 AGIEN4 R/W 0 11 AGIEN11 R/W 0 3 AGIEN3 R/W 0 10 AGIEN10 R/W 0 2 AGIEN2 R/W 0 9 AGIEN9 R/W 0 1 AGIEN1 R/W 0 8 AGIEN8 R/W 0 0 AGIEN0 R/W 0 Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 AGIENADC Global Interrupt Enable bits Value 1 0 Description Interrupts are enabled for the selected analog input. The interrupt is generated after the converted data is ready (indicated by the ARDYx bit (x = 8-1) of the ADCDSTAT1 register) Interrupts are disabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 928 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.7 ADCCSS1 ADC Common Scan Select Register 1 Name:
Offset:
Reset:
Property:
ADCCSS1 0x14A0 0x00000000
This register specifies the analog inputs to be scanned by the common scan trigger. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 Access Reset Bit Access Reset 7 CSS7 R/W 0 6 CSS6 R/W 0 5 CSS5 R/W 0 4 CSS4 R/W 0 11 CSS11 R/W 0 3 CSS3 R/W 0 10 CSS10 R/W 0 2 CSS2 R/W 0 9 CSS9 R/W 0 1 CSS1 R/W 0 8 CSS8 R/W 0 0 CSS0 R/W 0 Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 CSSAnalog Common Scan Select bits Notes:
1. 2. In addition to setting the appropriate bits in this register, Class 2 analog inputs must select the STRIG input as the trigger source if they are to be scanned through the CSSx bits. Refer to the bit descriptions in the ADCTRGx registers for selecting the STRIG option. If a Class 2 input is included in the scan by setting the CSSx bit to 1 and by setting the TRGSRCx[4:0] bits to STRIG mode (0b11), the user application must ensure that no other triggers are generated for that input using the RQCNVRT bit in the ADCCON3 register or the hardware input or any digital filter. Otherwise, the scan behavior is unpredictable. Value 1 0 Description Select ANx for input scan Skip ANx for input scan 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 929 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.8 ADCDSTAT1 ADC Data Ready Status Register 1 Name:
Offset:
Reset:
Property:
ADCDSTAT1 0x14C0 0x00000000
This register contains the interrupt status of the individual analog input conversions. Each bit represents the data-
ready status for its associated conversion result. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 Access Reset Bit Access Reset 7 ARDY7 R/HS/HC 0 6 ARDY6 R/HS/HC 0 5 ARDY5 R/HS/HC 0 4 ARDY4 R/HS/HC 0 11 ARDY11 R/HS/HC 0 3 ARDY3 R/HS/HC 0 10 ARDY10 R/HS/HC 0 2 ARDY2 R/HS/HC 0 9 ARDY9 R/HS/HC 0 1 ARDY1 R/HS/HC 0 8 ARDY8 R/HS/HC 0 0 ARDY0 R/HS/HC 0 Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ARDYConversion Data Ready for Corresponding Analog Input Ready bits Value 1 0 Description This bit is set when converted data is ready in the data register This bit is cleared when the associated data register is read 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 930 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.9 ADCCMPEN1 ADC Digital Comparator 1 Enable Register Name:
Offset:
Reset:
Property:
ADCCMPEN1 0x14E0 0x00000000
These registers select which analog input conversion results is processed by the digital comparator. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 4 R/W 0 CMPEx[7:0]
3 R/W 0 2 R/W 0 9 1 8 0 R/W 0 R/W 0 Bits 7:0 CMPEx[7:0]ADC Digital Comparator x Enable bits Note:CMPEx = where "x" stands for bit value from 0 to 7. These bits enable conversion results corresponding to the analog input to be processed by the digital comparator. CMPE0 enables AN0, CMPE1 enables AN1 and so on. Notes:
1. CMPEx = ANx, where x = 0-31 (Digital Comparator inputs are limited to AN0 through AN31). 2. Changing the bits in this register while the Digital Comparator is enabled (ENDCMP = 1) can result in unpredictable behavior. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 931 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.10 ADCCMPEN2 ADC Digital Comparator 2 Enable Register Name:
Offset:
Reset:
Property:
ADCCMPEN2 0x1500 0x00000000
These registers select which analog input conversion results is processed by the digital comparator. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 4 R/W 0 CMPEx[7:0]
3 R/W 0 2 R/W 0 9 1 8 0 R/W 0 R/W 0 Bits 7:0 CMPEx[7:0]ADC Digital Comparator x Enable bits Note:CMPEx = where x stands for bit value from 0 to 7. These bits enable conversion results corresponding to the analog input to be processed by the digital comparator. CMPE0 enables AN0, CMPE1 enables AN1 and so on. Notes:
1. CMPEx = ANx, where x = 0-31 (Digital Comparator inputs are limited to AN0 through AN31). 2. Changing the bits in this register while the Digital Comparator is enabled (ENDCMP = 1) can result in unpredictable behavior. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 932 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.11 ADCCMP1 ADC Digital Comparator 1 Limit Value Register Name:
Offset:
Reset:
Property:
ADCCMP1 0x14F0 0x00000000
These registers contain the high and low digital comparison values for use by the digital comparator. Notes:
1. Changing theses bits while the Digital Comparator is enabled (ENDCMP = 1) can result in unpredictable 2. 3. behavior. The format of the limit values must match the format of the ADC converted value in terms of sign and fractional settings. For Digital Comparator 0 used in CVD mode, the DCMPHI[15:0] and DCMPLO[15:0] bits must always be specified in signed format as the CVD output data is differential and is always signed. Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 DCMPHI[15:8]
R/W 0 20 R/W 0 19 DCMPHI[7:0]
R/W 0 12 R/W 0 11 DCMPLO[15:8]
R/W 0 4 R/W 0 3 DCMPLO[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:16 DCMPHI[15:0]Digital Comparator x High Limit Value bits(1,2,3) These bits store the high limit value, which is used by digital comparator for comparisons with ADC converted data. Bits 15:0 DCMPLO[15:0]Digital Comparator x Low Limit Value bits(1,2,3) These bits store the low limit value, which is used by digital comparator for comparisons with ADC converted data. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 933 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.12 ADCCMP2 ADC Digital Comparator 2 Limit Value Register Name:
Offset:
Reset:
Property:
ADCCMP2 0x1510 0x00000000
These registers contain the high and low digital comparison values for use by the digital comparator. Notes:
1. Changing theses bits while the Digital Comparator is enabled (ENDCMP = 1) can result in unpredictable 2. 3. behavior. The format of the limit values must match the format of the ADC converted value in terms of sign and fractional settings. For Digital Comparator 0 used in CVD mode, the DCMPHI[15:0] and DCMPLO[15:0] bits must always be specified in signed format as the CVD output data is differential and is always signed. Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 DCMPHI[15:8]
R/W 0 20 R/W 0 19 DCMPHI[7:0]
R/W 0 12 R/W 0 11 DCMPLO[15:8]
R/W 0 4 R/W 0 3 DCMPLO[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:16 DCMPHI[15:0]Digital Comparator x High Limit Value bits(1,2,3) These bits store the high limit value, which is used by digital comparator for comparisons with ADC converted data. Bits 15:0 DCMPLO[15:0]Digital Comparator x Low Limit Value bits(1,2,3) These bits store the low limit value, which is used by digital comparator for comparisons with ADC converted data. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 934 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.13 ADCFLTR1 ADC Digital Filter 1 Register Name:
Offset:
Reset:
Property:
ADCFLTR1 0x15A0 0x00000000
These registers provide control and status bits for the oversampling filter accumulator, and also includes the 16-bit filter output data. Bit Access Reset 31 AFEN R/W 0 30 DATA16EN R/W 0 29 DFMODE R/W 0 Bit 23 22 21 Access Reset 28 R/W 0 20 R/W 0 27 OVRSAM[2:0]
R/W 0 26 R/W 0 19 R/W 0 18 CHNLID[4:0]
R/W 0 10 25 AFGIEN R/W 0 17 R/W 0 9 24 AFRDY R/W 0 16 R/W 0 8 Bit 15 14 13 12 11 FLTRDATA[15:8]
Access Reset R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 Bit 7 6 5 4 3 FLTRDATA[7:0]
2 1 0 Access Reset R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 Bit 31 AFENDigital Filter x Enable bit Value 1 0 Description Digital filter is enabled Digital filter is disabled and the AFRDY status bit is cleared Bit 30 DATA16ENFilter Significant Data Length bit Note:This bit is significant only if DFMODE = 1 (Averaging Mode) and FRACT (ADCCON1[23]) = 1 (Fractional Output Mode). Value 1 0 Description All 16 bits of the filter output data are significant Only the first 12 bits are significant, followed by four zeros Bit 29 DFMODEADC Filter Mode bit Value 1 0 Description Filter x works in Averaging mode Filter x works in Oversampling Filter mode (default) Value Bits 28:26 OVRSAM[2:0]Oversampling Filter Ratio bits Description If DFMODE is 0 128 samples (shift sum 3 bits to right, output data is in 15.1 format) 32 samples (shift sum 2 bits to right, output data is in 14.1 format) 8 samples (shift sum 1 bit to right, output data is in 13.1 format) 2 samples (shift sum 0 bits to right, output data is in 12.1 format) 256 samples (shift sum 4 bits to right, output data is 16 bits) 64 samples (shift sum 3 bits to right, output data is 15 bits) 111 110 101 100 011 010 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 935 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Value 001 000 111 110 101 100 011 010 001 000 Description 16 samples (shift sum 2 bits to right, output data is 14 bits) 4 samples (shift sum 1 bit to right, output data is 13 bits) If DFMODE is 1 256 samples (256 samples to be averaged) 128 samples (128 samples to be averaged) 64 samples (64 samples to be averaged) 32 samples (32 samples to be averaged) 16 samples (16 samples to be averaged) 8 samples (8 samples to be averaged) 4 samples (4 samples to be averaged) 2 samples (2 samples to be averaged) Bit 25 AFGIENDigital Filter x Interrupt Enable bit Value 1 0 Description Digital filter interrupt is enabled and is generated by the AFRDY status bit Digital filter is disabled Bit 24 AFRDYDigital Filter x Data Ready Status bit Note:This bit is cleared by reading the FLTRDATA[15:0] bits or by disabling the Digital Filter module (by setting AFEN to 0). Value 1 0 Description Data is ready in the FLTRDATA[15:0] bits Data is not ready Bits 20:16 CHNLID[4:0]Digital Filter Analog Input Selection bits Note:Only the first 12 analog inputs, Class 2 (AN0 -AN11), can use a digital filter. Description Reserved These bits specify the analog input to be used as the oversampling filter data source. Value 11111
... .. .. 01100 01011
... .. .. 00010 00001 00000 Reserved AN11 AN2 AN1 AN0 Bits 15:0 FLTRDATA[15:0]Digital Filter x Data Output Value bits The filter output data is as per the fractional format set in the FRACT bit (ADCCON1[23]). The FRACT bit must not be changed while the filter is enabled. Changing the state of the FRACT bit after the operation of the filter ended must not update the value of the FLTRDATA[15:0] bits to reflect the new format. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 936 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.14 ADCFLTR2 ADC Digital Filter 2 Register Name:
Offset:
Reset:
Property:
ADCFLTR2 0x15B0 0x00000000
These registers provide control and status bits for the oversampling filter accumulator, and also include the 16-bit filter output data. Bit Access Reset 31 AFEN R/W 0 30 DATA16EN R/W 0 29 DFMODE R/W 0 Bit 23 22 21 Access Reset 28 R/W 0 20 R/W 0 27 OVRSAM[2:0]
R/W 0 26 R/W 0 19 R/W 0 18 CHNLID[4:0]
R/W 0 10 25 AFGIEN R/W 0 17 R/W 0 9 24 AFRDY R/W 0 16 R/W 0 8 Bit 15 14 13 12 11 FLTRDATA[15:8]
Access Reset R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 Bit 7 6 5 4 3 FLTRDATA[7:0]
2 1 0 Access Reset R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 Bit 31 AFENDigital Filter x Enable bit Value 1 0 Description Digital filter is enabled Digital filter is disabled and the AFRDY status bit is cleared Bit 30 DATA16ENFilter Significant Data Length bit Note:This bit is significant only if DFMODE = 1 (Averaging Mode) and FRACT (ADCCON1[23]) = 1 (Fractional Output Mode). Value 1 0 Description All 16 bits of the filter output data are significant Only the first 12 bits are significant, followed by four zeros Bit 29 DFMODEADC Filter Mode bit Value 1 0 Description Filter x works in Averaging mode Filter x works in Oversampling Filter mode (default) Value Bits 28:26 OVRSAM[2:0]Oversampling Filter Ratio bits Description If DFMODE is 0 128 samples (shift sum 3 bits to right, output data is in 15.1 format) 32 samples (shift sum 2 bits to right, output data is in 14.1 format) 8 samples (shift sum 1 bit to right, output data is in 13.1 format) 2 samples (shift sum 0 bits to right, output data is in 12.1 format) 256 samples (shift sum 4 bits to right, output data is 16 bits) 64 samples (shift sum 3 bits to right, output data is 15 bits) 111 110 101 100 011 010 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 937 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Value 001 000 111 110 101 100 011 010 001 000 Description 16 samples (shift sum 2 bits to right, output data is 14 bits) 4 samples (shift sum 1 bit to right, output data is 13 bits) If DFMODE is 1 256 samples (256 samples to be averaged) 128 samples (128 samples to be averaged) 64 samples (64 samples to be averaged) 32 samples (32 samples to be averaged) 16 samples (16 samples to be averaged) 8 samples (8 samples to be averaged) 4 samples (4 samples to be averaged) 2 samples (2 samples to be averaged) Bit 25 AFGIENDigital Filter x Interrupt Enable bit Value 1 0 Description Digital filter interrupt is enabled and is generated by the AFRDY status bit Digital filter is disabled Bit 24 AFRDYDigital Filter x Data Ready Status bit Note:This bit is cleared by reading the FLTRDATA[15:0] bits or by disabling the Digital Filter module (by setting AFEN to 0). Value 1 0 Description Data is ready in the FLTRDATA[15:0] bits Data is not ready Bits 20:16 CHNLID[4:0]Digital Filter Analog Input Selection bits Note:Only the first 12 analog inputs, Class 2 (AN0-AN11), can use a digital filter. Description Reserved These bits specify the analog input to be used as the oversampling filter data source. Value 11111
... .. .. 01100 01011
... .. .. 00010 00001 00000 Reserved AN11 AN2 AN1 AN0 Bits 15:0 FLTRDATA[15:0]Digital Filter x Data Output Value bits The filter output data is as per the fractional format set in the FRACT bit (ADCCON1[23]). The FRACT bit must not be changed while the filter is enabled. Changing the state of the FRACT bit after the operation of the filter ended must not update the value of the FLTRDATA[15:0] bits to reflect the new format. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 938 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.15 ADCTRG1 ADC Trigger Source 1 Register Name:
Offset:
Reset:
Property:
ADCTRG1 0x1600 0x00000000
This register controls the trigger source selection for AN0 through AN3 analog inputs. Bit 31 30 29 Access Reset Bit 23 22 21 Access Reset Bit 15 14 13 Access Reset Bit 7 6 5 Access Reset 28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 27 R/W 0 19 R/W 0 11 R/W 0 3 R/W 0 26 TRGSRC3[4:0]
R/W 0 18 TRGSRC2[4:0]
R/W 0 10 TRGSRC1[4:0]
R/W 0 2 TRGSRC0[4:0]
R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 28:24 TRGSRC3[4:0]Trigger Source for Conversion of Analog Input AN3 Select bits Note:For STRIG, in addition to setting the trigger, it also requires programming of the STRGSRC[4:0] bits
(ADCCON1[20:16]) to select the trigger source, and requires the appropriate CSS bits to be set in the ADCCSSx registers. Value 10001 -
11111 10000 01111 01110 01101 01100 01011 01010 01001 01000 00111 00110 00101 00100 00011 00010 00001 00000 Description Reserved EVSYS_47 EVSYS_46 EVSYS_45 EVSYS_44 EVSYS_43 EVSYS_42 EVSYS_41 EVSYS_40 EVSYS_39 EVSYS_38 EVSYS_37 EVSYS_36 INT0 External interrupt STRIG Global level software trigger (GLSWTRG) Global software edge trigger (GSWTRG) No Trigger Bits 20:16 TRGSRC2[4:0]Trigger Source for Conversion of Analog Input AN2 Select bits Note:See bits 28-24 for bit value definitions. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 939 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Bits 12:8 TRGSRC1[4:0]Trigger Source for Conversion of Analog Input AN1 Select bits Note:See bits 28-24 for bit value definitions. Bits 4:0 TRGSRC0[4:0]Trigger Source for Conversion of Analog Input AN0 Select bits Note:See bits 28-24 for bit value definitions. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 940 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.16 ADCTRG2 ADC Trigger Source 2 Register Name:
Offset:
Reset:
Property:
ADCTRG2 0x1610 0x00000000
This register controls the trigger source selection for AN4 through AN7 analog inputs. Bit 31 30 29 Access Reset Bit 23 22 21 Access Reset Bit 15 14 13 Access Reset Bit 7 6 5 Access Reset 28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 27 R/W 0 19 R/W 0 11 R/W 0 3 R/W 0 26 TRGSRC7[4:0]
R/W 0 18 TRGSRC6[4:0]
R/W 0 10 TRGSRC5[4:0]
R/W 0 2 TRGSRC4[4:0]
R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 28:24 TRGSRC7[4:0]Trigger Source for Conversion of Analog Input AN7 Select bits Note:For STRIG, in addition to setting the trigger, it also requires programming of the STRGSRC[4:0] bits
(ADCCON1[20:16]) to select the trigger source, and requires the appropriate CSS bits to be set in the ADCCSSx registers. Value 10001 -
11111 10000 01111 01110 01101 01100 01011 01010 01001 01000 00111 00110 00101 00100 00011 00010 00001 00000 Description Reserved EVSYS_47 EVSYS_46 EVSYS_45 EVSYS_44 EVSYS_43 EVSYS_42 EVSYS_41 EVSYS_40 EVSYS_39 EVSYS_38 EVSYS_37 EVSYS_36 INT0 External interrupt STRIG Global level software trigger (GLSWTRG) Global software edge trigger (GSWTRG) No Trigger Bits 20:16 TRGSRC6[4:0]Trigger Source for Conversion of Analog Input AN6 Select bits Note:See bits 28-24 for bit value definitions. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 941 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Bits 12:8 TRGSRC5[4:0]Trigger Source for Conversion of Analog Input AN5 Select bits Note:See bits 28-24 for bit value definitions. Bits 4:0 TRGSRC4[4:0]Trigger Source for Conversion of Analog Input AN4 Select bits Note:See bits 28-24 for bit value definitions. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 942 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.17 ADCCMPCON1 ADC Digital Comparator 1 Control Register Name:
Offset:
Reset:
Property:
ADCCMPCON1 0x1680 0x00000000
This register controls the operation of Digital Comparator 1, including the generation of interrupts, comparison criteria to be used and provides status when a comparator event occurs. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit Access Reset R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 R/HS/HC 0 AINID[5:0]
7 ENDCMP R/W 0 6 DCMPGIEN R/W 0 5 DCMPED R/HS/HC 0 4 IEBTWN R/W 0 3 IEHIHI R/W 0 2 IEHILO R/W 0 1 IELOHI R/W 0 0 IELOLO R/W 0 Bits 13:8 AINID[5:0]Digital Comparator 1 Analog Input Identification (ID) bits When a digital comparator event occurs (DCMPED = 1), these bits identify the analog input being monitored by digital comparator 1. Note:In normal ADC mode, only analog inputs [8:1] can be processed by the digital comparator 1. Value 111111
... .. .. 101101 101100 101011 000111
... 000001 000000 Description Reserved Reserved Reserved Reserved AN7 is being monitored AN1 is being monitored AN0 is being monitored Bit 7 ENDCMPDigital Comparator 1 Enable bit Value 1 0 Description Digital comparator 1 is enabled Digital comparator 1 is not enabled, and the DCMPED status bit (ADCCMP0CON[5]) is cleared Bit 6 DCMPGIENDigital Comparator 1 Global Interrupt Enable bit Value 1 0 Description A Digital comparator 1 interrupt is generated when the DCMPED status bit (ADCCMP0CON[5]) is set A Digital comparator 1 interrupt is disabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 943 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Bit 5 DCMPEDDigital Comparator 1 Output True Event Status bit The logical conditions under which the digital comparator becomes True are defined by the IEBTWN, IEHIHI, IEHILO, IELOHI and IELOLO bits. Note:This bit is cleared by reading the AINID[5:0] bits or by disabling the Digital Comparator module (by setting ENDCMP to 0). Value 1 0 Description Digital comparator 1 output true event has occurred (output of comparator is 1) Digital comparator 1 output is false (output of comparator is 0) Bit 4 IEBTWNBetween Low/High Digital Comparator 1 Event bit Value 1 0 Description Generate a digital comparator event when DATA[31:0] is less than DCMPHI[15:0] AND greater than DCMPLO[15:0]
Do not generate a digital comparator event Bit 3 IEHIHIHigh/High Digital Comparator 1 Event bit Value 1 0 Description Generate a digital comparator 1 event when DCMPHI[15:0] bits are less than or equal to DATA[31:0]
bits Do not generate an event Bit 2 IEHILOHigh/Low Digital Comparator 1 Event bit Value 1 0 Description Generate a digital comparator 1 event when DATA[31:0] bits are less than DCMPHI[15:0] bits Do not generate an event Bit 1 IELOHILow/High Digital Comparator 1 Event bit Value 1 0 Description Generate a digital comparator 1 event when DCMPLO[15:0] bits are less than or equal to DATA[31:0]
bits Do not generate an event Bit 0 IELOLOLow/Low Digital Comparator 1 Event bit Value 1 0 Description Generate a digital comparator 1 event when DATA[31:0] bits are less than DCMPLO[15:0] bits Do not generate an event 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 944 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.18 ADCCMPCON2 ADC Digital Comparator 2 Control Register Name:
Offset:
Reset:
Property:
ADCCMPCON2 0x1690 0x00000000
These registers control the operation of Digital Comparator 2, including the generation of interrupts and the comparison criteria to be used. This register also provides the status when a comparator event occurs. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 Access Reset Bit Access Reset R/HS/HC 0 R/HS/HC 0 7 ENDCMP R/W 0 6 DCMPGIEN R/W 0 5 DCMPED R/HS/HC 0 4 IEBTWN R/W 0 3 IEHIHI R/W 0 10 AINID[4:0]
R/HS/HC 0 2 IEHILO R/W 0 9 8 R/HS/HC 0 R/HS/HC 0 1 IELOHI R/W 0 0 IELOLO R/W 0 Bits 12:8 AINID[4:0]Digital Comparator 2 Analog Input Identification (ID) bits When a digital comparator event occurs (DCMPED = 1), these bits identify the analog input being monitored by the digital comparator. Note:Only analog inputs [8:1] can be processed by the Digital Comparator module x (x = 1-2). Value 11111 11110
... .. .. 00011 000111
... 00001 00000 Description Reserved Reserved Reserved AN7 is being monitored AN1 is being monitored AN0 is being monitored Bit 7 ENDCMPDigital Comparator 2 Enable bit Value 1 0 Description Digital comparator 2 is enabled Digital comparator 2 is not enabled, and the DCMPED status bit (ADCCMP0CON[5]) is cleared Bit 6 DCMPGIENDigital Comparator 2 Global Interrupt Enable bit Value 1 0 Description Digital comparator 2 interrupt is generated when the DCMPED status bit (ADCCMP0CON[5]) is set Digital comparator 2 interrupt is disabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 945 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Bit 5 DCMPEDDigital Comparator 2 Output True Event Status bit The logical conditions where the digital comparator gets True are defined by the IEBTWN, IEHIHI, IEHILO, IELOHI and IELOLO bits. Note:This bit is cleared by reading the AINID[5:0] bits (ADCCMP0CON[13:8]) or by disabling the Digital Comparator module (by setting ENDCMP to 0). Value 1 0 Description Digital comparator 2 output true event has occurred (output of comparator is 1) Digital comparator 2 output is false (output of comparator is 0) Bit 4 IEBTWNBetween Low/High Digital Comparator 2 Event bit Value 1 0 Description Generate a digital comparator event when DCMPLO[15:0] bits DATA[31:0] bits [DCMPHI[15:0] bits Do not generate a digital comparator event Bit 3 IEHIHIHigh/High Digital Comparator 2 Event bit Value 1 0 Description Generate a digital comparator 2 event when DCMPHI[15:0] bits are less than or equal to DATA[31:0]
bits Do not generate an event Bit 2 IEHILOHigh/Low Digital Comparator 2 Event bit Value 1 0 Description Generate a digital comparator 2 event when DATA[31:0] bits are less than DCMPHI[15:0] bits Do not generate an event Bit 1 IELOHILow/High Digital Comparator 2 Event bit Value 1 0 Description Generate a digital comparator 2 event when DCMPLO[15:0] bits are less than or equal to DATA[31:0]
bits Do not generate an event Bit 0 IELOLOLow/Low Digital Comparator 2 Event bit Value 1 0 Description Generate a digital comparator 2 event when DATA[31:0] bits are less than DCMPLO[15:0] bits Do not generate an event 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 946 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.19 ADCBASE ADC Base Register Name:
Offset:
Reset:
Property:
ADCBASE 0x1700 0x00000000
This register specifies the base address of the user ADC Interrupt Service Routine (ISR) jump table. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 12 11 ADCBASE[15:8]
R/W 0 4 R/W 0 3 ADCBASE[7:0]
R/W 0 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 ADCBASE[15:0]ADCISR Base Address bits This register, when read, contains the base address of the user's ADC ISR jump table. The interrupt vector address is determined by the IRQVS[2:0] bits of the ADCCON1 register specifying the amount of left shift done to the ARDYx status bits in the ADCDSTAT1 register, prior to adding with ADCBASE register. Interrupt vector address = Read value of ADCBASE Read value of ADCBASE = Value written to ADCBASE + x << IRQVS[2:0], where x is the smallest active analog input ID from the ADCDSTAT1 register (which has the highest priority). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 947 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.20 ADCDMASTAT ADC DMA Status Register Name:
Offset:
Reset:
Property:
ADCDMASTAT 0x1710 0x00000000
This register contains the DMA status bits. 30 29 28 27 26 25 24 Bit Access Reset 31 DMAEN R/W 0 Bit 23 WROVRERR R/HS/HC 0 Access Reset RBF0IEN R/W 0 16 RBF0 R/HS/HC 0 8 RAF0IEN R/W 0 0 RAF0 R/HS/HC 0 22 21 20 19 18 17 Bit 15 14 13 12 11 10 DMACNTEN Access Reset R/W 0 Bit 7 6 5 4 3 2 9 1 Access Reset Bit 31 DMAENDMA Interface Enable bit When DMAEN = 0, no data is being saved into the DMA FIFO, no SRAM writes occur, and the DMA interface logic is being kept in Reset state. Description Value DMA interface is enabled 1 DMA interface is disabled 0 Bit 24 RBF0IENRAM Buffer B Full Interrupt Enable for channel 0 Value 1 0 Description Interrupts are enabled and generated when the RBFx Status bit is set Interrupts are disabled Bit 23 WROVRERRWrite Overflow Error in the DMA FIFO Set by hardware, cleared by hardware after a software read of the ADDMAST register. Note:The write always occurs and the old data is replaced with new data because the software missed reading the old data on time. Bit 16 RBF0RAM Buffer B FULL status bit for channel 0 This bit is self-clearing upon being read by software. Bit 15 DMACNTENDMA Buffer Sample Count Enable bit The DMA interface saves the current sample count for each buffer in the table starting at the ADCCNTB address after each sample write into the corresponding buffer in the SRAM. Bit 8 RAF0IENRAM Buffer A FULL Interrupt Enable for channel 0 Value 1 0 Description Interrupts are enabled and generated when the RAFx Status bit is set Interrupts are disabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 948 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Bit 0 RAF0RAM Buffer A FULL status bit for channel 0 This bit is self-clearing upon being read by software. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 949 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.21 ADCCNTB ADC Channel Sample Count Base Address Register Name:
Offset:
Reset:
Property:
ADCCNTB 0x1720 0x00000000
This register contains the base address of the sample count in RAM. In addition to storing the converted data of the ADC module in RAM, DMA also stores the converted sample count. Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 R 0 23 R 0 15 R 0 7 R 0 30 R 0 22 R 0 14 R 0 6 R 0 29 R 0 21 R 0 13 R 0 5 R 0 27 28 ADCCNTB[31:24]
R R 0 0 20 19 ADCCNTB[23:16]
R R 0 0 12 11 ADCCNTB[15:8]
R R 0 0 4 3 ADCCNTB[7:0]
R 0 R 0 26 R 0 18 R 0 10 R 0 2 R 0 25 R 0 17 R 0 9 R 0 1 R 0 24 R 0 16 R 0 8 R 0 0 R 0 Bits 31:0 ADCCNTB[31:0]ADC Channel Count Base Address SRAM address for the DMA interface at which to save the first class channel buffer A sample count values into the System RAM. If first class channel x, x=0...6, is ready with a new available sample data and the DMA interface is currently saving data for channel x to RAM Buffer z (where z==0means BufferA and z==1means Buffer B, z depending on x), then the DMA interface will increment (+1) the 1 byte count value stored at the System RAM address (ADCCNTB + 2*x + z). ADCCNTB works in conjunction with ADDMAB. The DMA interface uses ADCCNTB to save the buffer sample counts only if ADDMAST.DMA_CNT_EN is set to 1. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 950 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.22 ADCDMAB ADC DMA Base Address Register Name:
Offset:
Reset:
Property:
ADCDMAB 0x1730 0x00000000
This register contains the base address of RAM for the DMA engine. Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 R 0 23 R 0 15 R 0 7 R 0 30 R 0 22 R 0 14 R 0 6 R 0 29 R 0 21 R 0 13 R 0 5 R 0 28 27 ADDMAB[31:24]
R R 0 0 20 19 ADDMAB[23:16]
R R 0 0 12 11 ADDMAB[15:8]
R 0 4 R 0 ADDMAB[7:0]
R 0 3 R 0 26 R 0 18 R 0 10 R 0 2 R 0 25 R 0 17 R 0 9 R 0 1 R 0 24 R 0 16 R 0 8 R 0 0 R 0 Bits 31:0 ADDMAB[31:0]Base Address for the DMA Interface BASE ADDRESS for the DMA interface at which to save first class channel data into the System RAM. If first class channel x, x == 0...6, is ready with new available sample data and the DMA interface is currently saving data for channel x to RAM Buffer z (where z ==0 means Buffer A and z == 1 means Buffer B, z depending on x) and the current DMA x-counter value is y (y depending on x), then the DMA interface stores the 2-byte output data value at System RAM address (ADDMAB + (2*x + z)*2(DMABL+1) +2*y. Also, if ADDMAST.DMA_CNT_EN is set to 1, the DMA interface stores (without delay) the value y itself at the System RAM address (ADCCNTB + 2*x + z). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 951 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.23 ADCTRGSNS ADC Trigger Level/Edge Sensitivity Register Name:
Offset:
Reset:
Property:
ADCTRGSNS 0x1740 0x00000000
This register contains the setting for trigger level for each ADC analog input. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit Access Reset 7 LVL7 R/W 0 6 LVL6 R/W 0 5 LVL5 R/W 0 4 LVL4 R/W 0 3 LVL3 R/W 0 2 LVL2 R/W 0 1 LVL1 R/W 0 0 LVL0 R/W 0 Bits 0, 1, 2, 3, 4, 5, 6, 7 LVLTrigger Level and Edge Sensitivity bits Notes:
1. 2. This register specifies the trigger level for analog inputs 0 to 7. The higher analog input ID belongs to Class 3, and, therefore, is only scan triggered. All Class 3 analog inputs use the scan trigger, for which the level/edge is defined by the STRGLVL bit (ADCCON1[3]). Value 1 0 Description Analog input is sensitive to the high level of its trigger (level sensitivity implies retriggering as long as the trigger signal remains high) Analog input is sensitive to the positive edge of its trigger (this is the value after a reset) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 952 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.24 ADCANCON ADC Analog Warm-up Control Register Name:
Offset:
Reset:
Property:
ADCANCON 0x1800 0x00000000
This register contains the warm-up control settings for the analog and bias circuit of the ADC module. Bit 31 30 29 28 Access Reset Bit 23 WKIEN7 Access Reset R/W 0 22 21 20 27 R/W 0 19 26 25 WKUPCLKCNT[3:0]
R/W R/W 0 0 18 17 Bit 15 14 13 12 11 10 WKRDY7 R/HS/HC 0 Access Reset Bit Access Reset 7 ANEN7 R/W 0 6 5 4 3 2 9 1 Bits 27:24 WKUPCLKCNT[3:0]Wake-up Clock Count bits 24 R/W 0 16 WKIEN0 R/W 0 8 WKRDY0 R/HS/HC 0 0 ANEN0 R/W 0 Description 215= 32,768 clocks These bits represent the number of ADC clocks required to warm-up the ADC module before it can perform conversion. Although the clocks are specific to each ADC, the WKUPCLKCNT bit is common to all ADC modules. Value 1111
... .. .. 0110 0101 0100 0011 0010 0001 0000 26= 64 clocks 25= 32 clocks 24= 16 clocks 24= 16 clocks 24= 16 clocks 24= 16 clocks 24= 16 clocks Bit 23 WKIEN7Shared ADC (ADC2) Wake-up Interrupt Enable bit Value 1 0 Description Enable interrupt and generate interrupt when the WKRDY2 status bit is set Disable interrupt Bit 16 WKIEN0ADC1Wake-up Interrupt Enable bit Value 1 0 Description Enable interrupt and generate interrupt when the WKRDYx status bit is set Disable interrupt Bit 15 WKRDY7Shared ADC (ADC2) Wake-up Status bit Note:This bit is cleared by hardware when the ANEN2 bit is cleared. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 953 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) Value 1 0 Description ADC2 Analog and bias circuitry ready after the wake-up count number 2WKUPEXP clocks after setting ANEN2 to 1 ADC2 Analog and bias circuitry is not ready Bit 8 WKRDY0ADC1 Wake-up Status bit Note:This bit is cleared by hardware when the ANENx bit is cleared. Value 1 0 Description ADC1 Analog and bias circuitry ready after the wake-up count number 2WKUPEXP clocks after setting ANEN1 to 1 ADC1 Analog and bias circuitry is not ready Bit 7 ANEN7Shared ADC (ADC2) Analog and Bias Circuitry Enable bit Value 1 0 Description Analog and bias circuitry enabled. Once the analog and bias circuit is enabled, the ADC module needs a warm-up time, as defined by the WKUPCLKCNT[3:0] bits. Analog and bias circuitry disabled Bit 0 ANEN0ADC1 Analog and Bias Circuitry Enable bits Description Analog and bias circuitry enabled. Once the analog and bias circuit is enabled, the ADC module needs a warm-up time, as defined by the WKUPCLKCNT[3:0] bits. Analog and bias circuitry disabled Value 1 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 954 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.25 ADCSYSCFG0 ADC System Configuration Register 0 Name:
Offset:
Reset:
Property:
ADCSYSCFG0 0x1B00 0x00000000
This register contains read-only bits corresponding to the analog input. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 Access Reset Bit 15 Access Reset Bit Access Reset R 0 7 R 0 14 R 0 6 R 0 13 R 0 5 R 0 AN[15:8]
AN[7:0]
12 R 0 4 R 0 19 R 0 11 R 0 3 R 0 18 R 0 10 R 0 2 R 0 17 16 AN[19:16]
R 0 9 R 0 1 R 0 R 0 8 R 0 0 R 1 Bits 19:0 AN[19:0]ADC Analog Input bits These bits reflect the system configuration and are updated during boot-up time. By reading these read-only bits, the user application can determine whether or not an analog input in the device is available. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 955 PIC32CX-BZ2 and WBZ45 Family Analog-to-Digital Converter (ADC) 38.11.26 ADCDATAx ADC Output Data Register (x = 0 to 11) Name:
Offset:
Reset:
Property:
ADCDATAx 0x1Exx 0x00000000
These registers are the analog-to-digital conversion output data registers. The ADCDATAx register is associated with each external analog input, 0-7, plus internal analog inputs 8-11. Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 R 0 23 R 0 15 R 0 7 R 0 30 R 0 22 R 0 14 R 0 6 R 0 29 R 0 21 R 0 13 R 0 5 R 0 DATA[31:24]
DATA[23:16]
DATA[15:8]
DATA[7:0]
28 R 0 20 R 0 12 R 0 4 R 0 27 R 0 19 R 0 11 R 0 3 R 0 26 R 0 18 R 0 10 R 0 2 R 0 25 R 0 17 R 0 9 R 0 1 R 0 24 R 0 16 R 0 8 R 0 0 R 0 Bits 31:0 DATA[31:0]ADC Converted Data Output bits Notes:
1. When an alternate input is used as the input source for a dedicated ADC module, the data output is still read from the Primary input Data Output register. 2. Reading the ADCDATAx register value after changing the FRACT bit converts the data into the format specified by the FRACT bit. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 956 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39. Analog Comparators (AC) 39.1 Overview The Analog Comparator (AC) supports individual comparators: one shared (with built-in supply voltage monitor
(MVREF)) AC_CMP1 and one dedicated AC_CMP0. A continuous mode of operation on a shared comparator is supported only if MVREF is disabled:
PMU.CLKCTRL.MVREFFSMEN bit = 0 (Disabled). Each comparator (COMP) compares the voltage levels on two inputs and provides a digital output based on the comparison. Each comparator may be configured to generate interrupt requests and/or peripheral events upon several different combinations of input change. The input selection includes up to four shared analog port pins and several internal signals. Each Comparator Output state can also be output on a pin for use by external devices. The comparators are grouped in pairs on each port. The AC peripheral implements of comparators. These are called Comparator 0 (COMP0) and Comparator 1 (COMP1) They have identical behaviors but separate Control registers. pair can be set in Window mode to compare a signal to a voltage range instead of a single voltage level. Note:MVREF will not be able to monitor the supply voltage for 275 s from the time MCLR is released. 39.2 Features Two individual comparators (Single pair configuration) Analog comparator outputs available on pins Asynchronous or synchronous Flexible input selection:
Up to four pins selectable for positive or negative inputs Ground (for zero crossing) Bandgap reference voltage Programmable VDD scaler for AC_CMP1 (shared with Programmable Low Voltage Detector (PLVD)) and fixed VDD/2 for AC_CMP0 Interrupt generation on:
Rising or falling edge Toggle End of comparison Window function interrupt generation on:
Signal above window Signal inside window Signal below window Signal outside window Event generation on:
Comparator output Window function inside/outside window Optional digital filter on comparator output 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 957 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.3 Block Diagram Figure 39-1. Analog Comparator Block Diagram AIN0 AIN1 VDDANA SCALER BANDGAP AIN2 AIN3 COMP0
HYSTERESIS ENABLE INTERRUPT MODE COMPCTRLn WINCTRL ENABLE HYSTERESIS COMP1
INTERRUPT SENSITIVITY CONTROL
WINDOW FUNCTION CMP0 INTERRUPTS EVENTS GCLK_AC CMP1 39.4 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 39.4.1 I/O Lines Using the ACs I/O lines requires the I/O pins to be configured as analog pins for AC_AINx inputs. See I/O Ports and Peripheral Pin Select (PPS) from Related Links. Table 39-1. I/O LINES Signal AC_AIN0 AC_AIN1 AC_AIN2 AC_AIN3 AC_CMP0 AC_CMP1 Related Links 6. I/O Ports and Peripheral Pin Select (PPS) Peripheral Function CFGCON1.CMP0_OE CFGCON1.CMP1_OE 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 958 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.4.2 Power Management The AC will continue to operate in any Sleep mode where the selected source clock is running. The ACs interrupts can be used to wake-up the device from Standby Sleep mode. Events connected to the Event System can trigger other operations in the system without exiting Standby Sleep mode. 39.4.3 Clocks The AC bus clock (PB2_CLK) can be enabled and disabled in the Main Clock module, CRU (see Clock and Reset Unit (CRU) from Related Links), and the Analog Comparator module can be enabled or disabled via the PMD1 register. See Peripheral Module Disable Register (PMD) from Related Links. A generic clock (GCLK_AC) is required to clock the AC. This clock must be configured and enabled in the generic clock controller before using the AC. This generic clock is asynchronous to the bus clock (PB2_CLK). Due to this asynchronicity, writes to certain registers will require synchronization between the clock domains. See Synchronization from Related Links. Related Links 13. Clock and Reset Unit (CRU) 20. Peripheral Module Disable Register (PMD) 39.5.13. Synchronization 39.4.4 DMA Not applicable. 39.4.5 Interrupts The interrupt request lines are connected to the interrupt controller. Using the AC interrupts requires the interrupt controller to be configured first. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 39.4.6 Events The events are connected to the Event System. See Event System (EVSYS) from Related Links for details on how to configure the Event System. Related Links 28. Event System (EVSYS) 39.4.7 Debug Operation When the CPU is halted in debug mode, the AC will halt normal operation after any ongoing comparison is completed. The AC can be forced to continue normal operation during debugging. See DBGCTRL register from Related Links. If the AC is configured in a way that requires it to be periodically serviced by the CPU through interrupts or similar, improper operation or data loss may result during debugging. Related Links 39.7.9. DBGCTRL 39.4.8 Register Access Protection All registers with write access can be write-protected optionally by the Peripheral Access Controller (PAC), except for the following registers:
Control B register (CTRLB) Interrupt Flag register (INTFLAG) Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. PAC write protection does not apply to accesses through an external debugger. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 959 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.4.9 Analog Connections Each comparator has up to four I/O pins that can be used as analog inputs. Each pair of comparators shares the same four pins. These pins must be configured for analog operation before using them as comparator inputs. Any internal reference source, such as a bandgap voltage reference, must be configured and enabled prior to its use as a comparator input. 39.5 Functional Description 39.5.1 Principle of Operation Each comparator has one positive input and one negative input. Each positive input may be chosen from a selection of analog input pins. Each negative input may be chosen from a selection of both analog input pins and internal inputs, such as bandgap voltage reference. The digital output from the comparator is 1 when the difference between the positive and the negative input voltage is positive, and 0otherwise. The individual comparators can be used independently (Normal mode) or paired to form a window comparison
(Window mode). 39.5.2 Basic Operation 39.5.2.1 Initialization Some registers are enable-protected, meaning they can only be written when the module is disabled. The following register is enable-protected:
Event Control register (EVCTRL) Enable-protection is denoted by the "Enable-Protected" property in each individual register description. 39.5.2.2 Enabling, Disabling and Resetting The AC is enabled by writing a 1 to the Enable bit in the Control A register (CTRLA.ENABLE). The AC is disabled by writing a 0 to CTRLA.ENABLE. The AC is reset by writing a 1 to the Software Reset bit in the Control A register (CTRLA.SWRST). All registers in the AC will be reset to their initial state, and the AC will be disabled. See CTRLA register from Related Links. Related Links 39.7.1. CTRLA 39.5.2.3 Comparator Configuration Each individual comparator must be configured by its respective Comparator Control register (COMPCTRLx) before that comparator is enabled. These settings cannot be changed while the comparator is enabled. Select the desired measurement mode with COMPCTRLx.SINGLE. See Starting a Comparison from Related Links. Fixed hysteresis does not support programmable Hysteresis. Fixed speed of operation Select the interrupt source with COMPCTRLx.INTSEL. Select the positive and negative input sources with the COMPCTRLx.MUXPOS and COMPCTRLx.MUXNEG bits. See Selecting Comparator Inputs from Related Links. Select the filtering option with COMPCTRLx.FLEN. Select the standby operation with the Run in Standby bit (COMPCTRLx.RUNSTDBY). The individual comparators are enabled by writing a 1 to the Enable bit in the Comparator x Control registers
(COMPCTRLx.ENABLE). The individual comparators are disabled by writing a 0 to COMPCTRLx.ENABLE. Writing a 0 to CTRLA.ENABLE will also disable all the comparators but will not clear their COMPCTRLx.ENABLE bits. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 960 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) Related Links 39.5.2.4. Starting a Comparison 39.5.3. Selecting Comparator Inputs 39.5.2.4 Starting a Comparison Each comparator channel can be in one of two different measurement modes, which is determined by the COMPCTRLx.SINGLE bit:
Continuous measurement Single-shot After being enabled, a start-up delay is required before the result of the comparison is ready. This start-up time is measured automatically to account for environmental changes, such as temperature or voltage supply level, and is specified in the Electrical Specifications. During the start-up time, the COMP output is not available. The comparator can be configured to generate interrupts when the output toggles, when the output changes from 0 to 1 (rising edge), when the output changes from 1 to 0 (falling edge) or at the end of the comparison. An end-of-comparison interrupt can be used with the Single-Shot mode to chain further events in the system, regardless of the state of the comparator outputs. The Interrupt mode is set by the Interrupt Selection bit group in the Comparator Control register (COMPCTRLx.INTSEL). Events are generated using the comparator output state regardless of whether the interrupt is enabled or not. 39.5.2.4.1 Continuous Measurement Continuous measurement is selected by writing COMPCTRLx.SINGLE to zero. In continuous mode, the comparator is continuously enabled and performing comparisons. This ensures that the result of the latest comparison is always available in the Current State bit in the Status A register (STATUSA.STATEx). After the start-up time has passed, a comparison is done and STATUSA is updated. The Comparator x Ready bit in the Status B register (STATUSB.READYx) is set, and the appropriate peripheral events and interrupts are also generated. New comparisons are performed continuously until the COMPCTRLx.ENABLE bit is written to zero. The start-up time applies only to the first comparison. In the continuous operation, edge detection of the comparator output for interrupts is done by comparing the current and previous sample. The sampling rate is the GCLK_AC frequency. An example of continuous measurement is shown in the following figure. Figure 39-2. Continuous Measurement Example GCLK_AC_DIG Write 1 COMPCTRLx.ENABLE 2-3 cycles tSTARTUP STATUSB.READYx Sampled Comparator Output For low-power operation, comparisons can be performed during sleep mode without a clock. The comparator is enabled continuously, and changes of the comparator state are detected asynchronously. When a toggle occurs, the CRU will start GCLK_AC to register the appropriate peripheral events and interrupts. The GCLK_AC clock is, then, disabled again automatically unless configured to wake up the system from sleep. 39.5.2.4.2 Single-Shot Single-shot operation is selected by writing COMPCTRLx.SINGLE to 1. During single-shot operation, the comparator is normally idle. The user starts a single comparison by writing 1 to the respective Start Comparison bit in the write-only Control B register (CTRLB.STARTx). The comparator is enabled and, after the start-up time has passed, a single comparison is done and STATUSA is updated. Appropriate peripheral events and interrupts are also generated. No new comparisons will be performed. Writing 1 to CTRLB.STARTx also clears the Comparator x Ready bit in the Status B register (STATUSB.READYx). STATUSB.READYx is set automatically by hardware when the single comparison has completed. A single-shot measurement can also be triggered by the Event System. Setting the Comparator x Event Input bit in the Event Control Register (EVCTRL.COMPEIx) enables triggering on incoming peripheral events. Each comparator can be triggered independently by separate events. Event-triggered operation is similar to user-triggered operation;
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 961 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) the difference is that a peripheral event from another hardware module causes the hardware to automatically start the comparison and will not clear STATUSB.READYx. To detect an edge of the comparator output in single-shot operation for the purpose of interrupts, the result of the current measurement is compared with the result of the previous measurement (one sampling period earlier). An example of single-shot operation is shown in the following figure. Figure 39-3. Single-Shot Example GCLK_AC Write 1 Write 1 CTRLB.STARTx 2-3 cycles 2-3 cycles tSTARTUP tSTARTUP STATUSB.READYx Sampled Comparator Output For low-power operation, event-triggered measurements can be performed during sleep modes. When the event occurs, the CRU will start GCLK_AC. The comparator is enabled and, after the start-up time has passed, a comparison is done and appropriate peripheral events and interrupts are also generated. The comparator and GCLK_AC are, then, disabled again automatically unless configured to wake up the system from sleep. 39.5.3 Selecting Comparator Inputs Each comparator has one positive and one negative input. The positive input is one of the external input pins (AINx). The negative input can be fed either from an external input pin (AINx) or from one of the internal reference voltage sources common to all comparators. The user selects the input source as follows:
The positive input is selected by the Positive Input MUX Select bit group in the Comparator Control register
(COMPCTRLx.MUXPOS). The negative input is selected by the Negative Input MUX Select bit group in the Comparator Control register
(COMPCTRLx.MUXNEG). In the case of using an external I/O pin, the selected pin must be configured for analog use in the GPIO by disabling the digital input and output. The switching of the analog input multiplexers is controlled to minimize crosstalk between the channels. The input selection must be changed only while the individual comparator is disabled. Note:For internal use of the comparison results by the CCL module (see Configurable Custom Logic (CCL) from Related Links), COMPCTRLx.OUT must be 0x1 or 0x2. Related Links 34. Configurable Custom Logic (CCL) 39.5.4 Window Operation Each comparator pair can be configured to work together in Window mode. In this mode, a voltage range is defined, and the comparators give information about whether an input signal is within this range or not. Window mode is enabled by the Window Enable x bit in the Window Control register (WINCTRL.WENx). Both comparators in a pair must have the same measurement mode setting in their respective Comparator Control Registers
(COMPCTRLx.SINGLE). Notes:
1. Both comparators must be enabled (COMPCTRLx.ENABLE = 1) before the Window mode is enabled
(WINCTRL.WEN0 = 1). 2. Window mode must be first disabled (WINCTRL.WEN0 = 0) before both comparators are disabled 3.
(COMPCTRLx.ENABLE = 0). The ready bits for both comparators must be checked (STATUSB.READYx = 1) before reading the measurement results. To physically configure the pair of comparators for Window mode, the same I/O pin must be chosen as positive input for each comparator, providing a shared input signal. The negative inputs define the range for the window. In the figure below, COMP0 defines the upper limit and COMP1 defines the lower limit of the window, as shown but the window will also work in the opposite configuration with COMP0 lower and COMP1 higher. The current state of the window function is available in the Window x State bit group of the Status register (STATUS.WSTATEx). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 962 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) Window mode can be configured to generate interrupts when the input voltage changes to below the window, when the input voltage changes to above the window, when the input voltage changes into the window or when the input voltage changes outside the window. The interrupt selections are set by the Window Interrupt Selection bit field in the Window Control register (WINCTRL.WINTSEL). Events are generated using the inside/outside state of the window, regardless of whether the interrupt is enabled or not. Note that the individual comparator outputs, interrupts and events continue to function normally during Window mode. When the comparators are configured for Window mode and Single-shot mode, measurements are performed simultaneously on both comparators. Writing '1' to either Start Comparison bit in the Control B register
(CTRLB.STARTx) will start a measurement. Likewise either peripheral event can start a measurement. Figure 39-4. Comparators in Window Mode
COMP0 COMP1 INTERRUPT SENSITIVITY CONTROL
WINDOW FUNCTION STATE0 WSTATE[1:0]
INTERRUPTS EVENTS STATE1 UPPER LIMIT OF WINDOW INPUT SIGNAL LOWER LIMIT OF WINDOW 39.5.5 VDD Scaler The VDD scaler generates a reference voltage that is a fraction of the devices supply voltage with 64 levels. The programmable VDD scaler (PLVD Scaler) is available for AC_CMP1 only. AC_CMP0 uses a fixed VDD/2 reference. The scaler of a comparator is enabled when the Negative Input Mux bit field or the Positive Input Mux in the respective Comparator Control register (COMPCTRLx.MUXNEG) is set to 0x5 and the comparator is enabled. The voltage of each channel is selected by the Value bit field in the SCALER1 registers (SCALER1.VALUE) using the VDD resistor ladder. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 963 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) Figure 39-5. PLVD Scaler COMPCTRLx.MUXNEG == 5 SCALER1.. VALUE 4 to COMP1 39.5.6 Filtering The output of the comparators can be filtered digitally to reduce noise. The filtering is determined by the Filter Length bits in the Comparator Control x register (COMPCTRLx.FLEN), and is independent for each comparator. Filtering is selectable from none, 3-bit majority (N=3) or 5-bit majority (N=5) functions. Any change in the comparator output is considered valid only if N/2+1 out of the last N samples agree. The filter sampling rate is the GCLK_AC frequency. Note that filtering creates an additional delay of N-1 sampling cycles from when a comparison is started until the comparator output is validated. For Continuous mode, the first valid output will occur when the required number of filter samples is taken. Subsequent outputs will be generated every cycle based on the current sample plus the previous N-1 samples, as shown in Figure 39-6. For Single-shot mode, the comparison completes after the Nth filter sample, as shown in Figure 39-7. Figure 39-6. Continuous Mode Filtering Sampling Clock Sampled Comparator Output 3-bit Majority Filter Output 5-bit Majority Filter Output Figure 39-7. Single-Shot Filtering tSTARTUP Sampling Clock Start 3-bit Sampled Comparator Output 3-bit Majority Filter Output 5-bit Sampled Comparator Output 5-bit Majority Filter Output 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 964 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) During Sleep modes, filtering is supported only for single-shot measurements. Filtering must be disabled if continuous measurements will be done during Sleep modes, or the resulting interrupt/event may be generated incorrectly. 39.5.7 Comparator Output The output of each comparator can be routed to an I/O pin by setting the Output bit group in the Comparator Control x register (COMPCTRLx.OUT). To get the analog comparator output on the I/O line, CFGCON1.CMP0_OE/
CFGCON1.CMP1_OE also needs to be set or enabled. This allows the comparator to be used by external circuitry. Either the raw, non-synchronized output of the comparator or the GCLK_AC-synchronized version, including filtering, can be used as the I/O signal source. The output appears on the corresponding AC_CMPx pin. The AC_CMP1 can be output on an alternate pin by configuring the CFGCON0.ACCMP1_ALTEN configuration. 39.5.8 Offset Compensation The Swap bit in the Comparator Control registers (COMPCTRLx.SWAP) controls switching of the input signals to a comparator's positive and negative terminals. When the comparator terminals are swapped, the output signal from the comparator is also inverted, as shown in Figure 39-8. This allows the user to measure or compensate for the comparator input offset voltage. As part of the input selection, COMPCTRLx.SWAP can be changed only while the comparator is disabled. Figure 39-8. Input Swapping for Offset Compensation MUXPOS
COMPx CMPx HYSTERESIS ENABLE SWAP MUXNEG COMPCTRLx SWAP 39.5.9 DMA Operation Not applicable. 39.5.10 Interrupts The AC has the following interrupt sources:
Comparator (COMP0, COMP1): Indicates a change in comparator status Window (WIN0): Indicates a change in the window status Comparator interrupts are generated based on the conditions selected by the Interrupt Selection bit group in the Comparator Control registers (COMPCTRLx.INTSEL). Window interrupts are generated based on the conditions selected by the Window Interrupt Selection bit group in the Window Control register (WINCTRL.WINTSEL[1:0]). Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a one to the corresponding bit in the Interrupt Enable Set (INTENSET) register and disabled by writing a one to the corresponding bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled or the AC is Reset. See INTFLAG register from Related Links for details on how to clear interrupt flags. All interrupt requests from the peripheral are OR'ed together on the system level to generate one combined interrupt request to the NVIC. The user must read the INTFLAG register to determine which interrupt condition is present. See Nested Vector Interrupt Controller (NVIC) from Related Links. Note:Interrupts must be globally enabled for interrupt requests to be generated. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 965 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 39.7.6. INTFLAG 39.5.11 Events The AC can generate the following output events:
Comparator (COMP0, COMP1): Generated as a copy of the comparator status Window (WIN0): Generated as a copy of the window inside/outside status Writing a one to an Event Output bit in the Event Control Register (EVCTRL.xxEO) enables the corresponding output event. Writing a zero to this bit disables the corresponding output event. See Event System (EVSYS) from Related Links for details on how to configure the Event System. The AC can take the following action on an input event:
Start comparison (START0, START1): Start a comparison Writing a one to an Event Input bit into the Event Control register (EVCTRL.COMPEIx) enables the corresponding action on an input event. Writing a zero to this bit disables the corresponding action on an input event. Note that if several events are connected to the AC, the enabled action will be taken on any of the incoming events. See Event System (EVSYS) from Related Links for details on how to configure the Event System. When EVCTRL.COMPEIx is one, the event will start a comparison on COMPx after the start-up time delay. In normal mode, each comparator responds to its corresponding input event independently. For a pair of comparators in window mode, either comparator event will trigger a comparison on both comparators simultaneously. Related Links 28. Event System (EVSYS) 39.5.12 Sleep Mode Operation The Run in Standby bits in the Comparator x Control registers (COMPCTRLx.RUNSTDBY) control the behavior of the AC during standby sleep mode. Each RUNSTDBY bit controls one comparator. When the bit is zero, the comparator is disabled during sleep, but maintains its current configuration. When the bit is one, the comparator continues to operate during sleep. Note that when RUNSTDBY is zero, the analog blocks are powered off for the lowest power consumption. This necessitates a start-up time delay when the system returns from sleep. For Window Mode operation, both comparators in a pair must have the same RUNSTDBY configuration. When RUNSTDBY is one, any enabled AC interrupt source can wake up the CPU. The AC can also be used during sleep modes where the clock used by the AC is disabled, provided that the AC is still powered (not in shutdown). In this case, the behavior is slightly different and depends on the measurement mode, as listed in Table 39-2. Table 39-2. Sleep Mode Operation COMPCTRLx.MODE RUNSTDBY=0 RUNSTDBY=1 0 (Continuous) COMPx disabled GCLK_AC stopped, COMPx enabled 1 (Single-shot) COMPx disabled GCLK_AC stopped, COMPx enabled only when triggered by an input event 39.5.12.1 Continuous Measurement during Sleep When a comparator is enabled in continuous measurement mode and GCLK_AC is disabled during sleep, the comparator will remain continuously enabled and will function asynchronously. The current state of the comparator is asynchronously monitored for changes. If an edge matching the interrupt condition is found, GCLK_AC is started to register the interrupt condition and generate events. If the interrupt is enabled in the Interrupt Enable registers
(INTENCLR/SET), the AC can wake up the device; otherwise GCLK_AC is disabled until the next edge detection. Filtering is not possible with this configuration. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 966 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) Figure 39-9. Continuous Mode SleepWalking GCLK_AC Write 1 COMPCTRLx.ENABLE 2-3 cycles tSTARTUP STATUSB.READYx Sampled Comparator Output 39.5.12.2 Single-Shot Measurement during Sleep For low-power operation, event-triggered measurements can be performed during sleep modes. When the event occurs, the CRU will start GCLK_AC. The comparator is enabled and, after the start-up time has passed, a comparison is done, with filtering if desired, and the appropriate peripheral events and interrupts are also generated as shown in the following figure. The comparator and GCLK_AC are, then, disabled again automatically unless configured to wake the system from sleep. Filtering is allowed with this configuration. Figure 39-10. Single-Shot SleepWalking GCLK_AC Input Event Comparator Output or Event tSTARTUP tSTARTUP 39.5.13 Synchronization Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be synchronized when written or read. The following bits are synchronized when written:
Software Reset bit in Control register (CTRLA.SWRST) Enable bit in Control register (CTRLA.ENABLE) Enable bit in Comparator Control register (COMPCTRLn.ENABLE) The following registers are synchronized when written:
Window Control register (WINCTRL) Required write synchronization is denoted by the "Write-Synchronized" property in the register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 967 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.6 Register Summary Bit Pos. 7 6 5 4 3 2 1 0 7:0 7:0 7:0 15:8 7:0 7:0 7:0 7:0 7:0 7:0 7:0 WSTATE0[1:0]
Name CTRLA CTRLB EVCTRL INTENCLR INTENSET INTFLAG STATUSA STATUSB DBGCTRL WINCTRL Reserved Offset 0x00 0x01 0x02 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B
... 0x0C 0x0D 0x0E
... 0x0F SCALER1 7:0 Reserved ENABLE SWRST WINTSEL0[1:0]
DBGRUN WEN0 VALUE[3:0]
0x10 COMPCTRL0 0x14 COMPCTRL1 0x18
... 0x1F Reserved 0x20 SYNCBUSY 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 RUNSTDBY INTSEL[1:0]
SINGLE ENABLE SWAP MUXPOS[2:0]
RUNSTDBY INTSEL[1:0]
SINGLE SWAP MUXPOS[2:0]
OUT[1:0]
OUT[1:0]
MUXNEG[2:0]
FLEN[2:0]
ENABLE MUXNEG[2:0]
FLEN[2:0]
WINCTRL ENABLE SWRST 39.7 Register Description Registers can be 8, 16, or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write-
protection is denoted by the PAC Write-Protection property in each individual register description. See Register Access Protection from Related Links. Some registers are synchronized when read and/or written. Synchronization is denoted by the Write-Synchronized or the Read-Synchronized property in each individual register description. See Synchronization from Related Links. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable-
protection is denoted by the "Enable-Protected" property in each individual register description. Related Links 39.4.8. Register Access Protection 39.5.13. Synchronization 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 968 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized CTRLA 0x00 0x00 Bit 7 6 5 4 3 2 Access Reset Bit 1 ENABLEEnable 1 ENABLE R/W 0 0 SWRST W 0 Due to synchronization, there is delay from updating the register until the peripheral is enabled/disabled. The value written to CTRL.ENABLE will read back immediately and the corresponding bit in the Synchronization Busy register
(SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE is cleared when the peripheral is enabled/disabled. Value 0 1 Description The AC is disabled. The AC is enabled. Each comparator must also be enabled individually by the Enable bit in the Comparator Control register (COMPCTRLn.ENABLE). Bit 0 SWRSTSoftware Reset Writing a 0 to this bit has no effect. Writing a 1 to this bit resets all registers in the AC to their initial state, and the AC will be disabled. Writing a 1 to CTRLA.SWRST will always take precedence, meaning that all other writes in the same write-operation will be discarded. Due to synchronization, there is a delay from writing CTRLA.SWRST until the reset is complete. CTRLA.SWRST and SYNCBUSY.SWRST will both be cleared when the reset is complete. Value 0 1 Description There is no reset operation ongoing. The reset operation is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 969 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.2 Control B Name:
Offset:
Reset:
Property:
CTRLB 0x01 0x00
Bit 7 6 5 4 3 2 1 0 Access Reset 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 970 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.3 Event Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected EVCTRL 0x02 0x0000 Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 971 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.4 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x04 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENSET). Bit 7 6 5 4 3 2 1 0 Access Reset 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 972 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.5 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x05 0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear register (INTENCLR). Bit 7 6 5 4 3 2 1 0 Access Reset 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 973 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.6 Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
INTFLAG 0x06 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 974 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.7 Status A Name:
Offset:
Reset:
Property:
STATUSA 0x07 0x00
Bit 7 6 Access Reset WSTATE0[1:0]
5 R 0 4 R 0 3 2 1 0 Bits 5:4 WSTATE0[1:0]Window 0 Current State These bits show the current state of the signal if the window 0 mode is enabled. These values may change in during startup and measurement cycles. When polling for sample completion use both STATUSB.READYx bits to signal completion. Value 0x0 0x1 0x2 0x3 Description Signal is above window Signal is inside window Signal is below window Reserved Name ABOVE INSIDE BELOW
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 975 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.8 Status B Name:
Offset:
Reset:
Property:
STATUSB 0x08 0x00
Bit 7 6 5 4 3 2 1 0 Access Reset 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 976 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.9 Debug Control Name:
Offset:
Reset:
Property: PAC Write-Protection DBGCTRL 0x09 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGRUNDebug Run DBGRUN R/W 0 This bit is not reset by a software reset. This bits controls the functionality when the CPU is halted by an external debugger. Value 0 Description The AC is halted when the CPU is halted by an external debugger. Any on-going comparison will complete. The AC continues normal operation when the CPU is halted by an external debugger. 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 977 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.10 Window Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized WINCTRL 0x0A 0x00 Bit 7 6 5 4 3 Access Reset Bits 2:1 WINTSEL0[1:0]Window 0 Interrupt Selection 2 1 WINTSEL0[1:0]
R/W 0 R/W 0 0 WEN0 R/W 0 These bits configure the interrupt mode for the comparator window 0 mode. Value 0x0 0x1 0x2 0x3 Description Interrupt on signal above window Interrupt on signal inside window Interrupt on signal below window Interrupt on signal outside window Name ABOVE INSIDE BELOW OUTSIDE Bit 0 WEN0Window 0 Mode Enable Value 0 1 Description Window mode is disabled for comparators 0 and 1. Window mode is enabled for comparators 0 and 1. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 978 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.11 Scaler 1 Name:
Offset:
Reset:
Property: PAC Write-Protection SCALER1 0x0D 0x00 Bit 7 6 5 4 Access Reset 3 R/W 0 VALUE[3:0]
2 R/W 0 1 R/W 0 0 R/W 0 Bits 3:0 VALUE[3:0]Scaler Value These bits define the scaling factor for channel 1 of the VDD voltage scaler. The output voltage, VSCALE, is:
R_Bottom R_Total VSCALE = VDD Where, R_Total = 900. Refer to the following table for R_Bottom for different VALUE[3:0]
For example, VSCALE for VALUE[3:0] = 0x02 at VDD = 3.3V VSCALE = 3.3 Table 39-3. Scaler Value
= 2.1945V 598.5 900 Value[3:0]
0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC 0xD 0xE 0xF R_Bottom Reserved Reserved 598.5 634.5 306 324 328.5 360 387 400.5 432 450 468 490.5 481.5 External Reference on LVDIN pin 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 979 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.12 Comparator Control n Name:
Offset:
Reset:
Property: PAC Write-Protection COMPCTRL 0x10 + n*0x04 [n=0..1]
0x00000000 Bit 31 30 Access Reset Bit 23 22 OUT[1:0]
29 R/W 0 21 Access Reset Bit Access Reset 15 SWAP R/W 0 14 R/W 0 13 MUXPOS[2:0]
R/W 0 Bit 7 Access Reset 5 6 RUNSTDBY R/W 0 Bits 29:28 OUT[1:0]Output 28 R/W 0 20 12 R/W 0 4 27 19 11 3 INTSEL[1:0]
R/W 0 R/W 0 26 R/W 0 18 10 R/W 0 25 FLEN[2:0]
R/W 0 17 9 MUXNEG[2:0]
R/W 0 2 SINGLE R/W 0 1 ENABLE R/W 0 24 R/W 0 16 8 R/W 0 0 These bits configure the output selection for comparator n. COMPCTRLn.OUT can be written only while COMPCTRLn.ENABLE is zero. Note:For internal use of the comparison results by the CCL, this must be 0x1 or 0x2. These bits are not synchronized. Description Name Value OFF The output of COMPn is not routed to the COMPn I/O port 0x0 ASYNC The asynchronous output of COMPn is routed to the COMPn I/O port 0x1 SYNC 0x2 N/A 0x3 The synchronous output (including filtering) of COMPn is routed to the COMPn I/O port Reserved Bits 26:24 FLEN[2:0]Filter Length These bits configure the filtering for comparator n. COMPCTRLn.FLEN can only be written while COMPCTRLn.ENABLE is zero. These bits are not synchronized. Name Value OFF 0x0 MAJ3 0x1 MAJ5 0x2 0x3-0x7 N/A Description No filtering 3-bit majority function (2 of 3) 5-bit majority function (3 of 5) Reserved Bit 15 SWAPSwap Inputs and Invert This bit swaps the positive and negative inputs to COMPn and inverts the output. This function can be used for offset cancellation. COMPCTRLn.SWAP can be written only while COMPCTRLn.ENABLE is zero. These bits are not synchronized. Value 0 Description The output of MUXPOS connects to the positive input, and the output of MUXNEG connects to the negative input. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 980 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) Value 1 Description The output of MUXNEG connects to the positive input, and the output of MUXPOS connects to the negative input. Bits 14:12 MUXPOS[2:0]Positive Input Mux Selection These bits select which input will be connected to the positive input of comparator n. COMPCTRLn.MUXPOS can be written only while COMPCTRLn.ENABLE is zero. These bits are not synchronized. Name Value PIN0 0x0 PIN1 0x1 PIN2 0x2 PIN3 0x3 VSCALE 0x4
0x50x7 Description I/O pin 0 I/O pin 1 I/O pin 2 I/O pin 3 VDD scaler Reserved Bits 10:8 MUXNEG[2:0]Negative Input Mux Selection These bits select which input will be connected to the negative input of comparator n. COMPCTRLn.MUXNEG can only be written while COMPCTRLn.ENABLE is zero. These bits are not synchronized. Name Value PIN0 0x0 PIN1 0x1 PIN2 0x2 PIN3 0x3 GND 0x4 VSCALE 0x5 BANDGAP 0x6 Description I/O pin 0 I/O pin 1 I/O pin 2 I/O pin 3 Ground VDD scaler Internal bandgap voltage Bit 6 RUNSTDBYRun in Standby This bit controls the behavior of the comparator during standby sleep mode. This bit is not synchronized Value 0 1 Description The comparator is disabled during sleep. The comparator continues to operate during sleep. Bits 4:3 INTSEL[1:0]Interrupt Selection These bits select the condition for comparator n to generate an interrupt or event. COMPCTRLn.INTSEL can be written only while COMPCTRLn.ENABLE is zero. These bits are not synchronized. Name Value TOGGLE 0x0 RISING 0x1 FALLING 0x2 EOC 0x3 Description Interrupt on comparator output toggle Interrupt on comparator output rising Interrupt on comparator output falling Interrupt on end of comparison (single-shot mode only) Bit 2 SINGLESingle-Shot Mode This bit determines the operation of comparator n. COMPCTRLn.SINGLE can be written only while COMPCTRLn.ENABLE is zero. These bits are not synchronized. Value 0 1 Description Comparator n operates in continuous measurement mode. Comparator n operates in single-shot mode. Bit 1 ENABLEEnable Writing a zero to this bit disables comparator n. Writing a one to this bit enables comparator n. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 981 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) Due to synchronization, there is a delay from updating the register until the comparator is enabled/disabled. The value written to COMPCTRLn.ENABLE will read back immediately after being written. SYNCBUSY.COMPCTRLn is set. SYNCBUSY.COMPCTRLn is cleared when the peripheral is enabled/disabled. Writing a one to COMPCTRLn.ENABLE will prevent further changes to the other bits in COMPCTRLn. These bits remain protected until COMPCTRLn.ENABLE is written to zero and the write is synchronized. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 982 PIC32CX-BZ2 and WBZ45 Family Analog Comparators (AC) 39.7.13 Synchronization Busy Name:
Offset:
Reset:
Property:
SYNCBUSY 0x20 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 3 Access Reset 2 WINCTRL R 0 1 ENABLE R 0 0 SWRST R 0 Bit 2 WINCTRLWINCTRL Synchronization Busy This bit is cleared when the synchronization of the WINCTRL register between the clock domains is complete. This bit is set when the synchronization of the WINCTRL register between clock domains is started. Bit 1 ENABLEEnable Synchronization Busy This bit is cleared when the synchronization of the CTRLA.ENABLE bit between the clock domains is complete. This bit is set when the synchronization of the CTRLA.ENABLE bit between clock domains is started. Bit 0 SWRSTSoftware Reset Synchronization Busy This bit is cleared when the synchronization of the CTRLA.SWRST bit between the clock domains is complete. This bit is set when the synchronization of the CTRLA.SWRST bit between clock domains is started. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 983 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40. Timer/Counter (TC) 40.1 Overview There are up to TC peripheral instances. Each TC consists of a counter, a prescaler, compare/capture channels and control logic. The counter can be set to count events, or clock pulses. The counter, together with the compare/capture channels, can be configured to time stamp input events or IO pin edges, allowing for capturing of frequency and/or pulse width. A TC can also perform waveform generation, such as frequency generation and pulse-width modulation. Note:Traditional Timer/Counter (TC) documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Host and Client, respectively. 40.2 Features Selectable Configuration 8-, 16- or 32-bit TC operation, with compare/capture channels 2 Compare/Capture Channels (CC) with:
Double buffered timer period setting (in 8-bit mode only) Double buffered compare channel Waveform Generation Frequency generation Single-slope pulse-width modulation Input Capture Event / IO pin edge capture Frequency capture Pulse-width capture Time-stamp capture Minimum and maximum capture One Input Event Interrupts/Output Events ON:
Counter overflow/underflow Compare match or capture Internal Prescaler DMA Support 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 984 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.3 Block Diagram Figure 40-1. Timer/Counter Block Diagram Base Counter BUFV PERBUF Counter PER COUNT Prescaler
"count"
"clear"
"load"
"direction"
OVF (INT/Event/DMA Req.) ERR (INT Req.) Control Logic TC Input Event Event System
= 0 TOP BOTTOM
t n e v e
E T A D P U Compare/Capture
(Unit x = {0,1}
BUFV CCBUFx
"capture"
Control Logic CCx
Waveform Generation WO[1]
WO[0]
"match"
MCx (INT/Event/DMA Req.) 40.4 Signal Description Table 40-1. Signal Description for TC Signal Name WO[1:0]
Type Digital output Digital input Description Waveform output Capture input See I/O Ports and Peripheral Pin Select (PPS) from Related Links for details on the pin mapping for this peripheral. One signal can be mapped on several pins. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 985 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Related Links 6. I/O Ports and Peripheral Pin Select (PPS) 40.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 40.5.1 I/O Lines In order to use the I/O lines of this peripheral, the I/O pins must be configured using the I/O Peripheral Pin Select
(PPS). 40.5.2 Power Management This peripheral can continue to operate in any Sleep mode where its source clock is running. The interrupts can wake up the device from Sleep modes. Events connected to the event system can trigger other operations in the system without exiting Sleep modes. 40.5.3 Clocks The TC bus clocks (PB1_CLK) can be enabled and disabled in the PMD Registers. For more details and default status of this clock, see Peripheral Module Disable Register (PMD) from Related Links. The generic clocks (GCLK_TCx) are asynchronous to the user interface clock (PB1_CLK). Due to this asynchronicity, accessing certain registers will require synchronization between the clock domains. Note:Two instances of the TC may share a peripheral clock channel. In this case, they cannot be set to different clock frequencies. See System and Peripheral Clock Generation (CLKGEN) from Related Links to identify shared peripheral clocks. Related Links 13.4. System and Peripheral Clock Generation (CLKGEN) 20. Peripheral Module Disable Register (PMD) 40.5.4 DMA The DMA request lines are connected to the DMA Controller (DMAC). In order to use DMA requests with this peripheral, the DMAC must be configured first (see Direct Memory Access Controller (DMAC) from Related Links). Related Links 22. Direct Memory Access Controller (DMAC) 40.5.5 Interrupts The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral, the Interrupt Controller (NVIC) must be configured first. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 40.5.6 Events The events of this peripheral are connected to the Event System. Related Links 28. Event System (EVSYS) 40.5.7 Debug Operation When the CPU is halted in Debug mode, this peripheral will halt normal operation. This peripheral can be forced to continue operation during debugging. For more details, see DBGCTRL from Related Links. Related Links 40.7.2.11. DBGCTRL 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 986 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.5.8 Register Access Protection Registers with write access can be optionally write-protected by the Peripheral Access Controller (PAC), except for the following:
Interrupt Flag Status and Clear register (INTFLAG) Status register (STATUS) Period and Period Buffer registers (PER, PERBUF) Compare/Capture Value registers and Compare/Capture Value Buffer registers (CCx, CCBUFx) Note:Optional write protection is indicated by the "PAC Write Protection" property in the register description. Write protection does not apply for accesses through an external debugger. 40.5.9 Analog Connections Not applicable. 40.6 Functional Description 40.6.1 Principle of Operation The following definitions are used throughout the documentation:
Table 40-2. Timer/Counter Definitions Name TOP ZERO MAX UPDATE Timer Counter CC Description The counter reaches TOP when it becomes equal to the highest value in the count sequence. The TOP value can be the same as Period (PER) or the Compare Channel 0 (CC0) register value depending on the waveform generator mode in Waveform Output Operations. See Waveform Output Operations from Related Links. The counter is ZERO when it contains all zeros. The counter reaches MAX when it contains all ones. The timer/counter signals an update when it reaches ZERO or TOP, depending on the direction settings. The timer/counter clock control is handled by an internal source. The clock control is handled externally (e.g., counting external events). For compare operations, the CC are referred to as compare channels. For capture operations, the CC are referred to as capture channels. Each TC instance has up to two compare/capture channels (CC0 and CC1). The counter in the TC can either count events from the Event System or clock ticks of the GCLK_TCx clock, which may be divided by the prescaler. The counter value is passed to the CCx where it can be either compared to user-defined values or captured. For optimized timing, the CCx and CCBUFx registers share a common resource. When writing into CCBUFx, lock the access to the corresponding CCx register (SYNCBUSY.CCX = 1) until the CCBUFx register value is not loaded into the CCx register (BUFVx == 1). Each buffer register has a buffer valid (BUFV) flag that indicates when the buffer contains a new value. The Counter register (COUNT) and the Compare and Capture registers with buffers (CCx and CCBUFx) can be configured as 8-, 16- or 32-bit registers, with corresponding MAX values. Mode settings (CTRLA.MODE) determine the maximum range of the Counter register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 987 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) In 8-bit mode, a Period Value (PER) register and its Period Buffer Value (PERBUF) register are also available. The counter range and the operating frequency determine the maximum time resolution achievable with the TC peripheral. The TC can be set to count up or down. Under normal operation, the counter value is continuously compared to the TOP or ZERO value to determine whether the counter has reached that value. On a comparison match, the TC can request DMA transactions, or generate interrupts or events for the Event System. In a compare operation, the counter value is continuously compared to the values in the CCx registers. In the case of a match, the TC can request DMA transactions, or generate interrupts or events for the Event System. In waveform generator mode, these comparisons are used to set the waveform period or pulse width. Capture operation can be enabled to perform input signal period and pulse width measurements, or to capture selectable edges from an IO pin or internal event from Event System. Related Links 40.6.2.6.1. Waveform Output Operations 40.6.2 Basic Operation 40.6.2.1 Initialization The following registers are enable-protected, meaning that they can only be written when the TC is disabled
(CTRLA.ENABLE=0):
Control A register (CTRLA), except the Enable (ENABLE) and Software Reset (SWRST) bits Drive Control register (DRVCTRL) Wave register (WAVE) Event Control register (EVCTRL) Writing to enable-protected bits and setting the CTRLA.ENABLE bit can be performed in a single 32-bit access of the CTRLA register. Writing to enable-protected bits and clearing the CTRLA.ENABLE bit cannot be performed in a single 32-bit access. Before enabling the TC, the peripheral must be configured by the following steps:
1. 2. 3. 4. 5. 6. 7. 8. Enable the TC bus clock if not already enabled by default (PB1_CLK). Select 8-, 16- or 32-bit counter mode via the TC Mode bit group in the Control A register (CTRLA.MODE). The default mode is 16-bit. Select one wave generation operation in the Waveform Generation Operation bit group in the WAVE register
(WAVE.WAVEGEN). If desired, the GCLK_TCx clock can be prescaled via the Prescaler bit group in the Control A register
(CTRLA.PRESCALER). If the prescaler is used, select a prescaler synchronization operation via the Prescaler and Counter Synchronization bit group in the Control A register (CTRLA.PRESYNC). If desired, select one-shot operation by writing a 1 to the One-Shot bit in the Control B Set register
(CTRLBSET.ONESHOT). If desired, configure the counting direction down (starting from the TOP value) by writing a 1 to the Counter Direction bit in the Control B register (CTRLBSET.DIR). For capture operation, enable the individual channels to capture in the Capture Channel x Enable bit group in the Control A register (CTRLA.CAPTEN). If desired, enable inversion of the waveform output or IO pin input signal for individual channels via the Invert Enable bit group in the Drive Control register (DRVCTRL.INVEN). 40.6.2.2 Enabling, Disabling, and Resetting The TC is enabled by writing a 1 to the Enable bit in the Control A register (CTRLA.ENABLE). The TC is disabled by writing a zero to CTRLA.ENABLE. The TC is reset by writing a 1 to the Software Reset bit in the Control A register (CTRLA.SWRST). All registers in the TC, except DBGCTRL, will be reset to their initial state. See CTRLA from Related Links. The TC must be disabled before the TC is reset in order to avoid undefined behavior. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 988 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Related Links 40.7.2.1. CTRLA 40.6.2.3 Prescaler Selection The GCLK_TCx is fed into the internal prescaler. The prescaler consists of a counter that counts up to the selected prescaler value, whereupon the output of the prescaler toggles. If the prescaler value is higher than one, the Counter Update condition can be optionally executed on the next GCLK_TCx clock pulse or the next prescaled clock pulse. For further details, refer to Prescaler
(CTRLA.PRESCALER) and Counter Synchronization (CTRLA.PRESYNC) description. Prescaler outputs from 1 to 1/1024 are available. For a complete list of available prescaler outputs, see the register description for the Prescaler bit group in the Control A register (CTRLA.PRESCALER). Note:When counting events, the prescaler is bypassed. The joint stream of prescaler ticks and event action ticks is called CLK_TCx_CNT. Figure 40-2. Prescaler PRESCALER EVACT GCLK_TCx Prescaler GCLK_TCx /
{1,2,4,8,64,256,1024}
EVENT CLK_TCx_CNT COUNT 40.6.2.4 Counter Mode The counter mode is selected by the Mode bit group in the Control A register (CTRLA.MODE). By default, the counter is enabled in the 16-bit counter resolution. Three counter resolutions are available:
COUNT8: The 8-bit TC has its own Period Value and Period Buffer Value registers (PER and PERBUF). COUNT16: 16-bit is the default counter mode. There is no dedicated period register in this mode. COUNT32: 32-bit mode is achieved by pairing two 16-bit TC peripherals. TC(2n) is paired with TC(n+1). When paired, the TC peripherals are configured using the registers of the even-numbered TC (TC0 or TC2, respectively). The TC bus clocks (PB1_CLK) for both host and client TCs need to be enabled. The odd-numbered partner (TC1 or TC3, respectively) will act as a client, and the Client bit in the Status register
(STATUS.SLAVE) will be set. The register values of a client will not reflect the registers of the 32-bit counter. Writing to any of the client registers will not affect the 32-bit counter. Normal access to the client COUNT and CCx registers is not allowed. 40.6.2.5 Counter Operations Depending on the mode of operation, the counter is cleared, reloaded, incremented, or decremented at each TC clock input (CLK_TCx_CNT). A counter clear or reload marks the end of the current counter cycle and the start of a new one. The counting direction is set by the Direction bit in the Control B register (CTRLB.DIR). If this bit is zero the counter is counting up, and counting down if CTRLB.DIR=1. The counter will count up or down for each tick (clock or event) until it reaches TOP or ZERO. When it is counting up and TOP is reached, the counter will be set to zero at the next tick (overflow) and the Overflow Interrupt Flag in the Interrupt Flag Status and Clear register (INTFLAG.OVF) will be set. When it is counting down, the counter is reloaded with the TOP value when ZERO is reached (underflow), and INTFLAG.OVF is set. INTFLAG.OVF can be used to trigger an interrupt, a DMA request, or an event. An overflow/underflow occurrence
(i.e., a compare match with TOP/ZERO) will stop counting if the One-Shot bit in the Control B register is set
(CTRLBSET.ONESHOT). It is possible to change the counter value (by writing directly in the COUNT register) even when the counter is running. When starting the TC, the COUNT value will be either ZERO or TOP (depending on the counting direction set by CTRLBSET.DIR or CTRLBCLR.DIR), unless a different value has been written to it, or the TC has been 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 989 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) stopped at a value other than ZERO. The write access has higher priority than count, clear, or reload. The direction of the counter can also be changed when the counter is running. See also the following figure. Figure 40-3. Counter Operation Period (T) Direction Change COUNT written COUNT MAX TOP ZERO DIR
"reload" update
"clear" update Due to asynchronous clock domains, the internal counter settings are written when the synchronization is complete. Normal operation must be used when using the counter as timer base for the capture channels. 40.6.2.5.1 Stop Command and Event Action A Stop command can be issued from software by using Command bits in the Control B Set register
(CTRLBSET.CMD = 0x2, STOP). When a Stop is detected while the counter is running, the counter will not retain its current value. All waveforms are cleared and the Stop bit in the Status register is set (STATUS.STOP). 40.6.2.5.2 Re-Trigger Command and Event Action A re-trigger command can be issued from software by writing the Command bits in the Control B Set register
(CTRLBSET.CMD = 0x1, RETRIGGER), or from event when a re-trigger event action is configured in the Event Control register (EVCTRL.EVACT = 0x1, RETRIGGER). When the command is detected during counting operation, the counter will be reloaded or cleared, depending on the counting direction (CTRLBSET.DIR or CTRLBCLR.DIR). When the re-trigger command is detected while the counter is stopped, the counter will resume counting from the current value in the COUNT register. Note:When a re-trigger event action is configured in the Event Action bits in the Event Control register
(EVCTRL.EVACT=0x1, RETRIGGER), enabling the counter will not start the counter. The counter will start on the next incoming event and restart on corresponding following event. 40.6.2.5.3 Count Event Action The TC can count events. When an event is received, the counter increases or decreases the value, depending on direction settings (CTRLBSET.DIR or CTRLBCLR.DIR). The count event action can be selected by the Event Action bit group in the Event Control register (EVCTRL.EVACT=0x2, COUNT). Note:If this operation mode is selected, PWM generation is not supported. 40.6.2.5.4 Start Event Action The TC can start counting operation on an event when previously stopped. In this configuration, the event has no effect if the counter is already counting. When the peripheral is enabled, the counter operation starts when the event is received or when a re-trigger software command is applied. The Start TC on Event action can be selected by the Event Action bit group in the Event Control register
(EVCTRL.EVACT=0x3, START). 40.6.2.6 Compare Operations By default, the Compare/Capture channel is configured for compare operations. When using the TC and the Compare/Capture Value registers (CCx) for compare operations, the counter value is continuously compared to the values in the CCx registers. This can be used for timer or for waveform operation. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 990 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) The Channel x Compare Buffer (CCBUFx) registers provide double buffer capability. The double buffering synchronizes the update of the CCx register with the buffer value at the UPDATE condition or a forced update command (CTRLBSET.CMD=UPDATE). See Double Buffering from Related Links. The synchronization prevents the occurrence of odd-length, non-symmetrical pulses and ensures glitch-free output. Related Links 40.6.2.7. Double Buffering 40.6.2.6.1 Waveform Output Operations The compare channels can be used for waveform generation on output port pins. To make the waveform available on the connected pin, the following requirements must be fulfilled:
1. Choose a Waveform Generation mode in the Waveform Generation Operation bit in Waveform register
(WAVE.WAVEGEN). 2. Optionally invert the waveform output WO[x] by writing the corresponding Output Waveform x Invert Enable bit in the Driver Control register (DRVCTRL.INVENx). 3. Configure the pins with the I/O Peripheral Pin Select (PPS). See I/O Ports and Peripheral Pin Select (PPS) from Related Links. Note:Event must not be used when the compare channel is set in waveform output operating mode. The counter value is continuously compared with each CCx value. On a comparison match, the Match or Capture Channel x bit in the Interrupt Flag Status and Clear register (INTFLAG.MCx) will be set on the next zero-to-one transition of CLK_TC_CNT (see Normal Frequency Operation). An interrupt/and or event can be generated on comparison match if enabled. The same condition generates a DMA request. There are four waveform configurations for the Waveform Generation Operation bit group in the Waveform register
(WAVE.WAVEGEN). This will influence how the waveform is generated and impose restrictions on the top value. The configurations are:
Normal frequency (NFRQ) Match frequency (MFRQ) Normal pulse-width modulation (NPWM) Match pulse-width modulation (MPWM) When using NPWM or NFRQ configuration, the TOP will be determined by the counter resolution. In 8-bit Counter mode, the Period register (PER) is used as TOP, and the TOP can be changed by writing to the PER register. In 16-
and 32-bit Counter mode, TOP is fixed to the maximum (MAX) value of the counter. Normal Frequency Generation (NFRQ) For Normal Frequency Generation, the period time (T) is controlled by the period register (PER) for 8-bit Counter mode and MAX for 16- and 32-bit mode. The waveform generation output (WO[x]) is toggled on each compare match between COUNT and CCx, and the corresponding Match or Capture Channel x Interrupt Flag (INTFLAG.MCx) will be set. Figure 40-4. Normal Frequency Operation Period (T) Direction Change COUNT Written COUNT MAX TOP CCx ZERO WO[x]
"reload" update
"clear" update
"match"
Match Frequency Generation (MFRQ) For Match Frequency Generation, the period time (T) is controlled by the CC0 register instead of PER or MAX. WO[0]
toggles on each Update condition. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 991 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Figure 40-5. Match Frequency Operation Period (T) Direction Change COUNT Written COUNT MAX CC0 ZERO WO[0]
"reload" update
"clear" update Normal Pulse-Width Modulation Operation (NPWM) NPWM uses single-slope PWM generation. For single-slope PWM generation, the period time (T) is controlled by the TOP value, and CCx controls the duty cycle of the generated waveform output. When up-counting, the WO[x] is set at start or compare match between the COUNT and TOP values, and cleared on compare match between COUNT and CCx register values. When down-counting, the WO[x] is cleared at start or compare match between the COUNT and ZERO values, and set on compare match between COUNT and CCx register values. The following equation calculates the exact resolution for a single-slope PWM (RPWM_SS) waveform:
log(TOP+1) RPWM_SS =
The PWM frequency (fPWM_SS) depends on TOP value and the peripheral clock frequency (fGCLK_TC), and can be log(2) calculated by the following equation:
fPWM_SS =
Where N represents the prescaler divider used (1, 2, 4, 8, 16, 64, 256, 1024). fGCLK_TC N(TOP+1) Match Pulse-Width Modulation Operation (MPWM) In MPWM, the output of WO[1] is depending on CC1 as shown in the figure below. On every overflow/underflow, a one-TC-clock-cycle negative pulse is put out on WO[0] (not shown in the figure). Figure 40-6. Match PWM Operation Period (T) CCx= Zero CCx= TOP MAX CC0 COUNT CC1 ZERO WO[1]
" clear" update
" match"
The following table shows the Update Counter and Overflow Event/Interrupt Generation conditions in different operation modes. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 992 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Table 40-3. Counter Update and Overflow Event/interrupt Conditions in TC Name Operation TOP Update Output Waveform OVFIF/Event On Match On Update Up Down NFRQ Normal Frequency PER TOP/ ZERO Toggle MFRQ Match Frequency CC0 TOP/ ZERO Toggle Stable Stable TOP ZERO TOP ZERO NPWM Single-slope PWM PER TOP/ ZERO See description above. TOP ZERO MPWM Single-slope PWM CC0 TOP/ ZERO Toggle Toggle TOP ZERO Related Links 6. I/O Ports and Peripheral Pin Select (PPS) 40.6.2.7 Double Buffering The Compare Channels (CCx) registers, and the Period (PER) register in 8-bit mode are double buffered. Each buffer register has a buffer valid bit (CCBUFVx or PERBUFV) in the STATUS register, which indicates that the buffer register contains a new valid value that can be copied into the corresponding register. As long as the respective buffer valid status flag (PERBUFV or CCBUFVx) are set to 1, related syncbusy bits are set (SYNCBUSY.PER or SYNCBUSY.CCx), a write to the respective PER/PERBUF or CCx/CCBUFx registers will generate a PAC error, and access to the respective PER or CCx register is invalid. When the buffer valid flag bit in the STATUS register is 1 and the Lock Update bit in the CTRLB register is set to 0, (writing CTRLBCLR.LUPD to 1), double buffering is enabled: the data from buffer registers will be copied into the corresponding register under hardware UPDATE conditions, then the buffer valid flags bit in the STATUS register are automatically cleared by hardware. Note:The software update command (CTRLBSET.CMD=0x3) is acting independently of the LUPD value. A compare register is double buffered as in the following figure. Figure 40-7. Compare Channel Double Buffering
"write enable"
"data write"
CCBUFVx EN CCBUFx UPDATE EN CCx COUNT
"match"
Both the registers (PER/CCx) and corresponding buffer registers (PERBUF/CCBUFx) are available in the I/O register map, and the double buffering feature is not mandatory. The double buffering is disabled by writing a 1 to CTRLBSET.LUPD. Note:In NFRQ, MFRQ or PWM, down-counting counter mode (CTRLBSET.DIR=1), when double buffering is enabled (CTRLBCLR.LUPD=1), PERBUF register is continuously copied into the PER independently of update conditions. Changing the Period 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 993 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) The counter period can be changed by writing a new TOP value to the Period register (PER or CC0, depending on the waveform generation mode), which is available in 8-bit mode. Any period update on registers (PER or CCx) is effective after the synchronization delay. A counter wraparound can occur in any operation mode when up-counting without buffering (see the following figure). Figure 40-8. Unbuffered Single-Slope Up-Counting Operation Counter Wraparound
"clear" update
"write"
COUNT MAX ZERO New TOP written to PER that is higher than current COUNT New TOP written to PER that is lower than current COUNT COUNT and TOP are continuously compared, so when a new TOP value that is lower than current COUNT is written to TOP, COUNT will wrap before a compare match. Figure 40-9. Unbuffered Single-Slope Down-Counting Operation COUNT MAX ZERO
"reload" update
"write"
New TOP written to PER that is higher than current COUNT New TOP written to PER that is lower than current COUNT When double buffering is used, the buffer can be written at any time and the counter will still maintain correct operation. The period register is always updated on the update condition, as shown in the following figure. This prevents wraparound and the generation of odd waveforms. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 994 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Figure 40-10. Changing the Period Using Buffering COUNT MAX ZERO 40.6.2.8 Capture Operations
" clear" update
" write"
New TOP written to PER that is higher than current COUNT New TOP written to PER that is lower than current COUNT To enable and use capture operations, the corresponding Capture Channel x Enable bit in the Control A register
(CTRLA.CAPTENx) must be written to '1'. A capture trigger can be provided by input event line TC_EV or by asynchronous I/O pin WO[x] for each capture channel or by a TC event. To enable the capture from input event line, Event Input Enable bit in the Event Control register (EVCTRL.TCEI) must be written to '1'. To enable the capture from the I/O pin, the Capture On Pin x Enable bit in the CTRLA register (CTRLA.COPENx) must be written to '1'. Notes:
1. Capture on I/Os is only possible in 'Event' and 'Time-Stamp' capture action modes. Other modes can only use internal events. (If I/Os toggling is needed in other modes, then the I/Os edge must be configured for generating internal events). 2. Capture on an event from the Event System is possible in 'Event', 'PPW/PWP/PW', and 'Time-Stamp' capture action modes. In this case, the event system channels must be configured to operate in asynchronous mode of operation. 3. Depending on CTRLA.COPENx, channel x can be configured for I/Os or internal event capture (both are mutually exclusive). One channel can be configured for I/Os capture while the other uses internal event capture. By default, a capture operation is done when a rising edge is detected on the input signal. Capture on falling edge is available, its activation is depending on the input source:
When the channel is used with a I/O pin, write a '1' to the corresponding Invert Enable bit in the Drive Control register (DRVCTRL.INVENx). When the channel is counting events from the Event System, write a '1' to the TC Event Input Invert Enable bit in Event Control register (EVCTRL.TCINV). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 995 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Figure 40-11. Capture Double Buffering
"capture"
COUNT BV EN CCBx IF EN CCx
"INT/DMA request"
data read For input capture, the buffer register and the corresponding CCx act like a FIFO. When CCx is empty or read, any content in CCBUFx is transferred to CCx. The buffer valid flag is passed to set the CCx interrupt flag (IF) and generate the optional interrupt, event or DMA request. The CCBUFx register value can't be read, all captured data must be read from CCx register. 40.6.2.8.1 Event Capture Action on Events or I/Os The compare and capture channels can be used as input capture channels to capture events from the Event System or I/O pins and give them a timestamp. This mode is selected when EVTCTRL.EVACT is configured either as OFF, RETRIGGER, COUNT or START. The following figure shows four capture events for one capture channel. Figure 40-12. Input Capture Timing Events COUNT TOP ZERO Capture 0 Capture 1 Capture 2 Capture 3 The TC can detect capture overflow of the input capture channels: When a new capture event is detected while the Capture Interrupt flag (INTFLAG.MCx) is still set, the new timestamp will not be stored and INTFLAG.ERR will be set. 40.6.2.8.2 Period and Pulse-Width (PPW) Capture Action The TC can perform two input captures and restart the counter on one of the edges. This enables the TC to measure the pulse width and period and to characterize the frequency f and duty cycle of an input signal:
f =
1 T dutyCycle =
tp T 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 996 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Figure 40-13. PWP Capture Input signal Pulsewitdh (tp) Period (T) Events COUNT MAX ZERO
"capture"
CC0 CC1 CC0 CC1 Selecting PWP in the Event Action bit group in the Event Control register (EVCTRL.EVACT) enables the TC to perform one capture action on the rising edge and the other one on the falling edge. The period T will be captured into CC1 and the pulse width tp in CC0. EVCTRL.EVACT=PPW (period and pulse-width) offers identical functionality, but will capture T into CC0 and tp into CC1. The TC Event Input Invert Enable bit in the Event Control register (EVCTRL.TCINV) is used to select whether the wraparound must occur on the rising edge or the falling edge. If EVCTRL.TCINV=1, the wraparound will happen on the falling edge. In case pin capture is enabled, this can also be achieved by modifying the value of the DRVCTRL.INVENx bit. The TC can detect capture overflow of the input capture channels: When a new capture event is detected while the Capture Interrupt flag (INTFLAG.MCx) is still set, the new timestamp will not be stored and INTFLAG.ERR will be set. Note:The corresponding capture is working only if the channel is enabled in capture mode (CTRLA.CAPTENx=1). If not, the capture action is ignored and the channel is enabled in compare mode of operation. Consequently, both channels must be enabled in order to fully characterize the input. 40.6.2.8.3 Pulse-Width (PW) Capture Action on Events The TC performs the input capture on the falling edge of the input signal. When the edge is detected, the counter value is cleared and the TC stops counting. When a rising edge is detected on the input signal, the counter restarts the counting operation. To enable the operation on opposite edges, the input signal to capture must be inverted (refer to EVCTRL.TCEINV). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 997 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Figure 40-14. Pulse-Width Capture on Channel 0 Input signal Pulsewidth (tp) Events COUNT MAX ZERO
"capture"
"restart"
The TC can detect capture overflow of the input capture channels: When a new capture event is detected while the Capture Interrupt flag (INTFLAG.MCx) is still set, the new timestamp will not be stored and INTFLAG.ERR will be set. CC0 CC0 40.6.3 Additional Features 40.6.3.1 One-Shot Operation When one-shot is enabled, the counter automatically stops on the next Counter Overflow or Underflow condition. When the counter is stopped, the Stop bit in the Status register (STATUS.STOP) is automatically set and the waveform outputs are set to zero. One-shot operation is enabled by writing a '1' to the One-Shot bit in the Control B Set register
(CTRLBSET.ONESHOT), and disabled by writing a '1' to CTRLBCLR.ONESHOT. When enabled, the TC will count until an overflow or underflow occurs and stops counting operation. The one-shot operation can be restarted by a re-trigger software command, a re-trigger event, or a start event. When the counter restarts its operation, STATUS.STOP is automatically cleared. 40.6.3.2 Time-Stamp Capture on Events or I/Os This feature is enabled when the Capture Time Stamp (STAMP) Event Action in Event Control register
(EVCTRL.EVACT) is selected. The counter TOP value must be smaller than MAX. When a capture event from the Event System or the I/O pin is detected, the COUNT value is copied into the corresponding Channel x Compare/Capture Value (CCx) register. In case of an overflow, the MAX value is copied into the corresponding CCx register. When a valid captured value is present in the capture channel register, the corresponding Capture Channel x Interrupt Flag (INTFLAG.MCx) is set. The timer/counter can detect capture overflow of the input capture channels: When a new capture event is detected while the Capture Channel interrupt flag (INTFLAG.MCx) is still set, the new time-stamp will not be stored and INTFLAG.ERR will be set. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 998 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Figure 40-15. Time Stamp 40.6.3.3 Minimum Capture The minimum capture is enabled by writing the CAPTMIN mode in the Channel n Capture Mode bits in the Control A register (CTRLA.CAPTMODEn = CAPTMIN). CCx Content:
In CAPTMIN operations, CCx keeps the Minimum captured values. Before enabling this mode of capture, the user must initialize the corresponding CCx register value to a value different from zero. If the CCx register initial value is zero, no captures will be performed using the corresponding channel. MCx Behaviour:
In CAPTMIN operation, capture is performed only when on capture event time. The counter value is lower than the last captured value. The MCx interrupt flag is set only when on capture event time. The counter value is higher or equal to the value captured on the previous event. Therefore, the interrupt flag is set when a new absolute local Minimum value is detected. 40.6.3.4 Maximum Capture The maximum capture is enabled by writing the CAPTMAX mode in the Channel n Capture Mode bits in the Control A register (CTRLA.CAPTMODEn = CAPTMAX). CCx Content:
In CAPTMAX operations, CCx keeps the Maximum captured values. Before enabling this mode of capture, the user must initialize the corresponding CCx register value to a value different from TOP. If the CCx register initial value is TOP, no captures will be performed using the corresponding channel. MCx Behaviour:
In CAPTMAX operation, capture is performed only when on capture event time. The counter value is higher than the last captured value. The MCx interrupt flag is set only when on capture event time. The counter value is lower or equal to the value captured on the previous event. Therefore, the interrupt flag is set when a new absolute local Maximum value is detected. Figure 40-16. Maximum Capture Operation with CC0 Initialized with ZERO Value COUNT TOP CC0 ZERO Input event CC0 Event/
Interrupt 40.6.4 DMA Operation The TC can generate the following DMA requests:
"clear" update
"match"
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 999 MAXZEROCOUNTTOP"capture""overflow"EventsCCx ValueCOUNTCOUNTTOPMAXCOUNT PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Overflow (OVF): the request is set when an update condition (overflow, underflow or re-trigger) is detected, the request is cleared by hardware on DMA acknowledge. Match or Capture Channel x (MCx): for a compare channel, the request is set on each compare match detection, the request is cleared by hardware on DMA acknowledge. For a capture channel, the request is set when valid data is present in the CCx register, and cleared when CCx register is read. 40.6.5 Interrupts The TC has the following interrupt sources:
Overflow/Underflow (OVF) Match or Capture Channel x (MCx) Capture Overflow Error (ERR) Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG) is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a 1 to the corresponding bit in the Interrupt Enable Set register
(INTENSET), and disabled by writing a 1 to the corresponding bit in the Interrupt Enable Clear register (INTENCLR). The status of enabled interrupts can be read from either INTENSET or INTENCLR. An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until either the interrupt flag is cleared, the interrupt is disabled, or the TC is reset. See INTFLAG from Related Links for more details on how to clear the interrupt flags. The TC has one common interrupt request line for all the interrupt sources. The user must read the INTFLAG register to determine which interrupt condition is present. Note that interrupts must be globally enabled for interrupt requests to be generated. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 40.7.4.7. INTFLAG 40.6.6 Events The TC can generate the following output events:
Overflow/Underflow (OVF) Match or Capture Channel x (MCX0-1) Writing a 1 to an Event Output bit in the Event Control register (EVCTRL.MCEOx) enables the corresponding output event. The output event is disabled by writing EVCTRL.MCEOx=0. One of the following event actions can be selected by the Event Action bit group in the Event Control register
(EVCTRL.EVACT):
Disable event action (OFF) Start TC (START) Re-trigger TC (RETRIGGER) Count on event (COUNT) Capture time stamp (STAMP) Capture Period (PPW and PWP) Capture Pulse Width (PW) Writing a 1 to the TC Event Input bit in the Event Control register (EVCTRL.TCEI) enables input events (EVU0-2) to the TC. Writing a 0 to this bit disables input events to the TC. The TC requires only asynchronous event inputs. See Event System (EVSYS) from Related Links for additional information on configuring the asynchronous events. Related Links 28. Event System (EVSYS) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1000 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.6.7 Sleep Mode Operation The TC can be configured to operate in any sleep mode. To be able to run in standby, the RUNSTDBY bit in the Control A register (CTRLA.RUNSTDBY) must be '1'. This peripheral can wake up the device from any sleep mode using interrupts or perform actions through the Event System. If the On Demand bit in the Control A register (CTRLA.ONDEMAND) is written to '1', the module stops requesting its peripheral clock when the STOP bit in STATUS register (STATUS.STOP) is set to '1'. When a re-trigger or start condition is detected, the TC requests the clock before the operation starts. 40.6.8 Synchronization Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be synchronized when written or read. The following bits are synchronized when written:
Software Reset and Enable bits in Control A register (CTRLA.SWRST and CTRLA.ENABLE) Capture Channel Buffer Valid bit in STATUS register (STATUS.CCBUFVx) The following registers are synchronized when written:
Control B Clear and Control B Set registers (CTRLBCLR and CTRLBSET) Count Value register (COUNT) Period Value and Period Buffer Value registers (PER and PERBUF) Channel x Compare/Capture Value and Channel x Compare/Capture Buffer Value registers (CCx and CCBUFx) The following registers are synchronized when read:
Count Value register (COUNT): synchronization is done on demand through READSYNC command
(CTRLBSET.CMD) Control B Clear and Control B Set registers (CTRLBCLR and CTRLBSET) Channel x Compare/Capture Value (CCx) Required write synchronization is denoted by the "Write-Synchronized" property in the register description. Required read synchronization is denoted by the "Read-Synchronized" property in the register description. 40.7 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description. Some registers are synchronized when read and/or written. Synchronization is denoted by the Write-Synchronized or the Read-Synchronized property in each individual register description. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable protection is denoted by the Enable-Protected property in each individual register description. Note:All registers in this table have corresponding CLR, SET and INV registers at its virtual address, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET, and INV Registers from Related Links. Related Links 6.1.9. CLR, SET and INV Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1001 0x00 CTRLA CTRLBCLR CTRLBSET EVCTRL INTENCLR INTENSET INTFLAG STATUS WAVE DRVCTRL Reserved DBGCTRL SYNCBUSY Reserved 0x04 0x05 0x06 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11
... 0x13 0x14 0x15
... 0x1A 0x1B 0x1C 0x1D
... 0x2E 0x2F 0x30 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.1 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 15:8 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 ONDEMAND RUNSTDBY PRESCSYNC[1:0]
MODE[1:0]
ENABLE SWRST ALOCK PRESCALER[2:0]
COPENx CAPTENx CMD[2:0]
CMD[2:0]
TCEI MCEO1 MC1 MC1 MC1 TCINV MCEO0 MC0 MC0 MC0 CCBUFV1 CCBUFV0 PERBUFV ONESHOT ONESHOT LUPD LUPD DIR DIR EVACT[2:0]
ERR ERR ERR OVFEO OVF OVF OVF SLAVE STOP WAVEGEN[1:0]
INVENx DBGRUN CCx PER COUNT STATUS CTRLB ENABLE SWRST COUNT 7:0 COUNT[7:0]
Reserved PER CCx Reserved PERBUF CCBUFx 7:0 7:0 7:0 7:0 PER[7:0]
CC[7:0]
PERBUF[7:0]
CCBUF[7:0]
40.7.2 Register Description - 8-bit Mode 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1002 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized, Enable-Protected CTRLA 0x00 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 Access Reset 20 COPENx R/W 0 Bit 15 14 13 12 Access Reset 19 18 17 16 CAPTENx R/W 0 11 ALOCK R/W 0 10 R/W 0 2 R/W 0 9 PRESCALER[2:0]
R/W 0 8 R/W 0 1 ENABLE R/W 0 0 SWRST W 0 Bit 7 ONDEMAND Access Reset R/W 0 6 RUNSTDBY R/W 0 5 4 PRESCSYNC[1:0]
R/W 0 R/W 0 MODE[1:0]
3 R/W 0 Bit 20 COPENxCapture On Pin x Enable [x=1..0]
Bit x of COPEN[:0] selects the trigger source for capture operation, either events or I/O pin input. This bit is not synchronized. Value 0 1 Description Event from Event System is selected as trigger source for capture operation on channel x. I/O pin is selected as trigger source for capture operation on channel x. Bit 16 CAPTENxCapture Channel x Enable [x=1..0]
Bit x of CAPTEN[:0] selects whether channel x is a capture or a compare channel. These bits are not synchronized. Value 0 1 Description CAPTEN disables capture on channel x. CAPTEN enables capture on channel x. Bit 11 ALOCKAuto Lock When this bit is set, Lock bit update (LUPD) is set to '1' on each overflow/underflow or re-trigger event. This bit is not synchronized. Value 0 1 Description The LUPD bit is not affected on overflow/underflow, and re-trigger event. The LUPD bit is set on each overflow/underflow or re-trigger event. Bits 10:8 PRESCALER[2:0]Prescaler These bits select the counter prescaler factor. These bits are not synchronized. Name Value DIV1 0x0 DIV2 0x1 DIV4 0x2 DIV8 0x3 Description Prescaler: GCLK_TC Prescaler: GCLK_TC/2 Prescaler: GCLK_TC/4 Prescaler: GCLK_TC/8 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1003 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Value 0x4 0x5 0x6 0x7 Name DIV16 DIV64 DIV256 DIV1024 Description Prescaler: GCLK_TC/16 Prescaler: GCLK_TC/64 Prescaler: GCLK_TC/256 Prescaler: GCLK_TC/1024 Bit 7 ONDEMANDClock On Demand This bit selects the clock requirements when the TC is stopped. In standby mode, if the Run in Standby bit (CTRLA.RUNSTDBY) is '0', ONDEMAND is forced to '0'. This bit is not synchronized. Value 0 Description The On Demand is disabled. If On Demand is disabled, the TC will continue to request the clock when its operation is stopped (STATUS.STOP=1). The On Demand is enabled. When On Demand is enabled, the stopped TC will not request the clock. The clock is requested when a software re-trigger command is applied or when an event with start/re-trigger action is detected. 1 Bit 6 RUNSTDBYRun in Standby This bit is used to keep the TC running in standby mode. This bit is not synchronized. Value 0 1 Description The TC is halted in standby. The TC continues to run in standby. Bits 5:4 PRESCSYNC[1:0]Prescaler and Counter Synchronization These bits select whether the counter must wrap around on the next GCLK_TCx clock or the next prescaled GCLK_TCx clock. It also makes it possible to reset the prescaler. These bits are not synchronized. Name Value GCLK 0x0 PRESC 0x1 RESYNC 0x2
0x3 Description Reload or reset the counter on next generic clock Reload or reset the counter on next prescaler clock Reload or reset the counter on next generic clock. Reset the prescaler counter Reserved Bits 3:2 MODE[1:0]Timer Counter Mode These bits select the counter mode. These bits are not synchronized. Name Value COUNT16 0x0 COUNT8 0x1 COUNT32 0x2
0x3 Bit 1 ENABLEEnable Description Counter in 16-bit mode Counter in 8-bit mode Counter in 32-bit mode Reserved Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRLA.ENABLE will read back immediately, and the ENABLE Synchronization Busy bit in the SYNCBUSY register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete. This bit is not enable-protected. Value 0 1 Description The peripheral is disabled. The peripheral is enabled. Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets all registers in the TC, except DBGCTRL, to their initial state, and the TC will be disabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1004 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Writing a '1' to CTRLA.SWRST will always take precedence; all other writes in the same write-operation will be discarded. This bit is not enable-protected. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1005 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.2 Control B Clear Name:
Offset:
Reset:
Property: PAC Write-Protection, Read-Synchronized, Write-Synchronized CTRLBCLR 0x04 0x00 This register allows the user to clear bits in the CTRLB register without doing a read-modify-write operation. Changes in this register will also be reflected in the Control B Set register (CTRLBSET). Bit 7 Access Reset R/W 0 6 CMD[2:0]
R/W 0 5 R/W 0 4 3 2 ONESHOT R/W 0 1 LUPD R/W 0 0 DIR R/W 0 Bits 7:5 CMD[2:0]Command These bits are used for software control of the TC. The commands are executed on the next prescaled GCLK_TC clock cycle. When a command has been executed, the CMD bit group will be read back as zero. Writing 0x0 to these bits has no effect. Writing a '1' to any of these bits will clear the pending command. Bit 2 ONESHOTOne-Shot on Counter This bit controls one-shot operation of the TC. Writing a '0' to this bit has no effect Writing a '1' to this bit will disable one-shot operation. Value 0 1 Description The TC will wrap around and continue counting on an overflow/underflow condition. The TC will wrap around and stop on the next underflow/overflow condition. Bit 1 LUPDLock Update This bit controls the update operation of the TC buffered registers. When CTRLB.LUPD is set, no update of the registers with value of its buffered register is performed on hardware UPDATE condition. Locking the update ensures that all buffer registers are valid before an hardware update is performed. After all the buffer registers are loaded correctly, the buffered registers can be unlocked. This bit has no effect when input capture operation is enabled. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the LUPD bit. Value 0 Description The CCBUFx and PERBUF buffer registers value are copied into CCx and PER registers on hardware update condition. The CCBUFx and PERBUF buffer registers value are not copied into CCx and PER registers on hardware update condition. 1 Bit 0 DIRCounter Direction This bit is used to change the direction of the counter. Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the bit and make the counter count down. Value 0 1 Description The timer/counter is counting up (incrementing). The timer/counter is counting down (decrementing). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1006 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.3 Control B Set Name:
Offset:
Reset:
Property: PAC Write-Protection, Read-synchronized, Write-Synchronized CTRLBSET 0x05 0x00 This register allows the user to set bits in the CTRLB register without doing a read-modify-write operation. Changes in this register will also be reflected in the Control B Clear register (CTRLBCLR). Bit 7 Access Reset R/W 0 6 CMD[2:0]
R/W 0 5 R/W 0 4 3 2 ONESHOT R/W 0 1 LUPD R/W 0 0 DIR R/W 0 Bits 7:5 CMD[2:0]Command These bits are used for software control of the TC. The commands are executed on the next prescaled GCLK_TC clock cycle. When a command has been executed, the CMD bit group will be read back as zero. Writing 0x0 to these bits has no effect. Writing a value different from 0x0 to these bits will issue a command for execution. Value 0x0 0x1 0x2 0x3 0x4 Description No action Force a start, restart or retrigger Force a stop Force update of double buffered registers Force a read synchronization of COUNT Name NONE RETRIGGER STOP UPDATE READSYNC Bit 2 ONESHOTOne-Shot on Counter This bit controls one-shot operation of the TC. Writing a '0' to this bit has no effect. Writing a '1' to this bit will enable one-shot operation. Value 0 1 Description The TC will wrap around and continue counting on an overflow/underflow condition. The TC will wrap around and stop on the next underflow/overflow condition. Bit 1 LUPDLock Update This bit controls the update operation of the TC buffered registers. When CTRLB.LUPD is set, no update of the registers with value of its buffered register is performed on hardware UPDATE condition. Locking the update ensures that all buffer registers are valid before an hardware update is performed. After all the buffer registers are loaded correctly, the buffered registers can be unlocked. Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the LUPD bit. This bit has no effect when input capture operation is enabled. Value 0 Description The CCBUFx and PERBUF buffer registers value are copied into CCx and PER registers on hardware update condition. The CCBUFx and PERBUF buffer registers value are not copied into CCx and PER registers on hardware update condition. 1 Bit 0 DIRCounter Direction This bit is used to change the direction of the counter. Writing a '0' to this bit has no effect Writing a '1' to this bit will set the bit and make the counter count down. Value 0 1 Description The timer/counter is counting up (incrementing). The timer/counter is counting down (decrementing). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1007 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.4 Event Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected EVCTRL 0x06 0x0000 Bit 15 14 Access Reset Bit 7 6 Access Reset 13 MCEO1 R/W 0 5 TCEI R/W 0 12 MCEO0 R/W 0 4 TCINV R/W 0 11 10 9 3 2 R/W 0 1 EVACT[2:0]
R/W 0 8 OVFEO R/W 0 0 R/W 0 Bits 12, 13 MCEOxMatch or Capture Channel x Event Output Enable [x = 1..0]
These bits enable the generation of an event for every match or capture on channel x. Value 0 1 Description Match/Capture event on channel x is disabled and will not be generated. Match/Capture event on channel x is enabled and will be generated for every compare/capture. Bit 8 OVFEOOverflow/Underflow Event Output Enable This bit enables the Overflow/Underflow event. When enabled, an event will be generated when the counter overflows/underflows. Value 0 1 Description Overflow/Underflow event is disabled and will not be generated. Overflow/Underflow event is enabled and will be generated for every counter overflow/underflow. Bit 5 TCEITC Event Enable This bit is used to enable asynchronous input events to the TC. Value 0 1 Description Incoming events are disabled. Incoming events are enabled. Bit 4 TCINVTC Inverted Event Input Polarity This bit inverts the asynchronous input event source. Value 0 1 Description Input event source is not inverted. Input event source is inverted. Bits 2:0 EVACT[2:0]Event Action These bits define the event action the TC will perform on an event. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description Event action disabled Start, restart or retrigger TC on event Count on event Start TC on event Time stamp capture Period captured in CC0, pulse width in CC1 Period captured in CC1, pulse width in CC0 Pulse width capture Name OFF RETRIGGER COUNT START STAMP PPW PWP PW 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1008 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.5 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x08 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENSET). Bit 7 6 Access Reset 5 MC1 R/W 0 4 MC0 R/W 0 3 2 1 ERR R/W 0 0 OVF R/W 0 Bits 4, 5 MCxMatch or Capture Channel x Interrupt Enable [x = 1..0]
Writing a 0 to these bits has no effect. Writing a 1 to MCx will clear the corresponding Match or Capture Channel x Interrupt Enable bit, which disables the Match or Capture Channel x interrupt. Description Value The Match or Capture Channel x interrupt is disabled. 0 The Match or Capture Channel x interrupt is enabled. 1 Bit 1 ERRError Interrupt Disable Writing a 0 to these bits has no effect. Writing a 1 to this bit will clear the Error Interrupt Enable bit, which disables the Error interrupt. Value 0 1 Description The Error interrupt is disabled. The Error interrupt is enabled. Bit 0 OVFOverflow Interrupt Disable Writing a 0 to these bits has no effect. Writing a 1 to this bit will clear the Overflow Interrupt Enable bit, which disables the Overflow interrupt request. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1009 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.6 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x09 0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear register (INTENCLR). Bit 7 6 Access Reset 5 MC1 R/W 0 4 MC0 R/W 0 3 2 1 ERR R/W 0 0 OVF R/W 0 Bits 4, 5 MCxMatch or Capture Channel x Interrupt Enable [x = 1..0]
Writing a 0 to these bits has no effect. Writing a 1 to MCx will set the corresponding Match or Capture Channel x Interrupt Enable bit, which enables the Match or Capture Channel x interrupt. Description Value The Match or Capture Channel x interrupt is disabled. 0 The Match or Capture Channel x interrupt is enabled. 1 Bit 1 ERRError Interrupt Enable Writing a 0 to these bits has no effect. Writing a 1 to this bit will set the Error Interrupt Enable bit, which enables the Error interrupt. Value 0 1 Description The Error interrupt is disabled. The Error interrupt is enabled. Bit 0 OVFOverflow Interrupt Enable Writing a 0 to these bits has no effect. Writing a 1 to this bit will set the Overflow Interrupt Enable bit, which enables the Overflow interrupt request. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1010 40.7.2.7 Interrupt Flag Status and Clear PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Name:
Offset:
Reset:
Property:
INTFLAG 0x0A 0x00
Bit 7 6 Access Reset 5 MC1 R/W 0 4 MC0 R/W 0 3 2 1 ERR R/W 0 0 OVF R/W 0 Bits 4, 5 MCxMatch or Capture Channel x [x = 1..0]
This flag is set on a comparison match, or when the corresponding CCx register contains a valid capture value. This flag is set on the next CLK_TC_CNT cycle, and will generate an interrupt request if the corresponding Match or Capture Channel x Interrupt Enable bit in the Interrupt Enable Set register (INTENSET.MCx) is 1. Writing a 0 to these bits has no effect. Writing a 1 to one of these bits will clear the corresponding Match or Capture Channel x interrupt flag In capture operation, this flag is automatically cleared when CCx register is read. Bit 1 ERRError Interrupt Flag This flag is set when a new capture occurs on a channel while the corresponding Match or Capture Channel x interrupt flag is set, in which case there is no place to store the new capture. Writing a 0 to these bits has no effect. Writing a 1 to this bit clears the Error interrupt flag. Bit 0 OVFOverflow Interrupt Flag This flag is set on the next CLK_TC_CNT cycle after an overflow condition occurs, and will generate an interrupt request if INTENCLR.OVF or INTENSET.OVF is 1. Writing a 0 to these bits has no effect. Writing a 1 to this bit clears the Overflow interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1011 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.8 Status STATUS Name:
0x0B Offset:
Reset:
0x01 Property: Read-Synchronized Bit 7 6 Access Reset 5 CCBUFV1 R/W 0 4 CCBUFV0 R/W 0 3 PERBUFV R/W 0 2 1 SLAVE R 0 0 STOP R 1 Bits 4, 5 CCBUFVxChannel x Compare or Capture Buffer Valid [x = 1..0]
For a compare channel x, the bit x is set when a new value is written to the corresponding CCBUFx register. The bit x is cleared by writing a 1 to it when CTRLB.LUPD is set, or it is cleared automatically by hardware on UPDATE condition. For a capture channel x, the bit x is set when a valid capture value is stored in the CCBUFx register. The bit x is cleared automatically when the CCx register is read. Bit 3 PERBUFVPeriod Buffer Valid This bit is set when a new value is written to the PERBUF register. The bit is cleared by writing 1 to the corresponding location when CTRLB.LUPD is set, or automatically cleared by hardware on UPDATE condition. This bit is available only in 8-bit mode and will always read zero in 16- and 32-bit modes. Bit 1 SLAVEClient Status Flag This bit is only available in 32-bit mode on the Client TC (i.e., TC1, TC3, TC5 and/or TC7). The bit is set when the associated Host TC (TC0, TC2, TC4 and/or TC6, respectively) is set to run in 32-bit mode. Bit 0 STOPStop Status Flag This bit is set when the TC is disabled, on a Stop command, or on an overflow/underflow condition when the One-Shot bit in the Control B Set register (CTRLBSET.ONESHOT) is 1. Value 0 1 Description Counter is running. Counter is stopped. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1012 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.9 Waveform Generation Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected WAVE 0x0C 0x00 Bit 7 6 5 4 3 2 Access Reset Bits 1:0 WAVEGEN[1:0]Waveform Generation Mode 1 0 WAVEGEN[1:0]
R/W 0 R/W 0 These bits select the waveform generation operation. They affect the top value, as shown in Waveform Output Operations. They also control whether frequency or PWM waveform generation must be used. The waveform generation operations are explained in Waveform Output Operations. See Waveform Output Operations from Related Links. These bits are not synchronized. Value Name Operation Top Value Output Waveform on Match Output Waveform on Wraparound 0x0 0x1 0x2 0x3 1. NFRQ MFRQ NPWM MPWM Normal frequency Match frequency Normal PWM Match PWM PER1 / Max CC0 PER1 / Max CC0 Toggle Toggle Set Set No action No action Clear Clear This depends on the TC mode: In 8-bit mode, the top value is the Period Value register (PER). In 16- and 32-bit mode, it is the respective MAX value. Related Links 40.6.2.6.1. Waveform Output Operations 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1013 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.10 Driver Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected DRVCTRL 0x0D 0x00 Bit 7 6 5 4 3 2 1 Access Reset Bit 0 INVENxOutput Waveform x Invert Enable [x=1..0]
Bit x of INVEN[:0] selects inversion of the output or capture trigger input of channel x. Value 0 1 Description Disable inversion of the WO[x] output and IO input pin. Enable inversion of the WO[x] output and IO input pin. 0 INVENx R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1014 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.11 Debug Control Name:
Offset:
Reset:
Property: PAC Write-Protection DBGCTRL 0x0F 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGRUNRun in Debug Mode DBGRUN R/W 0 This bit is not affected by a software Reset, and must not be changed by software while the TC is enabled. Value 0 1 Description The TC is halted when the device is halted in debug mode. The TC continues normal operation when the device is halted in debug mode. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1015 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.12 Synchronization Busy Name:
Offset:
Reset:
Property:
SYNCBUSY 0x10 0x00
Bit 7 Access Reset 6 CCx R 0 5 PER R 0 4 COUNT R 0 3 STATUS R 0 2 CTRLB R 0 1 ENABLE R 0 0 SWRST R 0 Bit 6 CCxCompare/Capture Channel x Synchronization Busy [x=0..1]
For details on CC channels number, refer to each TC feature list. This bit is set when the synchronization of CCx between clock domains is started. This bit is also set when the CCBUFx is written, and cleared on update condition. The bit is automatically cleared when the STATUS.CCBUFx bit is cleared. Bit 5 PERPER Synchronization Busy This bit is cleared when the synchronization of PER between the clock domains is complete. This bit is set when the synchronization of PER between clock domains is started. This bit is also set when the PER is written, and cleared on update condition. The bit is automatically cleared when the STATUS.PERBUF bit is cleared. Bit 4 COUNTCOUNT Synchronization Busy This bit is cleared when the synchronization of COUNT between the clock domains is complete. This bit is set when the synchronization of COUNT between clock domains is started. Bit 3 STATUSSTATUS Synchronization Busy This bit is cleared when the synchronization of STATUS between the clock domains is complete. This bit is set when a '1' is written to the Capture Channel Buffer Valid status flags (STATUS.CCBUFVx) and the synchronization of STATUS between clock domains is started. Bit 2 CTRLBCTRLB Synchronization Busy This bit is cleared when the synchronization of CTRLB between the clock domains is complete. This bit is set when the synchronization of CTRLB between clock domains is started. Bit 1 ENABLEENABLE Synchronization Busy This bit is cleared when the synchronization of ENABLE bit between the clock domains is complete. This bit is set when the synchronization of ENABLE bit between clock domains is started. Bit 0 SWRSTSWRST Synchronization Busy This bit is cleared when the synchronization of SWRST bit between the clock domains is complete. This bit is set when the synchronization of SWRST bit between clock domains is started. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1016 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.13 Counter Value, 8-bit Mode Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized COUNT 0x14 0x00 Note:Prior to any read access, this register must be synchronized by the user by writing the according TC Command value to the Control B Set register (CTRLBSET.CMD = READSYNC). Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 4 3 COUNT[7:0]
R/W 0 R/W 0 2 R/W 0 1 R/W 0 0 R/W 0 Bits 7:0 COUNT[7:0] Counter Value These bits contain the current counter value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1017 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.14 Period Value, 8-bit Mode PER Name:
0x1B Offset:
Reset:
0xFF Property: Write-Synchronized Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 4 R/W 0 PER[7:0]
3 R/W 0 2 R/W 0 1 R/W 0 0 R/W 1 Bits 7:0 PER[7:0]Period Value These bits hold the value of the Period Buffer register PERBUF. The value is copied to PER register on UPDATE condition. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1018 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.15 Channel x Compare/Capture Value, 8-bit Mode CCx Name:
0x1C Offset:
Reset:
0x00 Property: Write-Synchronized Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 CC[7:0]
4 R/W 0 3 R/W 0 2 R/W 0 1 R/W 0 0 R/W 0 Bits 7:0 CC[7:0]Channel x Compare/Capture Value These bits contain the compare/capture value in 8-bit TC mode. In Match frequency (MFRQ) or Match PWM
(MPWM) waveform operation (WAVE.WAVEGEN), the CC0 register is used as a period register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1019 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.16 Period Buffer Value, 8-bit Mode PERBUF Name:
0x2F Offset:
Reset:
0xFF Property: Write-Synchronized Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 4 3 PERBUF[7:0]
R/W 0 R/W 0 2 R/W 0 1 R/W 0 0 R/W 1 Bits 7:0 PERBUF[7:0]Period Buffer Value These bits hold the value of the period buffer register. The value is copied to PER register on UPDATE condition. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1020 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.2.17 Channel x Compare Buffer Value, 8-bit Mode CCBUFx Name:
0x30 Offset:
Reset:
0x00 Property: Write-Synchronized Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 4 3 CCBUF[7:0]
R/W 0 R/W 0 2 R/W 0 1 R/W 0 0 R/W 0 Bits 7:0 CCBUF[7:0]Channel x Compare Buffer Value These bits hold the value of the Channel x Compare Buffer Value. When the buffer valid flag is '1' and double buffering is enabled (CTRLBCLR.LUPD=1), the data from buffer registers will be copied into the corresponding CCx register under UPDATE condition (CTRLBSET.CMD=0x3), including the software update command. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1021 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.3 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CTRLA 0x04 0x05 0x06 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11
... 0x13 0x14 0x16
... 0x1B 0x1C 0x1E 0x20
... 0x2F 0x30 CTRLBCLR CTRLBSET EVCTRL INTENCLR INTENSET INTFLAG STATUS WAVE DRVCTRL Reserved DBGCTRL SYNCBUSY Reserved COUNT Reserved CC0 CC1 Reserved CCBUF0 0x32 CCBUF1 7:0 15:8 23:16 31:24 7:0 7:0 7:0 15:8 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 7:0 15:8 7:0 15:8 7:0 15:8 7:0 15:8 ONDEMAND RUNSTDBY PRESCSYNC[1:0]
MODE[1:0]
ENABLE SWRST ALOCK PRESCALER[2:0]
COPENx CAPTENx CMD[2:0]
CMD[2:0]
TCEI MCEO1 MC1 MC1 MC1 TCINV MCEO0 MC0 MC0 MC0 CCBUFV1 CCBUFV0 PERBUFV ONESHOT ONESHOT LUPD LUPD DIR DIR EVACT[2:0]
ERR ERR ERR OVFEO OVF OVF OVF SLAVE STOP WAVEGEN[1:0]
INVENx DBGRUN CCx PER COUNT STATUS CTRLB ENABLE SWRST COUNT[7:0]
COUNT[15:8]
CC[7:0]
CC[15:8]
CC[7:0]
CC[15:8]
CCBUF[7:0]
CCBUF[15:8]
CCBUF[7:0]
CCBUF[15:8]
40.7.4 Register Description - 16-bit Mode 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1022 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized, Enable-Protected CTRLA 0x00 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 Access Reset 20 COPENx R/W 0 Bit 15 14 13 12 Access Reset 19 18 17 16 CAPTENx R/W 0 11 ALOCK R/W 0 10 R/W 0 2 R/W 0 9 PRESCALER[2:0]
R/W 0 8 R/W 0 1 ENABLE R/W 0 0 SWRST W 0 Bit 7 ONDEMAND Access Reset R/W 0 6 RUNSTDBY R/W 0 5 4 PRESCSYNC[1:0]
R/W 0 R/W 0 MODE[1:0]
3 R/W 0 Bit 20 COPENxCapture On Pin x Enable [x=1..0]
Bit x of COPEN[:0] selects the trigger source for capture operation, either events or I/O pin input. This bit is not synchronized. Value 0 1 Description Event from Event System is selected as trigger source for capture operation on channel x. I/O pin is selected as trigger source for capture operation on channel x. Bit 16 CAPTENxCapture Channel x Enable [x=1..0]
Bit x of CAPTEN[:0] selects whether channel x is a capture or a compare channel. These bits are not synchronized. Value 0 1 Description CAPTEN disables capture on channel x. CAPTEN enables capture on channel x. Bit 11 ALOCKAuto Lock When this bit is set, Lock bit update (LUPD) is set to '1' on each overflow/underflow or re-trigger event. This bit is not synchronized. Value 0 1 Description The LUPD bit is not affected on overflow/underflow, and re-trigger event. The LUPD bit is set on each overflow/underflow or re-trigger event. Bits 10:8 PRESCALER[2:0]Prescaler These bits select the counter prescaler factor. These bits are not synchronized. Name Value DIV1 0x0 DIV2 0x1 DIV4 0x2 DIV8 0x3 Description Prescaler: GCLK_TC Prescaler: GCLK_TC/2 Prescaler: GCLK_TC/4 Prescaler: GCLK_TC/8 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1023 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Value 0x4 0x5 0x6 0x7 Name DIV16 DIV64 DIV256 DIV1024 Description Prescaler: GCLK_TC/16 Prescaler: GCLK_TC/64 Prescaler: GCLK_TC/256 Prescaler: GCLK_TC/1024 Bit 7 ONDEMANDClock On Demand This bit selects the clock requirements when the TC is stopped. In standby mode, if the Run in Standby bit (CTRLA.RUNSTDBY) is '0', ONDEMAND is forced to '0'. This bit is not synchronized. Value 0 Description The On Demand is disabled. If On Demand is disabled, the TC will continue to request the clock when its operation is stopped (STATUS.STOP=1). The On Demand is enabled. When On Demand is enabled, the stopped TC will not request the clock. The clock is requested when a software re-trigger command is applied or when an event with start/re-trigger action is detected. 1 Bit 6 RUNSTDBYRun in Standby This bit is used to keep the TC running in standby mode. This bit is not synchronized. Value 0 1 Description The TC is halted in standby. The TC continues to run in standby. Bits 5:4 PRESCSYNC[1:0]Prescaler and Counter Synchronization These bits select whether the counter must wrap around on the next GCLK_TCx clock or the next prescaled GCLK_TCx clock. It also makes it possible to reset the prescaler. These bits are not synchronized. Name Value GCLK 0x0 PRESC 0x1 RESYNC 0x2
0x3 Description Reload or reset the counter on next generic clock Reload or reset the counter on next prescaler clock Reload or reset the counter on next generic clock. Reset the prescaler counter Reserved Bits 3:2 MODE[1:0]Timer Counter Mode These bits select the counter mode. These bits are not synchronized. Name Value COUNT16 0x0 COUNT8 0x1 COUNT32 0x2
0x3 Bit 1 ENABLEEnable Description Counter in 16-bit mode Counter in 8-bit mode Counter in 32-bit mode Reserved Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRLA.ENABLE will read back immediately, and the ENABLE Synchronization Busy bit in the SYNCBUSY register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete. This bit is not enable-protected. Value 0 1 Description The peripheral is disabled. The peripheral is enabled. Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets all registers in the TC, except DBGCTRL, to their initial state, and the TC will be disabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1024 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Writing a '1' to CTRLA.SWRST will always take precedence; all other writes in the same write-operation will be discarded. This bit is not enable-protected. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1025 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.2 Control B Clear Name:
Offset:
Reset:
Property: PAC Write-Protection, Read-Synchronized, Write-Synchronized CTRLBCLR 0x04 0x00 This register allows the user to clear bits in the CTRLB register without doing a read-modify-write operation. Changes in this register will also be reflected in the Control B Set register (CTRLBSET). Bit 7 Access Reset R/W 0 6 CMD[2:0]
R/W 0 5 R/W 0 4 3 2 ONESHOT R/W 0 1 LUPD R/W 0 0 DIR R/W 0 Bits 7:5 CMD[2:0]Command Writing a `0' to these bits has no effect. Writing a '1' to any of these bits will clear the pending command. Bit 2 ONESHOTOne-Shot on Counter This bit controls one-shot operation of the TC. Writing a '0' to this bit has no effect Writing a '1' to this bit will disable one-shot operation. Value 0 1 Description The TC will wrap around and continue counting on an overflow/underflow condition. The TC will wrap around and stop on the next underflow/overflow condition. Bit 1 LUPDLock Update This bit controls the update operation of the TC buffered registers. When CTRLB.LUPD is set, no any update of the registers with value of its buffered register is performed on hardware UPDATE condition. Locking the update ensures that all buffer registers are valid before an hardware update is performed. After all the buffer registers are loaded correctly, the buffered registers can be unlocked. This bit has no effect when input capture operation is enabled. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the LUPD bit. Value 0 Description The CCBUFx and PERBUF buffer registers value are copied into CCx and PER registers on hardware update condition. The CCBUFx and PERBUF buffer registers value are not copied into CCx and PER registers on hardware update condition. 1 Bit 0 DIRCounter Direction This bit is used to change the direction of the counter. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the bit and make the counter count up. Value 0 1 Description The timer/counter is counting up (incrementing). The timer/counter is counting down (decrementing). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1026 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.3 Control B Set Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized CTRLBSET 0x05 0x00 This register allows the user to set bits in the CTRLB register without doing a read-modify-write operation. Changes in this register will also be reflected in the Control B Clear register (CTRLBCLR). Bit 7 Access Reset R/W 0 6 CMD[2:0]
R/W 0 5 R/W 0 4 3 2 ONESHOT R/W 0 1 LUPD R/W 0 0 DIR R/W 0 Bits 7:5 CMD[2:0]Command These bits are used for software control of the TC. The commands are executed on the next prescaled GCLK_TCx clock cycle. When a command has been executed, the CMD bit group will be read back as zero. Writing 0x0 to these bits has no effect. Writing a value different from 0x0 to this bit field will issue a command for execution. Important:This command requires synchronization before being executed. A valid sequence is:the following:
Issue CMD command (CTRLBSET.CMD = command) Wait for CMD synchronization (SYNCBUSY.CTRLB = 0) Wait for CMD read back as zero (CTRLBSET.CMD = 0) Value 0x0 0x1 0x2 0x3 0x4 Name NONE RETRIGGER STOP UPDATE READSYNC Description No action Force a start, restart or retrigger Force a stop Force update of double buffered registers Force a read synchronization of COUNT Bit 2 ONESHOTOne-Shot on Counter This bit controls one-shot operation of the TC. Writing a '0' to this bit has no effect. Writing a '1' to this bit will enable one-shot operation. Value 0 1 Description The TC will wrap around and continue counting on an overflow/underflow condition. The TC will wrap around and stop on the next underflow/overflow condition. Bit 1 LUPDLock Update This bit controls the update operation of the TC buffered registers. When CTRLB.LUPD is set, no any update of the registers with value of its buffered register is performed on hardware UPDATE condition. Locking the update ensures that all buffer registers are valid before an hardware update is performed. After all the buffer registers are loaded correctly, the buffered registers can be unlocked. Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the LUPD bit. This bit has no effect when input capture operation is enabled. Value 0 Description The CCBUFx and PERBUF buffer registers value are copied into CCx and PER registers on hardware update condition. The CCBUFx and PERBUF buffer registers value are not copied into CCx and PER registers on hardware update condition. 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1027 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Bit 0 DIRCounter Direction This bit is used to change the direction of the counter. Writing a '0' to this bit has no effect Writing a '1' to this bit will clear the bit and make the counter count up. Value 0 1 Description The timer/counter is counting up (incrementing). The timer/counter is counting down (decrementing). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1028 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.4 Event Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected EVCTRL 0x06 0x0000 Bit 15 14 Access Reset Bit 7 6 Access Reset 13 MCEO1 R/W 0 5 TCEI R/W 0 12 MCEO0 R/W 0 4 TCINV R/W 0 11 10 9 3 2 R/W 0 1 EVACT[2:0]
R/W 0 8 OVFEO R/W 0 0 R/W 0 Bits 12, 13 MCEOxMatch or Capture Channel x Event Output Enable [x = 1..0]
These bits enable the generation of an event for every match or capture on channel x. Value 0 1 Description Match/Capture event on channel x is disabled and will not be generated. Match/Capture event on channel x is enabled and will be generated for every compare/capture. Bit 8 OVFEOOverflow/Underflow Event Output Enable This bit enables the Overflow/Underflow event. When enabled, an event will be generated when the counter overflows/underflows. Value 0 1 Description Overflow/Underflow event is disabled and will not be generated. Overflow/Underflow event is enabled and will be generated for every counter overflow/underflow. Bit 5 TCEITC Event Enable This bit is used to enable asynchronous input events to the TC. Value 0 1 Description Incoming events are disabled. Incoming events are enabled. Bit 4 TCINVTC Inverted Event Input Polarity This bit inverts the asynchronous input event source. Value 0 1 Description Input event source is not inverted. Input event source is inverted. Bits 2:0 EVACT[2:0]Event Action These bits define the event action the TC will perform on an event. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description Event action disabled Start, restart or retrigger TC on event Count on event Start TC on event Time stamp capture Period captured in CC0, pulse width in CC1 Period captured in CC1, pulse width in CC0 Pulse width capture Name OFF RETRIGGER COUNT START STAMP PPW PWP PW 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1029 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.5 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x08 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENSET). Bit 7 6 Access Reset 5 MC1 R/W 0 4 MC0 R/W 0 3 2 1 ERR R/W 0 0 OVF R/W 0 Bits 4, 5 MCxMatch or Capture Channel x Interrupt Enable Writing a '0' to these bits has no effect. Writing a '1' to MCx will clear the corresponding Match or Capture Channel x Interrupt Enable bit, which disables the Match or Capture Channel x interrupt. Description Value The Match or Capture Channel x interrupt is disabled. 0 The Match or Capture Channel x interrupt is enabled. 1 Bit 1 ERRError Interrupt Disable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Error Interrupt Enable bit, which disables the Error interrupt. Value 0 1 Description The Error interrupt is disabled. The Error interrupt is enabled. Bit 0 OVFOverflow Interrupt Disable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Overflow Interrupt Enable bit, which disables the Overflow interrupt request. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1030 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.6 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x09 0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear register (INTENCLR). Bit 7 6 Access Reset 5 MC1 R/W 0 4 MC0 R/W 0 3 2 1 ERR R/W 0 0 OVF R/W 0 Bits 4, 5 MCxMatch or Capture Channel x Interrupt Enable Writing a '0' to these bits has no effect. Writing a '1' to MCx will clear the corresponding Match or Capture Channel x Interrupt Enable bit, which disables the Match or Capture Channel x interrupt. Description Value The Match or Capture Channel x interrupt is disabled. 0 The Match or Capture Channel x interrupt is enabled. 1 Bit 1 ERRError Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Error Interrupt Enable bit, which enables the Error interrupt. Value 0 1 Description The Error interrupt is disabled. The Error interrupt is enabled. Bit 0 OVFOverflow Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Overflow Interrupt Enable bit, which enables the Overflow interrupt request. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1031 40.7.4.7 Interrupt Flag Status and Clear PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Name:
Offset:
Reset:
Property:
INTFLAG 0x0A 0x00
Bit 7 6 Access Reset 5 MC1 R/W 0 4 MC0 R/W 0 3 2 1 ERR R/W 0 0 OVF R/W 0 Bits 4, 5 MCxMatch or Capture Channel x This flag is set on a comparison match, or when the corresponding CCx register contains a valid capture value. This flag is set on the next CLK_TC_CNT cycle, and will generate an interrupt request if the corresponding Match or Capture Channel x Interrupt Enable bit in the Interrupt Enable Set register (INTENSET.MCx) is '1'. Writing a '0' to one of these bits has no effect. Writing a '1' to one of these bits will clear the corresponding Match or Capture Channel x interrupt flag In capture operation, this flag is automatically cleared when CCx register is read. Bit 1 ERRError Interrupt Flag This flag is set when a new capture occurs on a channel while the corresponding Match or Capture Channel x interrupt flag is set, in which case there is nowhere to store the new capture. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Error interrupt flag. Bit 0 OVFOverflow Interrupt Flag This flag is set on the next CLK_TC_CNT cycle after an overflow condition occurs, and will generate an interrupt request if INTENCLR.OVF or INTENSET.OVF is '1'. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Overflow interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1032 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.8 Status STATUS Name:
0x0B Offset:
Reset:
0x01 Property: Read-Synchronized Bit 7 6 Access Reset 5 CCBUFV1 R/W 0 4 CCBUFV0 R/W 0 3 PERBUFV R/W 0 2 1 SLAVE R 0 0 STOP R 1 Bits 4, 5 CCBUFVChannel x Compare or Capture Buffer Valid For a compare channel x, the bit x is set when a new value is written to the corresponding CCBUFx register. The bit x is cleared by writing a '1' to it when CTRLB.LUPD is set, or it is cleared automatically by hardware on UPDATE condition. For a capture channel x, the bit x is set when a valid capture value is stored in the CCBUFx register. The bit x is cleared automatically when the CCx register is read. Bit 3 PERBUFVPeriod Buffer Valid This bit is set when a new value is written to the PERBUF register. The bit is cleared by writing '1' to the corresponding location when CTRLB.LUPD is set, or automatically cleared by hardware on UPDATE condition. This bit is available only in 8-bit mode and will always read zero in 16- and 32-bit modes. Bit 1 SLAVEClient Status Flag This bit is only available in 32-bit mode on the Client TC (i.e., TC1 and/or TC3). The bit is set when the associated Host TC (TC0 and TC2, respectively) is set to run in 32-bit mode. Bit 0 STOPStop Status Flag This bit is set when the TC is disabled, on a Stop command, or on an overflow/underflow condition when the One-Shot bit in the Control B Set register (CTRLBSET.ONESHOT) is '1'. Value 0 1 Description Counter is running. Counter is stopped. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1033 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.9 Waveform Generation Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected WAVE 0x0C 0x00 Bit 7 6 5 4 3 2 Access Reset Bits 1:0 WAVEGEN[1:0]Waveform Generation Mode 1 0 WAVEGEN[1:0]
R/W 0 R/W 0 These bits select the waveform generation operation. They affect the top value, as shown in Waveform Output Operations. They also control whether frequency or PWM waveform generation must be used. The waveform generation operations are explained in Waveform Output Operations. See Waveform Output Operations from Related Links. These bits are not synchronized. Value Name Operation Top Value Output Waveform on Match Output Waveform on Wraparound 0x0 0x1 0x2 0x3 1. NFRQ MFRQ NPWM MPWM Normal frequency Match frequency Normal PWM Match PWM PER1 / Max CC0 PER1 / Max CC0 Toggle Toggle Set Set No action No action Clear Clear This depends on the TC mode: In 8-bit mode, the top value is the Period Value register (PER). In 16- and 32-bit mode, it is the respective MAX value. Related Links 40.6.2.6.1. Waveform Output Operations 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1034 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.10 Driver Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected DRVCTRL 0x0D 0x00 Bit 7 6 5 4 3 2 1 Access Reset Bit 0 INVENxOutput Waveform x Invert Enable INVENx bit selects inversion of the output or capture trigger input of channel x. Value 0 1 Description Disable inversion of the WO[x] output and IO input pin. Enable inversion of the WO[x] output and IO input pin. 0 INVENx R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1035 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.11 Debug Control Name:
Offset:
Reset:
Property: PAC Write-Protection DBGCTRL 0x0F 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGRUNRun in Debug Mode DBGRUN R/W 0 This bit is not affected by a software Reset, and must not be changed by software while the TC is enabled. Value 0 1 Description The TC is halted when the device is halted in debug mode. The TC continues normal operation when the device is halted in debug mode. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1036 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.12 Synchronization Busy Name:
Offset:
Reset:
Property:
SYNCBUSY 0x10 0x00
Bit 7 Access Reset 6 CCx R 0 5 PER R 0 4 COUNT R 0 3 STATUS R 0 2 CTRLB R 0 1 ENABLE R 0 0 SWRST R 0 Bit 6 CCxCompare/Capture Channel x Synchronization Busy [x=0..1]
For details on CC channels number, refer to each TC feature list. This bit is set when the synchronization of CCx between clock domains is started. This bit is also set when the CCBUFx is written, and cleared on update condition. The bit is automatically cleared when the STATUS.CCBUFx bit is cleared. Bit 5 PERPER Synchronization Busy This bit is cleared when the synchronization of PER between the clock domains is complete. This bit is set when the synchronization of PER between clock domains is started. This bit is also set when the PER is written, and cleared on update condition. The bit is automatically cleared when the STATUS.PERBUF bit is cleared. Bit 4 COUNTCOUNT Synchronization Busy This bit is cleared when the synchronization of COUNT between the clock domains is complete. This bit is set when the synchronization of COUNT between clock domains is started. Bit 3 STATUSSTATUS Synchronization Busy This bit is cleared when the synchronization of STATUS between the clock domains is complete. This bit is set when a '1' is written to the Capture Channel Buffer Valid status flags (STATUS.CCBUFVx) and the synchronization of STATUS between clock domains is started. Bit 2 CTRLBCTRLB Synchronization Busy This bit is cleared when the synchronization of CTRLB between the clock domains is complete. This bit is set when the synchronization of CTRLB between clock domains is started. Bit 1 ENABLEENABLE Synchronization Busy This bit is cleared when the synchronization of ENABLE bit between the clock domains is complete. This bit is set when the synchronization of ENABLE bit between clock domains is started. Bit 0 SWRSTSWRST Synchronization Busy This bit is cleared when the synchronization of SWRST bit between the clock domains is complete. This bit is set when the synchronization of SWRST bit between clock domains is started. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1037 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.13 Counter Value, 16-bit Mode Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized COUNT 0x14 0x00 Note:Prior to any read access, this register must be synchronized by the user by writing the according TC Command value to the Control B Set register (CTRLBSET.CMD = READSYNC). Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 12 11 COUNT[15:8]
R/W 0 4 R/W 0 3 COUNT[7:0]
R/W 0 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 COUNT[15:0] Counter Value These bits contain the current counter value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1038 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.14 Channel x Compare/Capture Value, 16-bit Mode CCx Name:
0x1C + x*0x02 [x=0..1]
Offset:
Reset:
0x0000 Property: Write-Synchronized Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 CC[15:8]
CC[7:0]
12 R/W 0 4 R/W 0 11 R/W 0 3 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 CC[15:0]Channel x Compare/Capture Value These bits contain the compare/capture value in 16-bit TC mode. In Match frequency (MFRQ) or Match PWM
(MPWM) waveform operation (WAVE.WAVEGEN), the CC0 register is used as a period register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1039 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.4.15 Channel x Compare Buffer Value, 16-bit Mode CCBUFx Name:
0x30 + x*0x02 [x=0..1]
Offset:
Reset:
0x0000 Property: Write-Synchronized Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 12 11 CCBUF[15:8]
R/W 0 4 R/W 0 3 CCBUF[7:0]
R/W 0 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 CCBUF[15:0]Channel x Compare Buffer Value These bits hold the value of the Channel x Compare Buffer Value. When the buffer valid flag is '1' and double buffering is enabled (CTRLBCLR.LUPD=1), the data from buffer registers will be copied into the corresponding CCx register under UPDATE condition (CTRLBSET.CMD=0x3), including the software update command. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1040 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.5 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CTRLA 0x04 0x05 0x06 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 0x10 0x11
... 0x13 CTRLBCLR CTRLBSET EVCTRL INTENCLR INTENSET INTFLAG STATUS WAVE DRVCTRL Reserved DBGCTRL SYNCBUSY Reserved 0x14 COUNT 0x18
... 0x1B Reserved 0x1C CC0 0x20 CC1 0x24
... 0x2F Reserved 0x30 CCBUF0 0x34 CCBUF1 7:0 15:8 23:16 31:24 7:0 7:0 7:0 15:8 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 ONDEMAND RUNSTDBY PRESCSYNC[1:0]
MODE[1:0]
ENABLE SWRST ALOCK PRESCALER[2:0]
COPENx CAPTENx CMD[2:0]
CMD[2:0]
TCEI MCEO1 MC1 MC1 MC1 TCINV MCEO0 MC0 MC0 MC0 CCBUFV1 CCBUFV0 PERBUFV ONESHOT ONESHOT LUPD LUPD DIR DIR EVACT[2:0]
ERR ERR ERR OVFEO OVF OVF OVF SLAVE STOP WAVEGEN[1:0]
INVENx DBGRUN CCx PER COUNT STATUS CTRLB ENABLE SWRST COUNT[7:0]
COUNT[15:8]
COUNT[23:16]
COUNT[31:24]
CC[7:0]
CC[15:8]
CC[23:16]
CC[31:24]
CC[7:0]
CC[15:8]
CC[23:16]
CC[31:24]
CCBUF[7:0]
CCBUF[15:8]
CCBUF[23:16]
CCBUF[31:24]
CCBUF[7:0]
CCBUF[15:8]
CCBUF[23:16]
CCBUF[31:24]
40.7.6 Register Description - 32-bit Mode 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1041 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized, Enable-Protected CTRLA 0x00 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 Access Reset 20 COPENx R/W 0 Bit 15 14 13 12 Access Reset 19 18 17 16 CAPTENx R/W 0 11 ALOCK R/W 0 10 R/W 0 2 R/W 0 9 PRESCALER[2:0]
R/W 0 8 R/W 0 1 ENABLE R/W 0 0 SWRST W 0 Bit 7 ONDEMAND Access Reset R/W 0 6 RUNSTDBY R/W 0 5 4 PRESCSYNC[1:0]
R/W 0 R/W 0 MODE[1:0]
3 R/W 0 Bit 20 COPENxCapture On Pin x Enable [x=1..0]
Bit x of COPEN[:0] selects the trigger source for capture operation, either events or I/O pin input. This bit is not synchronized. Value 0 1 Description Event from Event System is selected as trigger source for capture operation on channel x. I/O pin is selected as trigger source for capture operation on channel x. Bit 16 CAPTENxCapture Channel x Enable [x=1..0]
Bit x of CAPTEN[:0] selects whether channel x is a capture or a compare channel. These bits are not synchronized. Value 0 1 Description CAPTEN disables capture on channel x. CAPTEN enables capture on channel x. Bit 11 ALOCKAuto Lock When this bit is set, Lock bit update (LUPD) is set to '1' on each overflow/underflow or re-trigger event. This bit is not synchronized. Value 0 1 Description The LUPD bit is not affected on overflow/underflow, and re-trigger event. The LUPD bit is set on each overflow/underflow or re-trigger event. Bits 10:8 PRESCALER[2:0]Prescaler These bits select the counter prescaler factor. These bits are not synchronized. Name Value DIV1 0x0 DIV2 0x1 DIV4 0x2 DIV8 0x3 Description Prescaler: GCLK_TC Prescaler: GCLK_TC/2 Prescaler: GCLK_TC/4 Prescaler: GCLK_TC/8 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1042 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Value 0x4 0x5 0x6 0x7 Name DIV16 DIV64 DIV256 DIV1024 Description Prescaler: GCLK_TC/16 Prescaler: GCLK_TC/64 Prescaler: GCLK_TC/256 Prescaler: GCLK_TC/1024 Bit 7 ONDEMANDClock On Demand This bit selects the clock requirements when the TC is stopped. In standby mode, if the Run in Standby bit (CTRLA.RUNSTDBY) is '0', ONDEMAND is forced to '0'. This bit is not synchronized. Value 0 Description The On Demand is disabled. If On Demand is disabled, the TC will continue to request the clock when its operation is stopped (STATUS.STOP=1). The On Demand is enabled. When On Demand is enabled, the stopped TC will not request the clock. The clock is requested when a software re-trigger command is applied or when an event with start/re-trigger action is detected. 1 Bit 6 RUNSTDBYRun in Standby This bit is used to keep the TC running in standby mode. This bit is not synchronized. Value 0 1 Description The TC is halted in standby. The TC continues to run in standby. Bits 5:4 PRESCSYNC[1:0]Prescaler and Counter Synchronization These bits select whether the counter must wrap around on the next GCLK_TCx clock or the next prescaled GCLK_TCx clock. It also makes it possible to reset the prescaler. These bits are not synchronized. Name Value GCLK 0x0 PRESC 0x1 RESYNC 0x2
0x3 Description Reload or reset the counter on next generic clock Reload or reset the counter on next prescaler clock Reload or reset the counter on next generic clock. Reset the prescaler counter Reserved Bits 3:2 MODE[1:0]Timer Counter Mode These bits select the counter mode. These bits are not synchronized. Name Value COUNT16 0x0 COUNT8 0x1 COUNT32 0x2
0x3 Bit 1 ENABLEEnable Description Counter in 16-bit mode Counter in 8-bit mode Counter in 32-bit mode Reserved Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRLA.ENABLE will read back immediately, and the ENABLE Synchronization Busy bit in the SYNCBUSY register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete. This bit is not enable-protected. Value 0 1 Description The peripheral is disabled. The peripheral is enabled. Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets all registers in the TC, except DBGCTRL, to their initial state, and the TC will be disabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1043 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Writing a '1' to CTRLA.SWRST will always take precedence; all other writes in the same write-operation will be discarded. This bit is not enable-protected. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1044 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.2 Control B Clear Name:
Offset:
Reset:
Property: PAC Write-Protection, Read-Synchronized, Write-Synchronized CTRLBCLR 0x04 0x00 This register allows the user to clear bits in the CTRLB register without doing a read-modify-write operation. Changes in this register will also be reflected in the Control B Set register (CTRLBSET). Bit 7 Access Reset R/W 0 6 CMD[2:0]
R/W 0 5 R/W 0 4 3 2 ONESHOT R/W 0 1 LUPD R/W 0 0 DIR R/W 0 Bits 7:5 CMD[2:0]Command Writing a `0' to these bits has no effect. Writing a '1' to any of these bits will clear the pending command. Bit 2 ONESHOTOne-Shot on Counter This bit controls one-shot operation of the TC. Writing a '0' to this bit has no effect Writing a '1' to this bit will disable one-shot operation. Value 0 1 Description The TC will wrap around and continue counting on an overflow/underflow condition. The TC will wrap around and stop on the next underflow/overflow condition. Bit 1 LUPDLock Update This bit controls the update operation of the TC buffered registers. When CTRLB.LUPD is set, no any update of the registers with value of its buffered register is performed on hardware UPDATE condition. Locking the update ensures that all buffer registers are valid before an hardware update is performed. After all the buffer registers are loaded correctly, the buffered registers can be unlocked. This bit has no effect when input capture operation is enabled. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the LUPD bit. Value 0 Description The CCBUFx and PERBUF buffer registers value are copied into CCx and PER registers on hardware update condition. The CCBUFx and PERBUF buffer registers value are not copied into CCx and PER registers on hardware update condition. 1 Bit 0 DIRCounter Direction This bit is used to change the direction of the counter. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the bit and make the counter count up. Value 0 1 Description The timer/counter is counting up (incrementing). The timer/counter is counting down (decrementing). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1045 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.3 Control B Set Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized CTRLBSET 0x05 0x00 This register allows the user to set bits in the CTRLB register without doing a read-modify-write operation. Changes in this register will also be reflected in the Control B Clear register (CTRLBCLR). Bit 7 Access Reset R/W 0 6 CMD[2:0]
R/W 0 5 R/W 0 4 3 2 ONESHOT R/W 0 1 LUPD R/W 0 0 DIR R/W 0 Bits 7:5 CMD[2:0]Command These bits are used for software control of the TC. The commands are executed on the next prescaled GCLK_TCx clock cycle. When a command has been executed, the CMD bit group will be read back as zero. Writing 0x0 to these bits has no effect. Writing a value different from 0x0 to this bit field will issue a command for execution. Important:This command requires synchronization before being executed. A valid sequence is:the following:
Issue CMD command (CTRLBSET.CMD = command) Wait for CMD synchronization (SYNCBUSY.CTRLB = 0) Wait for CMD read back as zero (CTRLBSET.CMD = 0) Value 0x0 0x1 0x2 0x3 0x4 Name NONE RETRIGGER STOP UPDATE READSYNC Description No action Force a start, restart or retrigger Force a stop Force update of double buffered registers Force a read synchronization of COUNT Bit 2 ONESHOTOne-Shot on Counter This bit controls one-shot operation of the TC. Writing a '0' to this bit has no effect. Writing a '1' to this bit will enable one-shot operation. Value 0 1 Description The TC will wrap around and continue counting on an overflow/underflow condition. The TC will wrap around and stop on the next underflow/overflow condition. Bit 1 LUPDLock Update This bit controls the update operation of the TC buffered registers. When CTRLB.LUPD is set, no any update of the registers with value of its buffered register is performed on hardware UPDATE condition. Locking the update ensures that all buffer registers are valid before an hardware update is performed. After all the buffer registers are loaded correctly, the buffered registers can be unlocked. Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the LUPD bit. This bit has no effect when input capture operation is enabled. Value 0 Description The CCBUFx and PERBUF buffer registers value are copied into CCx and PER registers on hardware update condition. The CCBUFx and PERBUF buffer registers value are not copied into CCx and PER registers on hardware update condition. 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1046 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Bit 0 DIRCounter Direction This bit is used to change the direction of the counter. Writing a '0' to this bit has no effect Writing a '1' to this bit will clear the bit and make the counter count up. Value 0 1 Description The timer/counter is counting up (incrementing). The timer/counter is counting down (decrementing). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1047 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.4 Event Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected EVCTRL 0x06 0x0000 Bit 15 14 Access Reset Bit 7 6 Access Reset 13 MCEO1 R/W 0 5 TCEI R/W 0 12 MCEO0 R/W 0 4 TCINV R/W 0 11 10 9 3 2 R/W 0 1 EVACT[2:0]
R/W 0 8 OVFEO R/W 0 0 R/W 0 Bits 12, 13 MCEOxMatch or Capture Channel x Event Output Enable [x = 1..0]
These bits enable the generation of an event for every match or capture on channel x. Value 0 1 Description Match/Capture event on channel x is disabled and will not be generated. Match/Capture event on channel x is enabled and will be generated for every compare/capture. Bit 8 OVFEOOverflow/Underflow Event Output Enable This bit enables the Overflow/Underflow event. When enabled, an event will be generated when the counter overflows/underflows. Value 0 1 Description Overflow/Underflow event is disabled and will not be generated. Overflow/Underflow event is enabled and will be generated for every counter overflow/underflow. Bit 5 TCEITC Event Enable This bit is used to enable asynchronous input events to the TC. Value 0 1 Description Incoming events are disabled. Incoming events are enabled. Bit 4 TCINVTC Inverted Event Input Polarity This bit inverts the asynchronous input event source. Value 0 1 Description Input event source is not inverted. Input event source is inverted. Bits 2:0 EVACT[2:0]Event Action These bits define the event action the TC will perform on an event. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description Event action disabled Start, restart or retrigger TC on event Count on event Start TC on event Time stamp capture Period captured in CC0, pulse width in CC1 Period captured in CC1, pulse width in CC0 Pulse width capture Name OFF RETRIGGER COUNT START STAMP PPW PWP PW 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1048 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.5 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x08 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENSET). Bit 7 6 Access Reset 5 MC1 R/W 0 4 MC0 R/W 0 3 2 1 ERR R/W 0 0 OVF R/W 0 Bits 4, 5 MCxMatch or Capture Channel x Interrupt Enable Writing a '0' to these bits has no effect. Writing a '1' to MCx will clear the corresponding Match or Capture Channel x Interrupt Enable bit, which disables the Match or Capture Channel x interrupt. Description Value The Match or Capture Channel x interrupt is disabled. 0 The Match or Capture Channel x interrupt is enabled. 1 Bit 1 ERRError Interrupt Disable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Error Interrupt Enable bit, which disables the Error interrupt. Value 0 1 Description The Error interrupt is disabled. The Error interrupt is enabled. Bit 0 OVFOverflow Interrupt Disable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Overflow Interrupt Enable bit, which disables the Overflow interrupt request. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1049 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.6 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x09 0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear register (INTENCLR). Bit 7 6 Access Reset 5 MC1 R/W 0 4 MC0 R/W 0 3 2 1 ERR R/W 0 0 OVF R/W 0 Bits 4, 5 MCxMatch or Capture Channel x Interrupt Enable Writing a '0' to these bits has no effect. Writing a '1' to MCx will clear the corresponding Match or Capture Channel x Interrupt Enable bit, which disables the Match or Capture Channel x interrupt. Description Value The Match or Capture Channel x interrupt is disabled. 0 The Match or Capture Channel x interrupt is enabled. 1 Bit 1 ERRError Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Error Interrupt Enable bit, which enables the Error interrupt. Value 0 1 Description The Error interrupt is disabled. The Error interrupt is enabled. Bit 0 OVFOverflow Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Overflow Interrupt Enable bit, which enables the Overflow interrupt request. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1050 40.7.6.7 Interrupt Flag Status and Clear PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) Name:
Offset:
Reset:
Property:
INTFLAG 0x0A 0x00
Bit 7 6 Access Reset 5 MC1 R/W 0 4 MC0 R/W 0 3 2 1 ERR R/W 0 0 OVF R/W 0 Bits 4, 5 MCxMatch or Capture Channel x This flag is set on a comparison match, or when the corresponding CCx register contains a valid capture value. This flag is set on the next CLK_TC_CNT cycle, and will generate an interrupt request if the corresponding Match or Capture Channel x Interrupt Enable bit in the Interrupt Enable Set register (INTENSET.MCx) is '1'. Writing a '0' to one of these bits has no effect. Writing a '1' to one of these bits will clear the corresponding Match or Capture Channel x interrupt flag In capture operation, this flag is automatically cleared when CCx register is read. Bit 1 ERRError Interrupt Flag This flag is set when a new capture occurs on a channel while the corresponding Match or Capture Channel x interrupt flag is set, in which case there is nowhere to store the new capture. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Error interrupt flag. Bit 0 OVFOverflow Interrupt Flag This flag is set on the next CLK_TC_CNT cycle after an overflow condition occurs, and will generate an interrupt request if INTENCLR.OVF or INTENSET.OVF is '1'. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Overflow interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1051 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.8 Status STATUS Name:
0x0B Offset:
Reset:
0x01 Property: Read-Synchronized Bit 7 6 Access Reset 5 CCBUFV1 R/W 0 4 CCBUFV0 R/W 0 3 PERBUFV R/W 0 2 1 SLAVE R 0 0 STOP R 1 Bits 4, 5 CCBUFVChannel x Compare or Capture Buffer Valid For a compare channel x, the bit x is set when a new value is written to the corresponding CCBUFx register. The bit x is cleared by writing a '1' to it when CTRLB.LUPD is set, or it is cleared automatically by hardware on UPDATE condition. For a capture channel x, the bit x is set when a valid capture value is stored in the CCBUFx register. The bit x is cleared automatically when the CCx register is read. Bit 3 PERBUFVPeriod Buffer Valid This bit is set when a new value is written to the PERBUF register. The bit is cleared by writing '1' to the corresponding location when CTRLB.LUPD is set, or automatically cleared by hardware on UPDATE condition. This bit is available only in 8-bit mode and will always read zero in 16- and 32-bit modes. Bit 1 SLAVEClient Status Flag This bit is only available in 32-bit mode on the Client TC (i.e., TC1 and/or TC3). The bit is set when the associated Host TC (TC0 and TC2, respectively) is set to run in 32-bit mode. Bit 0 STOPStop Status Flag This bit is set when the TC is disabled, on a Stop command, or on an overflow/underflow condition when the One-Shot bit in the Control B Set register (CTRLBSET.ONESHOT) is '1'. Value 0 1 Description Counter is running. Counter is stopped. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1052 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.9 Waveform Generation Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected WAVE 0x0C 0x00 Bit 7 6 5 4 3 2 Access Reset Bits 1:0 WAVEGEN[1:0]Waveform Generation Mode 1 0 WAVEGEN[1:0]
R/W 0 R/W 0 These bits select the waveform generation operation. They affect the top value, as shown in Waveform Output Operations. They also control whether frequency or PWM waveform generation must be used. The waveform generation operations are explained in Waveform Output Operations. See Waveform Output Operations from Related Links. These bits are not synchronized. Value Name Operation Top Value Output Waveform on Match Output Waveform on Wraparound 0x0 0x1 0x2 0x3 1. NFRQ MFRQ NPWM MPWM Normal frequency Match frequency Normal PWM Match PWM PER1 / Max CC0 PER1 / Max CC0 Toggle Toggle Set Set No action No action Clear Clear This depends on the TC mode: In 8-bit mode, the top value is the Period Value register (PER). In 16- and 32-bit mode, it is the respective MAX value. Related Links 40.6.2.6.1. Waveform Output Operations 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1053 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.10 Driver Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected DRVCTRL 0x0D 0x00 Bit 7 6 5 4 3 2 1 Access Reset Bit 0 INVENxOutput Waveform x Invert Enable INVENx bit selects inversion of the output or capture trigger input of channel x. Value 0 1 Description Disable inversion of the WO[x] output and IO input pin. Enable inversion of the WO[x] output and IO input pin. 0 INVENx R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1054 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.11 Debug Control Name:
Offset:
Reset:
Property: PAC Write-Protection DBGCTRL 0x0F 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGRUNRun in Debug Mode DBGRUN R/W 0 This bit is not affected by a software Reset, and must not be changed by software while the TC is enabled. Value 0 1 Description The TC is halted when the device is halted in debug mode. The TC continues normal operation when the device is halted in debug mode. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1055 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.12 Synchronization Busy Name:
Offset:
Reset:
Property:
SYNCBUSY 0x10 0x00
Bit 7 Access Reset 6 CCx R 0 5 PER R 0 4 COUNT R 0 3 STATUS R 0 2 CTRLB R 0 1 ENABLE R 0 0 SWRST R 0 Bit 6 CCxCompare/Capture Channel x Synchronization Busy [x=0..1]
For details on CC channels number, refer to each TC feature list. This bit is set when the synchronization of CCx between clock domains is started. This bit is also set when the CCBUFx is written, and cleared on update condition. The bit is automatically cleared when the STATUS.CCBUFx bit is cleared. Bit 5 PERPER Synchronization Busy This bit is cleared when the synchronization of PER between the clock domains is complete. This bit is set when the synchronization of PER between clock domains is started. This bit is also set when the PER is written, and cleared on update condition. The bit is automatically cleared when the STATUS.PERBUF bit is cleared. Bit 4 COUNTCOUNT Synchronization Busy This bit is cleared when the synchronization of COUNT between the clock domains is complete. This bit is set when the synchronization of COUNT between clock domains is started. Bit 3 STATUSSTATUS Synchronization Busy This bit is cleared when the synchronization of STATUS between the clock domains is complete. This bit is set when a '1' is written to the Capture Channel Buffer Valid status flags (STATUS.CCBUFVx) and the synchronization of STATUS between clock domains is started. Bit 2 CTRLBCTRLB Synchronization Busy This bit is cleared when the synchronization of CTRLB between the clock domains is complete. This bit is set when the synchronization of CTRLB between clock domains is started. Bit 1 ENABLEENABLE Synchronization Busy This bit is cleared when the synchronization of ENABLE bit between the clock domains is complete. This bit is set when the synchronization of ENABLE bit between clock domains is started. Bit 0 SWRSTSWRST Synchronization Busy This bit is cleared when the synchronization of SWRST bit between the clock domains is complete. This bit is set when the synchronization of SWRST bit between clock domains is started. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1056 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.13 Counter Value, 32-bit Mode Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized COUNT 0x14 0x00 Note:Prior to any read access, this register must be synchronized by user by writing the according TC Command value to the Control B Set register (CTRLBSET.CMD=READSYNC). Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 COUNT[31:24]
R/W 0 20 R/W 0 19 COUNT[23:16]
R/W 0 12 R/W 0 11 COUNT[15:8]
R/W 0 4 R/W 0 3 COUNT[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 COUNT[31:0] Counter Value These bits contain the current counter value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1057 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.14 Channel x Compare/Capture Value, 32-bit Mode Name:
Offset:
Reset:
Property: Write-Synchronized CCx 0x1C + x*0x04 [x=0..1]
0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 CC[31:24]
CC[23:16]
CC[15:8]
CC[7:0]
28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 27 R/W 0 19 R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 CC[31:0]Channel x Compare/Capture Value These bits contain the compare/capture value in 32-bit TC mode. In Match frequency (MFRQ) or Match PWM
(MPWM) waveform operation (WAVE.WAVEGEN), the CC0 register is used as a period register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1058 PIC32CX-BZ2 and WBZ45 Family Timer/Counter (TC) 40.7.6.15 Channel x Compare Buffer Value, 32-bit Mode Name:
Offset:
Reset:
Property: Write-Synchronized CCBUFx 0x30 + x*0x04 [x=0..1]
0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 CCBUF[31:24]
R/W 0 20 R/W 0 19 CCBUF[23:16]
R/W 0 12 R/W 0 11 CCBUF[15:8]
R/W 0 4 R/W 0 3 CCBUF[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 CCBUF[31:0]Channel x Compare Buffer Value These bits hold the value of the Channel x Compare Buffer Value. When the buffer valid flag is '1' and double buffering is enabled (CTRLBCLR.LUPD=1), the data from buffer registers will be copied into the corresponding CCx register under UPDATE condition (CTRLBSET.CMD=0x3), including the software update command. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1059 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41. Timer/Counter for Control Applications (TCC) 41.1 Overview The device provides three instances of the Timer/Counter for Control Applications (TCC). Each TCC instance consists of a counter, a prescaler, compare/capture channels and control logic. The counter can be set to count events or clock pulses. The counter together with the compare/capture channels can be configured to time stamp input events, allowing capture of frequency and pulse-width. It can also perform waveform generation, such as frequency generation and pulse-width modulation. Waveform extensions are featured for motor control, ballast, LED, H-bridge, power converters and other types of power control applications. They allow for low-side and high-side output with optional dead-time insertion. Waveform extensions can also generate a synchronized bit pattern across the waveform output pins. The fault options enable fault protection for safe and deterministic handling, disabling and/or shut-down of external drivers. Note:The TCC configurations, such as channel numbers and features, may be reduced for some of the TCC instances. Table 41-1. TCC Specific Configuration Extensions TCC No. Counter Size
(SIZE) Host Link
(Host_Client_MODE)
(0 = NA, 1 = Host, 2 =
Client) Channels
(CC_NUM) Pins WO_NUM
(OW_NUM) Fault 1=YES Dithering 1=YES OutMatrix 1=YES
(OTMX) Dead Time Insertion 1=YES
(DTI) Swap 1=YES
(SWAP) Pattern Generation 1=YES (PG) 0 1 2 24 24 16 1 2 0 6 6 2 6 6 2 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 1 1 0 Note:Traditional Timer/Counter for Control Applications (TCC) documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Host and Client, respectively. 41.2 Features Compare/Capture Channels (CC) with:
Double buffered period setting Double buffered compare or capture channel Circular buffer on period and compare channel registers Waveform Generation:
Frequency generation Single-slope pulse-width modulation (PWM) Dual-slope PWM with half-cycle reload capability Input Capture:
Event capture Frequency capture Pulse-width capture Waveform Extensions:
Configurable distribution of compare channels outputs across port pins Low-side and high-side output with programmable dead-time insertion Waveform swap option with double buffer support 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1060 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Pattern generation with double buffer support Dithering support Fault Protection for Safe Disabling of Drivers:
Two recoverable fault sources Two non-recoverable fault sources Debugger can be a source of non-recoverable fault Input Events:
Two input events (EVx) for counter One input event (MCx) for each channel Output Events:
Three output events (Count, re-trigger and overflow) are available for counter One compare match/input capture event output for each channel Interrupts:
Overflow and re-trigger interrupt Compare match/input capture interrupt Interrupt on fault detection 41.3 Block Diagram Figure 41-1. Timer/Counter for Control Applications - Block Diagram 41.4 Signal Description Table 41-2. Signal Description Pin Name TCC/WO[0]
TCC/WO[1]
Type Description Digital output Compare channel 0 waveform output Digital output Compare channel 1 waveform output
... .. TCC/WO[WO_NUM-1]
Digital output Compare channel n waveform output See I/O Ports and Peripheral Pin Select (PPS) from Related Links for details on the pin mapping for this peripheral. One signal can be mapped on several pins. Related Links 6. I/O Ports and Peripheral Pin Select (PPS) 41.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 41.5.1 I/O Lines In order to use the I/O lines of this peripheral, the I/O pins must be configured using the I/O Peripheral Pin Select
(PPS). 41.5.2 Power Management This peripheral can continue to operate in any Sleep mode where its source clock is running. The interrupts can wake up the device from Sleep modes. Events connected to the event system can trigger other operations in the system without exiting Sleep modes. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1061 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.5.3 Clocks A generic clock (GCLK_TCCx) is required to clock the TCC. This clock must be configured and enabled in the generic clock controller before using the TCC. Note that TCC1 and TCC2 share a single peripheral clock generator. The generic clocks (GCLK_TCCx) are asynchronous to the bus clock (PB1_CLK). Due to this asynchronicity, writing certain registers will require synchronization between the clock domains. 41.5.4 DMA The DMA request lines are connected to the DMA Controller (DMAC). In order to use DMA requests with this peripheral, the DMAC must be configured first (see Direct Memory Access Controller (DMAC) from Related Links). Related Links 22. Direct Memory Access Controller (DMAC) 41.5.5 Interrupts The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral, the Interrupt Controller (NVIC) must be configured first. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 41.5.6 Events The events of this peripheral are connected to the Event System. Related Links 28. Event System (EVSYS) 41.5.7 Debug Operation When the CPU is halted in Debug mode, this peripheral will halt normal operation. This peripheral can be forced to continue operation during debugging - refer to the Debug Control (DBGCTRL) register for details. Related Links 41.8.8. DBGCTRL 41.5.8 Register Access Protection Registers with write access can be optionally write-protected by the Peripheral Access Controller (PAC), except for the following:
Interrupt Flag register (INTFLAG) Status register (STATUS) Period and Period Buffer registers (PER, PERB) Compare/Capture and Compare/Capture Buffer registers (CCx, CCBx) Control Waveform register (WAVE) Pattern Generation Value and Pattern Generation Value Buffer registers (PATT, PATTB) Note:Optional write protection is indicated by the "PAC Write Protection" property in the register description. Write protection does not apply for accesses through an external debugger. 41.5.9 Analog Connections Not applicable. 41.6 Functional Description 41.6.1 Principle of Operation The following definitions are used throughout the documentation:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1062 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Table 41-3. Timer/Counter for Control Applications Definitions Name TOP ZERO MAX UPDATE Timer Counter CC Description The counter reaches TOP when it becomes equal to the highest value in the count sequence. The TOP value can be the same as Period (PER) or the Compare Channel 0 (CC0) register value depending on the Waveform Generator mode in Waveform Output Operations. See Waveform Output Generation Operations from Related Links. The counter reaches ZERO when it contains all zeros. The counter reaches maximum when it contains all ones. The timer/counter signals an update when it reaches ZERO or TOP, depending on the direction settings. The timer/counter clock control is handled by an internal source. The clock control is handled externally (e.g., counting external events). For compare operations, the CC are referred to as "compare channels."
For capture operations, the CC are referred to as "capture channels."
Each TCC instance has up to six compare/capture channels (CCx). The Counter register (COUNT), Period registers with Buffer (PER and PERB), and Compare and Capture registers with buffers (CCx and CCBx) are 16- or 24-bit registers, depending on each TCC instance. Each Buffer register has a Buffer Valid (BUFV) flag that indicates when the buffer contains a new value. Under normal operation, the counter value is continuously compared to the TOP or ZERO value to determine whether the counter has reached TOP or ZERO. In either case, the TCC can generate interrupt requests or generate events for the Event System. In Waveform Generator mode, these comparisons are used to set the waveform period or pulse width. A prescaled generic clock (GCLK_TCCx) and events from the event system can be used to control the counter. The event system is also used as a source to the input capture. The Recoverable Fault Unit enables event-controlled waveforms by acting directly on the generated waveforms of the TCC compare channels output. These events can restart, halt the timer/counter period, shorten the output pulse active time, or disable waveform output as long as the fault condition is present. This can typically be used for current sensing regulation, and zero-crossing and demagnetization re-triggering. The MCE0 and MCE1 asynchronous event sources are shared with the recoverable fault unit. Only asynchronous events are used internally when fault unit extension is enabled. See Event System (EVSYS) from Related Links for further details on how to configure asynchronous events routing. Recoverable fault sources can be filtered and/or windowed to avoid false triggering, for example from I/O pin glitches, by using digital filtering, input blanking and qualification options. See Recoverable Faults from Related Links. In order to support applications with different types of motor control, ballast, LED, H-bridge, power converter and other types of power switching applications, the following independent units are implemented in some of the TCC instances as optional and successive units:
Recoverable faults and non-recoverable faults Output matrix Dead-time insertion Swap Pattern generation See Timer/Counter for Control Applications - Block Diagram in the Block Diagram from Related Links. The output matrix (OTMX) can distribute and route out the TCC waveform outputs across the port pins in different configurations, each optimized for different application types. The Dead-Time Insertion (DTI) unit splits the four lower OTMX outputs into two non-overlapping signals: the non-inverted Low Side (LS) and inverted High Side (HS) of the 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1063 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) waveform output with optional dead-time insertion between LS and HS switching. The SWAP unit can swap the LS and HS pin outputs and can be used for fast decay motor control. The pattern generation unit can be used to generate synchronized waveforms with constant logic level on TCC UPDATE conditions. This is useful for easy stepper motor and full bridge control. The non-recoverable fault module enables event-controlled fault protection by acting directly on the generated waveforms of the timer/counter compare channel outputs. When a non-recoverable fault condition is detected, the output waveforms are forced to a preconfigured value that is safe for the application. This is typically used for instant and predictable shut-down and disabling high current or voltage drives. The count event sources (TCE0 and TCE1) are shared with the non-recoverable fault extension. The events can be optionally filtered. If the filter options are not used, the non-recoverable faults provide an immediate asynchronous action on waveform output, even for cases where the clock is not present. See Event System (EVSYS) from Related Links for further details on how to configure asynchronous events routing. Related Links 28. Event System (EVSYS) 40.6.2.6.1. Waveform Output Operations 41.3. Block Diagram 41.6.3.5. Recoverable Faults 41.6.2 Basic Operation 41.6.2.1 Initialization The following registers are enable-protected, meaning that they can only be written when the TCC is disabled
(CTRLA.ENABLE=0):
Control A (CTRLA) register, except Run Standby (RUNSTDBY), Enable (ENABLE) and Software Reset
(SWRST) bits Recoverable Fault n Control registers (FCTRLA and FCTRLB) Waveform Extension Control register (WEXCTRL) Drive Control register (DRVCTRL) Event Control register (EVCTRL) Enable-protected bits in the CTRLA register can be written at the same time as CTRLA.ENABLE is written to 1, but not at the same time as CTRLA.ENABLE is written to 0. Enable-protection is denoted by the Enable-Protected property in the register description. Before the TCC is enabled, it must be configured as outlined by the following steps:
Enable the TCC bus clock if not already enabled by default (PB1_CLK). If Capture mode is required, enable the channel in Capture mode by writing a 1 to the Capture Enable bit in the Control A register (CTRLA.CPTEN). 1. 2. Optionally, the following configurations can be set before enabling TCC:
1. 2. 3. 4. 5. 6. Select PRESCALER setting in the Control A register (CTRLA.PRESCALER). Select Prescaler Synchronization setting in Control A register (CTRLA.PRESCSYNC). If down-counting operation is desired, write the Counter Direction bit in the Control B Set register
(CTRLBSET.DIR) to 1. Select the Waveform Generation operation in the WAVE register (WAVE.WAVEGEN). Select the Waveform Output Polarity in the WAVE register (WAVE.POL). The waveform output can be inverted for the individual channels using the Waveform Output Invert Enable bit group in the Driver register (DRVCTRL.INVEN). 41.6.2.2 Enabling, Disabling, and Resetting The TCC is enabled by writing a 1 to the Enable bit in the Control A register (CTRLA.ENABLE). The TCC is disabled by writing a zero to CTRLA.ENABLE. The TCC is reset by writing 1 to the Software Reset bit in the Control A register (CTRLA.SWRST). All registers in the TCC, except DBGCTRL, will be reset to their initial state, and the TCC will be disabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1064 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) The TCC must be disabled before the TCC is reset to avoid undefined behavior. 41.6.2.3 Prescaler Selection The GCLK_TCCx clock is fed into the internal prescaler. The prescaler consists of a counter that counts up to the selected prescaler value, whereupon the output of the prescaler toggles. If the prescaler value is higher than one, the Counter Update condition can be optionally executed on the next GCLK_TCCx clock pulse or the next prescaled clock pulse. For further details, refer to the Prescaler
(CTRLA.PRESCALER) and Counter Synchronization (CTRLA.PRESYNC) descriptions. Prescaler outputs from 1 to 1/1024 are available. For a complete list of available prescaler outputs, see the register description for the Prescaler bit group in the Control A register (CTRLA.PRESCALER). Note:When counting events, the prescaler is bypassed. The joint stream of prescaler ticks and event action ticks is called CLK_TCCx_COUNT. Figure 41-2. Prescaler PRESCALER EVACT 0/1 GCLK_TCCx PRESCALER GCLK_TCCx /
{1,2,4,8,64,256,1024 }
TCCx EV0/1 CLK_TCCx_COUNT COUNT 41.6.2.4 Counter Operation Depending on the mode of operation, the counter is cleared, reloaded, incremented, or decremented at each TCC clock input (CLK_TCCx_COUNT). A counter clear or reload mark the end of current counter cycle and the start of a new one. The counting direction is set by the Direction bit in the Control B register (CTRLB.DIR). If the bit is zero, it's counting up and one if counting down. The counter will count up or down for each tick (clock or event) until it reaches TOP or ZERO. When it's counting up and TOP is reached, the counter will be set to zero at the next tick (overflow) and the Overflow Interrupt Flag in the Interrupt Flag Status and Clear register (INTFLAG.OVF) will be set. When down-counting, the counter is reloaded with the TOP value when ZERO is reached (underflow), and INTFLAG.OVF is set. Note:When the TCC is counting down, the COUNT register must be initialized to the TOP value (PER or CC0 value depending on the mode). INTFLAG.OVF can be used to trigger an interrupt, or an event. An overflow/underflow occurrence (i.e., a compare match with TOP/ZERO) will stop counting if the One-Shot bit in the Control B register is set (CTRLBSET.ONESHOT). The One-Shot feature is explained in the Additional Features section. Figure 41-3. Counter Operation Direction Change COUNT written
"reload" update
"clear" update COUNT MAX TOP ZERO DIR 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1065 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Users can change the counter value (by writing directly in the COUNT register) even when the counter is running. The COUNT value will always be ZERO or TOP, depending on direction set by CTRLBSET.DIR or CTRLBCLR.DIR, when starting the TCC, unless a different value has been written to it, or the TCC has been stopped at a value other than ZERO. The write access has higher priority than count, clear, or reload. The direction of the counter can also be changed during normal operation. Stop Command A stop command can be issued from software by using TCC Command bits in the Control B Set register
(CTRLBSET.CMD = 0x2, STOP). Pause Event Action A pause command can be issued when the stop event action is configured in the Input Event Action 1 bits in Event Control register (EVCTRL.EVACT1 = 0x3, STOP). Re-Trigger Command and Event Action A re-trigger command can be issued from software by using TCC Command bits in Control B Set register
(CTRLBSET.CMD = 0x1, RETRIGGER), or from event when the re-trigger event action is configured in the Input Event 0/1 Action bits in Event Control register (EVCTRL.EVACTn = 0x1, RETRIGGER). When the command is detected during counting operation, the counter will be reloaded or cleared, depending on the counting direction (CTRLBSET.DIR or CTRLBCLR.DIR). The Re-Trigger bit in the Interrupt Flag Status and Clear register will be set (INTFLAG.TRG). It is also possible to generate an event by writing a '1' to the Re-Trigger Event Output Enable bit in the Event Control register (EVCTRL.TRGEO). If the re-trigger command is detected when the counter is stopped, the counter will resume counting operation from the value in COUNT. Note:
When a re-trigger event action is configured in the Event Action bits in the Event Control register (EVCTRL.EVACTn
= 0x1, RETRIGGER), enabling the counter will not start the counter. The counter will start on the next incoming event and restart on corresponding following event. Start Event Action The start action can be selected in the Event Control register (EVCTRL.EVACT0 = 0x3, START) and can start the counting operation when previously stopped. The event has no effect if the counter is already counting. When the module is enabled, the counter operation starts when the event is received or when a re-trigger software command is applied. Note:
When a start event action is configured in the Event Action bits in the Event Control register (EVCTRL.EVACT0 =
0x3, START), enabling the counter will not start the counter. The counter will start on the next incoming event, but it will not restart on subsequent events. Count Event Action The TCC can count events. When an event is received, the counter increases or decreases the value, depending on direction settings (CTRLBSET.DIR or CTRLBCLR.DIR). The count event action is selected by the Event Action 0 bit group in the Event Control register (EVCTRL.EVACT0 =
0x5, COUNT). Direction Event Action The direction event action can be selected in the Event Control register (EVCTRL.EVACT1 = 0x2, DIR). When this event is used, the asynchronous event path specified in the event system must be configured or selected. The direction event action can be used to control the direction of the counter operation, depending on external events level. When received, the event level overrides the Direction settings (CTRLBSET.DIR or CTRLBCLR.DIR) and the direction bit value is updated accordingly. Increment Event Action The increment event action can be selected in the Event Control register (EVCTRL.EVACT0 = 0x4, INC) and can change the Counter state when an event is received. When the TCE0 event (TCCx_EV0) is received, the counter increments, whatever the direction setting (CTRLBSET.DIR or CTRLBCLR.DIR) is. Decrement Event Action 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1066 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) The decrement event action can be selected in the Event Control register (EVCTRL.EVACT1 = 0x4, DEC) and can change the Counter state when an event is received. When the TCE1 (TCCx_EV1) event is received, the counter decrements, whatever the direction setting (CTRLBSET.DIR or CTRLBCLR.DIR) is. Non-recoverable Fault Event Action Non-recoverable fault actions can be selected in the Event Control register (EVCTRL.EVACTn = 0x7, FAULT). When received, the counter will be stopped and the output of the compare channels is overridden according to the Driver Control register settings (DRVCTRL.NREx and DRVCTRL.NRVx). TCE0 and TCE1 must be configured as asynchronous events. Event Action Off If the event action is disabled (EVCTRL.EVACTn = 0x0, OFF), enabling the counter will also start the counter. Related Links 41.6.3.1. One-Shot Operation 41.6.2.5 Compare Operations By default, the Compare/Capture channel is configured for compare operations. To perform capture operations, it must be re-configured. When using the TCC with the Compare/Capture Value registers (CCx) for compare operations, the counter value is continuously compared to the values in the CCx registers. This can be used for timer or for waveform operation. The Channel x Compare/Capture Buffer Value (CCBx) registers provide double buffer capability. The double buffering synchronizes the update of the CCx register with the buffer value at the UPDATE condition or a force update command (CTRLBSET.CMD=0x3, UPDATE). See Double Buffering from Related Links. The synchronization prevents the occurrence of odd-length, non-symmetrical pulses and ensures glitch-free output. Related Links 41.6.2.6. Double Buffering 41.6.2.5.1 Waveform Output Generation Operations The compare channels can be used for waveform generation on output port pins. To make the waveform available on the connected pin, the following requirements must be fulfilled:
1. Choose a Waveform Generation mode in the Waveform Generation Operation bit in Waveform register
(WAVE.WAVEGEN). 2. Optionally, invert the waveform output WO[x] by writing the corresponding Waveform Output x Inversion bit in the Driver Control register (DRVCTRL.INVENx). 3. Configure the pins with the I/O Pin Controller. See I/O Ports and Peripheral Pin Select (PPS) from Related Links. Note:Event must not be used when the compare channel is set in waveform output operating mode. The counter value is continuously compared with each CCx value. On a comparison match, the Match or Capture Channel x bit in the Interrupt Flag Status and Clear register (INTFLAG.MCx) will be set on the next zero-to-one transition of CLK_TCC_COUNT (see Normal Frequency Operation). An interrupt and/or event can be generated on the same condition if Match/Capture occurs, i.e., INTENSET.MCx and/or EVCTRL.MCEOx is 1. Both interrupt and event can be generated simultaneously. There are seven waveform configurations for the Waveform Generation Operation bit group in the Waveform register
(WAVE.WAVEGEN). This will influence how the waveform is generated and impose restrictions on the top value. The configurations are:
Normal Frequency (NFRQ) Match Frequency (MFRQ) Normal Pulse-Width Modulation (NPWM) Dual-slope, interrupt/event at TOP (DSTOP) Dual-slope, interrupt/event at ZERO (DSBOTTOM) Dual-slope, interrupt/event at Top and ZERO (DSBOTH) Dual-slope, critical interrupt/event at ZERO (DSCRITICAL) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1067 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) When using MFRQ configuration, the TOP value is defined by the CC0 register value. For the other waveform operations, the TOP value is defined by the Period (PER) register value. For dual-slope waveform operations, the update time occurs when the counter reaches ZERO. For the other Waveforms Generation modes, the update time occurs on counter wraparound, on overflow, underflow or re-trigger. The table below shows the update counter and overflow event/interrupt generation conditions in different operation modes. Table 41-4. Counter Update and Overflow Event/interrupt Conditions Name Operation TOP Update Output Waveform OVFIF/Event NFRQ MFRQ NPWM DSCRITICAL DSBOTTOM DSBOTH DSTOP Normal Frequency Match Frequency Single-slope PWM Dual-slope PWM Dual-slope PWM Dual-slope PWM Dual-slope PWM PER TOP/ ZERO Toggle Stable TOP On Match On Update Up Down ZERO CC0 TOP/ ZERO Toggle Stable TOP ZERO PER TOP/ ZERO See section 'Output Polarity'
TOP ZERO below PER ZERO PER ZERO PER TOP(1) &
ZERO PER ZERO ZERO ZERO TOP ZERO TOP 1. The UPDATE condition on TOP only will occur when circular buffer is enabled for the channel. Related Links 6. I/O Ports and Peripheral Pin Select (PPS) 41.6.2.5.2 Normal Frequency (NFRQ) For Normal Frequency generation, the period time (T) is controlled by the period register (PER). The waveform generation output (WO[x]) is toggled on each compare match between COUNT and CCx, and the corresponding Match or Capture Channel x Interrupt Flag (EVCTRL.MCEOx) will be set. Figure 41-4. Normal Frequency Operation Period (T) Direction Change COUNT Written COUNT MAX TOP CCx ZERO WO[x]
"reload" update
"clear" update
"match"
41.6.2.5.3 Match Frequency (MFRQ) For Match Frequency generation, the period time (T) is controlled by CC0 register instead of PER. WO[0] toggles on each update condition. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1068 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Direction Change COUNT Written
"reload" update
"clear" update Figure 41-5. Match Frequency Operation COUNT MAX CC0 ZERO WO[0]
41.6.2.5.4 Normal Pulse-Width Modulation (NPWM) NPWM uses single-slope PWM generation. 41.6.2.5.5 Single-Slope PWM Operation For single-slope PWM generation, the period time (T) is controlled by Top value, and CCx controls the duty cycle of the generated waveform output. When up-counting, the WO[x] is set at start or compare match between the COUNT and TOP values, and cleared on compare match between COUNT and CCx register values. When down-counting, the WO[x] is cleared at start or compare match between the COUNT and ZERO values, and set on compare match between COUNT and CCx register values. Figure 41-6. Single-Slope PWM Operation CCx=ZERO CCx=TOP MAX TOP COUNT CCx ZERO WO[x]
"clear" update
"match"
The following equation calculates the exact resolution for a single-slope PWM (RPWM_SS) waveform:
RPWM_SS =
The PWM frequency depends on the Period register value (PER) and the peripheral clock frequency (fGCLK_TCCx), and can be calculated by the following equation:
log(TOP+1) log(2) fPWM_SS =
Where N represents the prescaler divider used (1, 2, 4, 8, 16, 64, 256, 1024). fGCLK_TCCx N(TOP+1) 41.6.2.5.6 Dual-Slope PWM Generation For dual-slope PWM generation, the period setting (TOP) is controlled by PER, while CCx control the duty cycle of the generated waveform output. The figure below shows how the counter repeatedly counts from ZERO to PER and then from PER to ZERO. The waveform generator output is set on compare match when up-counting, and cleared on compare match when down-counting. An interrupt and/or event is generated on TOP (when counting upwards) and/or ZERO (when counting up or down). In DSBOTH operation, the circular buffer must be enabled to enable the update condition on TOP. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1069 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Figure 41-7. Dual-Slope Pulse Width Modulation CCx=ZERO CCx=TOP
"update"
"match"
CCx COUNT MAX TOP ZERO WO[x]
Using dual-slope PWM results in a lower maximum operation frequency compared to single-slope PWM generation. The period (TOP) defines the PWM resolution. The minimum resolution is 1 bit (TOP=0x00000001). The following equation calculates the exact resolution for dual-slope PWM (RPWM_DS):
. RPWM_DS =
The PWM frequency fPWM_DS depends on the period setting (TOP) and the peripheral clock frequency fGCLK_TCCx, and can be calculated by the following equation:
log(PER+1) log(2) fPWM_DS =
N represents the prescaler divider used. The waveform generated will have a maximum frequency of half of the TCC clock frequency (fGCLK_TCCx) when TOP is set to 0x00000001 and no prescaling is used. fGCLK_TCCx 2N PER The pulse width (PPWM_DS) depends on the compare channel (CCx) register value and the peripheral clock frequency
(fGCLK_TCCx), and can be calculated by the following equation:
2N TOP CCx PPWM_DS =
N represents the prescaler divider used. fGCLK_TCCx Note:In DSTOP, DSBOTTOM and DSBOTH operation, when TOP is lower than MAX/2, the CCx MSB bit defines the ramp on which the CCx Match interrupt or event is generated. (Rising if CCx[MSB] = 0, falling if CCx[MSB] = 1.) Related Links 41.6.3.2. Circular Buffer 41.6.2.5.7 Dual-Slope Critical PWM Generation Critical mode generation allows generation of non-aligned centered pulses. In this mode, the period time is controlled by PER while CCx control the generated waveform output edge during up-counting and CC(x+CC_NUM/2) control the generated waveform output edge during down-counting. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1070 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Figure 41-8. Dual-Slope Critical Pulse Width Modulation (N=CC_NUM) CCx CC(x+N/2) CCx CC(x+N/2) CCx CC(x+N/2)
"reload" update
"match"
COUNT MAX TOP ZERO WO[x]
41.6.2.5.8 Output Polarity The polarity (WAVE.POLx) is available in all waveform output generation. In single-slope and dual-slope PWM operation, it is possible to invert the pulse edge alignment individually on start or end of a PWM cycle for each compare channels. The table below shows the waveform output set/clear conditions, depending on the settings of timer/counter, direction, and polarity. Table 41-5. Waveform Generation Set/Clear Conditions Waveform Generation Operation Single-Slope PWM Dual-Slope PWM DIR POLx Waveform Generation Output Update Set Clear 0 1 x 0 1 0 1 0 1 Timer/counter matches TOP Timer/counter matches CCx Timer/counter matches CC Timer/counter matches TOP Timer/counter matches CC Timer/counter matches ZERO Timer/counter matches ZERO Timer/counter matches CC Timer/counter matches CC when counting up Timer/counter matches CC when counting down Timer/counter matches CC when counting down Timer/counter matches CC when counting up In Normal and Match Frequency, the WAVE.POLx value represents the initial state of the waveform output. 41.6.2.6 Double Buffering The Pattern (PATT), Period (PER) and Compare Channels (CCx) registers are all double buffered. Each buffer register has a buffer valid (PATTBV, PERBV and CCBVx) bit in the STATUS register that indicates that the Buffer register contains a valid value that can be copied into the corresponding register. When the Buffer Valid Flag bit in the STATUS register is 1 and the Lock Update bit in the CTRLB register is set to 0
(writing CTRLBCLR.LUPD to 1), double buffering is enabled: the data from the buffer registers will be copied into the corresponding register under the hardware UPDATE conditions, then the Buffer Valid flags bit in the STATUS register is automatically cleared by the hardware. Note:The software update command (CTRLBSET.CMD=0x3) acts independently of the LUPD value. A compare register is double buffered as in the following figure. Figure 41-9. Compare Channel Double Buffering Both the registers (PATT/PER/CCx) and corresponding Buffer registers are available in the I/O register map, and the double buffering feature is not mandatory. The double buffering is disabled by writing a 1 to CTRLSET.LUPD. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1071 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Note:In NFRQ, MFRQ or PWM Down-Counting Counter mode (CTRLBSET.DIR=1), when double buffering is enabled (CTRLBCLR.LUPD=1), the PERB register is continuously copied into the PER independently of the update conditions. Changing the Period The counter period can be changed by writing a new Top value to the Period register (PER or CC0, depending on the Waveform Generation mode). Any period update on the registers (PER or CCx) is effective after the synchronization delay, whatever double buffering enabling is. Figure 41-10. Unbuffered Single-Slope Up-Counting Operation Count Wraparound COUNT MAX ZERO New value written to PER that is higher than current COUNT New value written to PER that is lower than current COUNT Figure 41-11. Unbuffered Single-Slope Down-Counting Operation COUNT MAX ZERO
"clear" update
"write"
"reload" update
"write"
New value written to PER that is higher than current COUNT New value written to PER that is lower than current COUNT A counter wraparound can occur in any operation mode when up-counting without buffering (see Figure 41-10). COUNT and TOP are continuously compared, so when a new value that is lower than the current COUNT is written to TOP, COUNT will wrap before a compare match. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1072 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Figure 41-12. Unbuffered Dual-Slope Operation Count Wraparound COUNT MAX ZERO
"reload" update
"write"
New value written to PER that is higher than current COUNT New value written to PER that is lower than current COUNT When double buffering is used, the buffer can be written at any time and the counter will still maintain correct operation. The period register is always updated on the update condition, as shown in Figure 41-13. This prevents wraparound and the generation of odd waveforms. Figure 41-13. Changing the Period Using Buffering 41.6.2.7 Capture Operations To enable and use capture operations, the Match or Capture Channel x Event Input Enable bit in the Event Control register (EVCTRL.MCEIx) must be written to '1'. The capture channels to be used must also be enabled in the Capture Channel x Enable bit in the Control A register (CTRLA.CPTENx) before capturing can be performed. Event Capture Action The compare/capture channels can be used as input capture channels to capture events from the Event System, and give them a timestamp. The following figure shows four capture events for one capture channel. Event system channels must be configured to operate in asynchronous mode when used for capture operations. Figure 41-14. Input Capture Timing events MAX ZERO COUNT Capture 0 Capture 1 Capture 2 Capture 3 For input capture, the Buffer register and the corresponding CCx act like a FIFO. When CCx is empty or read, any content in CCBx is transferred to CCx. The Buffer Valid flag is passed to set the CCx Interrupt flag (IF) and generate the optional interrupt, event, or DMA request. The CCBx register value cannot be read, all captured data must be read from the CCx register. Figure 41-15. Capture Double Buffering The TCC can detect capture overflow of the input capture channels. When a new capture event is detected while the Capture Buffer Valid flag (STATUS.CCBV) is still set, the new timestamp will not be stored and INTFLAG.ERR will be set. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1073 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Period and Pulse-Width (PPW) Capture Action The TCC can perform two input captures and restart the counter on one of the edges. This enables the TCC to measure the pulse-width and period and to characterize the frequency f and dutyCycle of an input signal, as shown below:
tp T Period (T)
"capture"
dutyCycle =
f =
Figure 41-16. PWP Capture
, 1 T external signal /event capture times COUNT MAX ZERO CC0 CC1 CC0 CC1 Selecting PWP or PPW in the Timer/Counter Event Input 1 Action bit group in the Event Control register
(EVCTRL.EVACT1) enables the TCC to perform one capture action on the rising edge and the other one on the falling edge. When using PPW event action, period T will be captured into CC0 and the pulse-width tp into CC1. The PWP (Pulse-width and Period) event action offers the same functionality, but T will be captured into CC1 and tp into CC0. The Timer/Counter Event x Invert Enable bit in Event Control register (EVCTRL.TCEINVx) is used for event source x to select whether the wraparound must occur on the rising edge or the falling edge. If EVCTRL.TCEINVx=1, the wraparound will happen on the falling edge. The corresponding capture is done only if the channel is enabled in Capture mode (CTRLA.CPTENx=1). If not, the capture action will be ignored and the channel will be enabled in compare mode of operation. When only one of these channel is required, the other channel can be used for other purposes. The TCC can detect capture overflow of the input capture channels. When a new capture event is detected while the INTFLAG.MCx is still set, the new timestamp will not be stored and INTFLAG.ERR will be set. Note:When up-counting (CTRLBSET.DIR=0), counter values lower than 1 cannot be captured in Capture Minimum mode (FCTRLn.CAPTURE=CAPTMIN). To capture the full range including value 0, the TCC must be configured in Down-counting mode (CTRLBSET.DIR=0). Note:In dual-slope PWM operation, and when TOP is lower than MAX/2, the CCx MSB captures the CTRLB.DIR state to identify the ramp on which the capture has been done. For rising ramps CCx[MSB] is zero, for falling ramps CCx[MSB]=1. 41.6.3 Additional Features 41.6.3.1 One-Shot Operation When one-shot is enabled, the counter automatically stops on the next Counter Overflow or Underflow condition. When the counter is stopped, the Stop bit in the Status register (STATUS.STOP) is set and the waveform outputs are set to the value defined by DRVCTRL.NREx and DRVCTRL.NRVx. One-shot operation can be enabled by writing a '1' to the One-Shot bit in the Control B Set register
(CTRLBSET.ONESHOT) and disabled by writing a '1' to CTRLBCLR.ONESHOT. When enabled, the TCC will count until an overflow or underflow occurs and stop counting. The one-shot operation can be restarted by a re-trigger 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1074 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) software command, a re-trigger event or a start event. When the counter restarts its operation, STATUS.STOP is automatically cleared. 41.6.3.2 Circular Buffer The Period register (PER) and the Compare Channels register (CC0 to) support circular buffer operation. When circular buffer operation is enabled, the PER or CCx values are copied into the corresponding buffer registers at each update condition. Circular buffering is dedicated to RAMP2, RAMP2A, and DSBOTH operations. Figure 41-17. Circular Buffer on Channel 0 41.6.3.3 Dithering Operation The TCC supports dithering on Pulse-width or Period on a 16, 32 or 64 PWM cycles frame. Dithering consists in adding some extra clocks cycles in a frame of several PWM cycles, and can improve the accuracy of the average output pulse width and period. The extra clock cycles are added on some of the compare match signals, one at a time, through a "blue noise" process that minimizes the flickering on the resulting dither patterns. Dithering is enabled by writing the corresponding configuration in the Enhanced Resolution bits in CTRLA register
(CTRLA.RESOLUTION):
DITH4 enable dithering every 16 PWM frames DITH5 enable dithering every 32 PWM frames DITH6 enable dithering every 64 PWM frames The DITHERCY bits of COUNT, PER and CCx define the number of extra cycles to add into the frame (DITHERCY bits from the respective COUNT, PER or CCx registers). The remaining bits of COUNT, PER, CCx define the compare value itself. The pseudo code, giving the extra cycles insertion regarding the cycle is:
int extra_cycle(resolution, dithercy, cycle){
int MASK;
int value switch (resolution){
DITH4: MASK = 0x0f;
DITH5: MASK = 0x1f;
DITH6: MASK = 0x3f;
value = cycle * dithercy;
if (((MASK & value) + dithercy) > MASK) return 1;
return 0;
Dithering on Period Writing DITHERCY in PER will lead to an average PWM period configured by the following formulas. DITH4 mode:
PwmPeriod =
Note:If DITH4 mode is enabled, the last 4 significant bits from PER/CCx or COUNT register correspond to the DITHERCY value, rest of the bits corresponds to PER/CCx or COUNT value.
+ PER DITHERCY 16 1 fGCLK_TCCx DITH5 mode:
PwmPeriod =
DITH6 mode:
DITHERCY 32
+ PER 1 fGCLK_TCCx DITHERCY PwmPeriod =
Dithering on Pulse-Width 64
+ PER 1 fGCLK_TCCx 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1075 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Writing DITHERCY in CCx will lead to an average PWM pulse width configured by the following formula. DITH4 mode:
PwmPulseWidt =
DITH5 mode:
DITHERCY 16
+ CCx 1 fGCLK_TCCx PwmPulseWidt =
DITH6 mode:
DITHERCY 32
+ CCx 1 fGCLK_TCCx DITHERCY PwmPulseWidt =
Note:The PWM period will remain static in this case. 64 1 fGCLK_TCCx
+ CCx 41.6.3.4 Ramp Operations Three ramp operation modes are supported. All of them require the timer/counter running in single-slope PWM generation. The Ramp mode is selected by writing to the Ramp Mode bits in the Waveform Control register
(WAVE.RAMP). RAMP1 Operation This is the default PWM operation. RAMP2 Operation These operation modes are dedicated for power factor correction (PFC), Half-Bridge and Push-Pull SMPS topologies, where two consecutive timer/counter cycles are interleaved (see the following figure). In cycle A, odd channel output is disabled, and in cycle B, even channel output is disabled. The ramp index changes after each update, but can be software modified using the Ramp index command bits in the Control B Set register
(CTRLBSET.IDXCMD). Standard RAMP2 (RAMP2) Operation Ramp A and B periods are controlled by the PER register value. The PER value can be different on each ramp by the Circular Period buffer option in the Wave register (WAVE.CIPEREN=1). This mode uses a two-channel TCC to generate two output signals, or one output signal with another CC channel enabled in Capture mode. Figure 41-18. RAMP2 Standard Operation Ramp A B A B TOP(A) TOP(B) Retrigger on FaultA TOP(B) COUNT CC0 CC1 CC1 CC0
"clear" update
"match"
CIPEREN = 1 ZERO WO[0]
WO[1]
FaultA input FaultB input POL0 = 1 Keep on FaultB POL1 = 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1076 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Alternate RAMP2 (RAMP2A) Operation Alternate RAMP2 operation is similar to RAMP2, but CC0 controls both WO[0] and WO[1] waveforms when the corresponding circular buffer option is enabled (CIPEREN=1). The waveform polarity is the same on both outputs. Channel 1 can be used in capture mode. Figure 41-19. RAMP2 Alternate Operation Ramp A B A B COUNT TOP(A) TOP(B) Retrigger on FaultA TOP(B) CC0(B) CC0(B) CC0(A) CC0(A)
"clear" update
"match"
CIPEREN = 1 CICCEN0 = 1 ZERO WO[0]
WO[1]
FaultA input FaultB input Keep on FaultB POL0 = 1 41.6.3.5 Recoverable Faults Recoverable faults can restart or halt the timer/counter. Two faults, called Fault A and Fault B, can trigger recoverable fault actions on the compare channels CC0 and CC1 of the TCC. The compare channels' outputs can be clamped to inactive state either as long as the fault condition is present, or from the first valid fault condition detection on until the end of the timer/counter cycle. Fault Inputs The first two channel input events (TCCxMC0 and TCCxMC1) can be used as Fault A and Fault B inputs, respectively. Event system channels connected to these fault inputs must be configured as asynchronous. The TCC must work in a PWM mode. Fault Filtering There are three filters available for each input Fault A and Fault B. They are configured by the corresponding Recoverable Fault n Configuration registers (FCTRLA and FCTRLB). The three filters can either be used independently or in any combination. Input Filtering Fault Blanking By default, the event detection is asynchronous. When the event occurs, the fault system will immediately and asynchronously perform the selected fault action on the compare channel output, also in device power modes where the clock is not available. To avoid false fault detection on external events (e.g. due to a glitch on an I/O port) a digital filter can be enabled and configured by the Fault B Filter Value bits in the Fault n Configuration registers (FCTRLn.FILTERVAL). If the event width is less than FILTERVAL (in clock cycles), the event will be discarded. A valid event will be delayed by FILTERVAL clock cycles. This ignores any fault input for a certain time just after a selected waveform output edge. This can be used to prevent false fault triggering due to signal bouncing, as shown in the figure below. Blanking can be enabled by writing an edge triggering configuration to the Fault n Blanking Mode bits in the Recoverable Fault n Configuration register (FCTRLn.BLANK). The desired duration of the blanking must be written to the Fault n Blanking Time bits (FCTRLn.BLANKVAL). The blanking time tbis calculated by tb =
1 + BLANKVAL fGCLK_TCCx_PRESC 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1077 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Here, fGCLK_TCCx_PRESC is the frequency of the prescaled peripheral clock frequency fGCLK_TCCx. The maximum blanking time (FCTRLn.BLANKVAL=
255) at fGCLK_TCCx=96MHz is 2.67s (no prescaler) or 170s (prescaling). For fGCLK_TCCx=1MHz, the maximum blanking time is either 170s (no prescaling) or 10.9ms (prescaling enabled). Figure 41-20. Fault Blanking in RAMP1 Operation with Inverted Polarity COUNT TOP CC0 ZERO CMP0
"clear" update
"match"
"Fault input enabled"
"Fault input disabled"
x
"Fault discarded"
FCTRLA.BLANKVAL = 0 FCTRLA.BLANKVAL > 0 FCTRLA.BLANKVAL > 0 FaultA Blanking
x
x x x FaultA Input WO[0]
Fault Qualification This is enabled by writing a '1' to the Fault n Qualification bit in the Recoverable Fault n Configuration register (FCTRLn.QUAL). When the recoverable fault qualification is enabled
(FCTRLn.QUAL=1), the fault input is disabled all the time the corresponding channel output has an inactive level, as shown in the figures below. Figure 41-21. Fault Qualification in RAMP1 Operation COUNT MAX TOP CC0 CC1 ZERO
"clear" update
"match"
"Fault input enabled"
"Fault input disabled"
x
"Fault discarded"
Fault A Input Qual
x x x
x x x x x x Fault Input A Fault B Input Qual
x x x
x x x x x
x x x x x x x
x x x x
Fault Input B 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1078 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Figure 41-22. Fault Qualification in RAMP2 Operation with Inverted Polarity COUNT Cycle MAX TOP CC0 CC1 ZERO
"clear" update
"match"
"Fault input enabled"
"Fault input disabled"
x
"Fault discarded"
Fault A Input Qual
x x x
x x x x x x x x x Fault Input A Fault B Input Qual
x x x x x
x x x x x x x x x x
Fault Input B Fault Actions Different fault actions can be configured individually for Fault A and Fault B. Most fault actions are not mutually exclusive; hence two or more actions can be enabled at the same time to achieve a result that is a combination of fault actions. Keep Action This is enabled by writing the Fault n Keeper bit in the Recoverable Fault n Configuration register
(FCTRLn.KEEP) to '1'. When enabled, the corresponding channel output will be clamped to zero as long as the fault condition is present. The clamp will be released on the start of the first cycle after the fault condition is no longer present, see next Figure. Figure 41-23. Waveform Generation with Fault Qualification and Keep Action MAX TOP COUNT CC0 ZERO
"clear" update
"match"
"Fault input enabled"
"Fault input disabled"
x
"Fault discarded"
Fault A Input Qual
x x x
x Fault Input A WO[0]
KEEP KEEP Restart Action This is enabled by writing the Fault n Restart bit in Recoverable Fault n Configuration register
(FCTRLn.RESTART) to '1'. When enabled, the timer/counter will be restarted as soon as the corresponding fault condition is present. The ongoing cycle is stopped and the timer/counter starts a new cycle, see Figure 41-24. In Ramp 1 mode, when the new cycle starts, the compare outputs will be clamped to inactive level as long as the fault condition is present. Note:For RAMP2 operation, when a new timer/counter cycle starts the cycle index will change automatically, see Figure 41-25. Fault A and Fault B are qualified only during the cycle A and cycle B respectively: Fault A is disabled during cycle B, and Fault B is disabled during cycle A. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1079 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Figure 41-24. Waveform Generation in RAMP1 mode with Restart Action COUNT MAX TOP CC0 CC1 ZERO Fault Input A WO[0]
WO[1]
"clear" update
"match"
Restart Restart Figure 41-25. Waveform Generation in RAMP2 mode with Restart Action Cycle MAX TOP CC0/CC1 ZERO COUNT Fault Input A WO[0]
WO[1]
CCx=ZERO CCx=TOP
"clear" update
"match"
No fault A action in cycle B Restart Capture Action Several capture actions can be selected by writing the Fault n Capture Action bits in the Fault n Control register (FCTRLn.CAPTURE). When one of the capture operations is selected, the counter value is captured when the fault occurs. These capture operations are available:
CAPT - the equivalent to a standard capture operation. CAPTMIN - gets the minimum time stamped value: on each new local minimum captured value, an event or interrupt is issued. CAPTMAX - gets the maximum time stamped value: on each new local maximum captured value, an event or interrupt (IT) is issued, see Figure 41-26. LOCMIN - notifies by event or interrupt when a local minimum captured value is detected. LOCMAX - notifies by event or interrupt when a local maximum captured value is detected. DERIV0 - notifies by event or interrupt when a local extreme captured value is detected, see Figure 41-27. CCx Content:
In CAPTMIN and CAPTMAX operations, CCx keeps the respective extremum captured values, see Figure 41-26. In LOCMIN, LOCMAX or DERIV0 operation, CCx follows the counter value at fault time, see Figure 41-27. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1080 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Before enabling CAPTMIN or CAPTMAX mode of capture, the user must initialize the corresponding CCx register value to a value different from zero (for CAPTMIN) top (for CAPTMAX). If the CCx register initial value is zero (for CAPTMIN) top (for CAPTMAX), no captures will be performed using the corresponding channel. MCx Behaviour:
In LOCMIN and LOCMAX operation, capture is performed on each capture event. The MCx interrupt flag is set only when the captured value is above or equal (for LOCMIN) or below or equal (for LOCMAX) to the previous captured value. So interrupt flag is set when a new relative local Minimum
(for CAPTMIN) or Maximum (for CAPTMAX) value has been detected. DERIV0 is equivalent to an OR function of (LOCMIN, LOCMAX). In CAPT operation, capture is performed on each capture event. The MCx interrupt flag is set on each new capture. In CAPTMIN and CAPTMAX operation, capture is performed only when on capture event time, the counter value is lower (for CAPTMIN) or higher (for CAPMAX) than the last captured value. The MCx interrupt flag is set only when on capture event time, the counter value is higher or equal (for CAPTMIN) or lower or equal (for CAPTMAX) to the value captured on the previous event. So interrupt flag is set when a new absolute local Minimum (for CAPTMIN) or Maximum (for CAPTMAX) value has been detected. Interrupt Generation In CAPT mode, an interrupt is generated on each filtered Fault n and each dedicated CCx channel capture counter value. In other modes, an interrupt is only generated on an extreme captured value. Figure 41-26. Capture Action CAPTMAX COUNT TOP CC0 ZERO FaultA Input CC0 Event/
Interrupt Figure 41-27. Capture Action DERIV0 COUNT TOP CC0 ZERO WO[0]
FaultA Input CC0 Event/
Interrupt
"clear" update
"update"
"match"
Hardware Halt Action This is configured by writing 0x1 to the Fault n Halt mode bits in the Recoverable Fault n Configuration register (FCTRLn.HALT). When enabled, the timer/counter is halted and the cycle is extended as long as the corresponding fault is present. The next figure ('Waveform Generation with Halt and Restart Actions') shows an example where both restart action and hardware halt action are enabled for Fault A. The compare channel 0 output 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1081 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) is clamped to inactive level as long as the timer/counter is halted. The timer/counter resumes the counting operation as soon as the fault condition is no longer present. As the restart action is enabled in this example, the timer/counter is restarted after the fault condition is no longer present. The figure after that ('Waveform Generation with Fault Qualification, Halt, and Restart Actions') shows a similar example, but with additionally enabled fault qualification. Here, counting is resumed after the fault condition is no longer present. Note that in RAMP2 and RAMP2A operations, when a new timer/counter cycle starts, the cycle index will automatically change. Figure 41-28. Waveform Generation with Halt and Restart Actions COUNT MAX TOP CC0 ZERO Fault Input A WO[0]
"clear" update
"match"
HALT Restart Restart Figure 41-29. Waveform Generation with Fault Qualification, Halt, and Restart Actions MAX TOP COUNT CC0 ZERO HALT Resume
"update"
"match"
Fault A Input Qual
x x x
Fault Input A WO[0]
KEEP Software Halt Action This is configured by writing 0x2 to the Fault n Halt mode bits in the Recoverable Fault n configuration register (FCTRLn.HALT). Software halt action is similar to hardware halt action, but in order to restart the timer/counter, the corresponding fault condition must not be present anymore, and the corresponding FAULT n bit in the STATUS register must be cleared by software. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1082 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Figure 41-30. Waveform Generation with Software Halt, Fault Qualification, Keep and Restart Actions MAX TOP COUNT CC0 ZERO HALT
"update"
"match"
Fault A Input Qual
Restart Restart
x x
Fault Input A Software Clear WO[0]
KEEP NO KEEP FCTRLA.KEEP = 1 FCTRLA.KEEP = 0 41.6.3.6 Non-Recoverable Faults The non-recoverable fault action will force all the compare outputs to a pre-defined level programmed into the Driver Control register (DRVCTRL.NRE and DRVCTRL.NRV). The non-recoverable fault input (EV0 and EV1) actions are enabled in Event Control register (EVCTRL.EVACT0 and EVCTRL.EVACT1). To avoid false fault detection on external events (e.g. a glitch on an I/O port) a digital filter can be enabled using Non-Recoverable Fault Input x Filter Value bits in the Driver Control register (DRVCTRL.FILTERVALn). Therefore, the event detection is synchronous, and event action is delayed by the selected digital filter value clock cycles. When the Fault Detection on Debug Break Detection bit in Debug Control register (DGBCTRL.FDDBD) is written to '1', a non-recoverable Debug Faults State and an interrupt (DFS) is generated when the system goes in debug operation. 41.6.3.7 Waveform Extension Waveform Extension Stage Details displays the schematic diagram of actions of the four optional units that follow the recoverable fault stage on a port pin pair: Output Matrix (OTMX), Dead-Time Insertion (DTI), SWAP and Pattern Generation. The DTI and SWAP units can be seen as a four port pair slices:
Slice 0 DTI0 / SWAP0 acting on port pins (WO[0], WO[WO_NUM/2 +0]) Slice 1 DTI1 / SWAP1 acting on port pins (WO[1], WO[WO_NUM/2 +1]) And generally:
Slice n DTIx / SWAPx acting on port pins (WO[x], WO[WO_NUM/2 +x]) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1083 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Figure 41-31. Waveform Extension Stage Details OTMX WEX DTI PORTS SWAP PATTERN OTMX[x+WO_NUM/2]
PGV[x+WO_NUM/2]
LS PGO[x+WO_NUM/2]
INV[x+WO_NUM/2]
WO[x+WO_NUM/2]
OTMX DTIx DTIxEN HS OTMX[x]
SWAPx PGO[x]
PGV[x]
INV[x]
WO[x]
The output matrix (OTMX) unit distributes compare channels, according to the selectable configurations in the following table. Table 41-6. Output Matrix Channel Pin Routing Configuration WEXCTRL.OTMX OTMX[7] OTMX[6] OTMX[5] OTMX[4] OTMX[3] OTMX[2] OTMX[1] OTMX[0]
0x0 0x1 0x2 0x3 CC1 CC1 CC0 CC1 CC0 CC0 CC0 CC1 CC5 CC2 CC0 CC1 CC4 CC1 CC0 CC1 CC3 CC0 CC0 CC1 CC2 CC2 CC0 CC1 CC1 CC1 CC0 CC1 CC0 CC0 CC0 CC0 Configuration 0x0 is the default configuration. The channel location is the default one and channels are distributed on outputs modulo the number of channels. Channel 0 is routed to the Output matrix output OTMX[0], and Channel 1 to OTMX[1]. If there are more outputs than channels, then channel 0 is duplicated to the Output matrix output OTMX[CC_NUM], channel 1 to OTMX[CC_NUM+1] and so on. Configuration 0x1 distributes the channels on output modulo half the number of channels. This assigns twice the number of output locations to the lower channels than the default configuration. This can be used, for example, to control the four transistors of a full bridge using only two compare channels. Using pattern generation, some of these four outputs can be overwritten by a constant level, enabling flexible drive of a full bridge in all quadrant configurations. Configuration 0x2 distributes compare channel 0 (CC0) to all port pins. With pattern generation, this configuration can control a stepper motor. Configuration 0x3 distributes the compare channel CC0 to the first output, and the channel CC1 to all other outputs. Together with pattern generation and the fault extension, this configuration can control up to seven LED strings, with a boost stage. The table below is an example showing four compare channels on four outputs. Table 41-7. Four Compare Channels on Four Outputs WEXCTRL.OTMX OTMX[3]
OTMX[2]
OTMX[1]
OTMX[0]
0x0 0x1 0x2 0x3 CC3 CC1 CC0 CC1 CC2 CC0 CC0 CC1 CC1 CC1 CC0 CC1 CC0 CC0 CC0 CC0 The dead-time insertion (DTI) unit generates OFF time with the non-inverted low side (LS) and inverted high side
(HS) of the wave generator output forced at low level. This OFF time is called dead time. Dead-time insertion ensures that the LS and HS will never switch simultaneously. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1084 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) The DTI stage consists of four equal dead-time insertion generators; one for each of the first four compare channels. The following figure shows the block diagram of one DTI generator. The four channels have a common register which controls the dead time, which is independent of high side and low side setting. Figure 41-32. Dead-Time Generator Block Diagram DTLS DTHS Dead Time Generator OTMX output D Q Edge Detect LOAD EN Counter
= 0
"DTLS"
(To PORT)
"DTHS"
(To PORT) As shown in the following figure, the 8-bit dead-time counter is decremented by one for each peripheral clock cycle until it reaches zero. A non-zero counter value will force both the low side and high side outputs into their OFF state. When the output matrix (OTMX) output changes, the dead-time counter is reloaded according to the edge of the input. When the output changes from low to high (positive edge) it initiates a counter reload of the DTLS register. When the output changes from high to low (negative edge) it reloads the DTHS register. Figure 41-33. Dead-Time Generator Timing Diagram
"dti_cnt"
"OTMX output"
"DTLS"
"DTHS"
tP tDTILS T tDTIHS The pattern generator unit produces a synchronized bit pattern across the port pins it is connected to. The pattern generation features are primarily intended for handling the commutation sequence in brushless DC motors (BLDC), stepper motors, and full bridge control. For more information, refer to the following figure. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1085 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Figure 41-34. Pattern Generator Block Diagram COUNT UPDATE BV PGEB[7:0]
BV PGVB[7:0]
SWAP output EN PGE[7:0]
EN PGV[7:0]
As with other double-buffered timer/counter registers, the register update is synchronized to the UPDATE condition set by the timer/counter waveform generation operation. If synchronization is not required by the application, the software can simply access directly the PATT.PGE, PATT.PGV bits registers. WOx[7:0]
41.6.4 DMA, Interrupts, and Events Table 41-8. Module Requests for TCC Condition Interrupt request Yes Yes Yes Yes Yes Yes Yes Yes Overflow / Underflow Channel Compare Match or Capture Retrigger Count Capture Overflow Error Debug Fault State Recoverable Faults Non-Recoverable Faults TCCx Event 0 input TCCx Event 1 input Notes:
Event input DMA DMA request is cleared request Yes(1) Yes(3) Yes(2) On DMA acknowledge For circular buffering: on DMA acknowledge For capture channel:
when CCx register is read Event output Yes Yes Yes Yes Yes(4) Yes(5) 1. DMA request set on Overflow, Underflow or Re-trigger conditions. 2. Can perform capture or generate recoverable fault on an event input. 3. 4. On event input, either action can be executed:
In Capture or Circular modes. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1086 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) re-trigger counter control counter direction stop the counter decrement the counter perform period and pulse width capture generate non-recoverable fault 5. On event input, either action can be executed:
re-trigger counter increment or decrement counter depending on direction start the counter increment or decrement counter based on direction increment counter regardless of direction generate non-recoverable fault 41.6.4.1 DMA Operation The TCC can generate the following DMA requests:
Counter overflow
(OVF) The TCC generates a DMA request on each cycle when an update condition (Overflow, Underflow or Re-trigger) is detected. In both cases, the request is cleared by hardware on DMA acknowledge. Channel Match
(MCx) A DMA request is set only on a compare match . The request is cleared by hardware on DMA acknowledge. Channel Capture
(MCx) For a capture channel, the request is set when valid data is present in the CCx register, and cleared once the CCx register is read. DMA Operation with Circular Buffer When circular buffer operation is enabled, the Buffer registers must be written in a correct order and synchronized to the update times of the timer. The DMA triggers of the TCC provide a way to ensure a safe and correct update of circular buffers. Note:Circular buffer are intended to be used with RAMP2, RAMP2A and DSBOTH operation only. DMA Operation with Circular Buffer in RAMP2 and RAMP2A Mode When a CCx channel is selected as a circular buffer, the related DMA request is not set on a compare match detection, but on start of ramp B. If at least one circular buffer is enabled, the DMA overflow request is conditioned to the start of ramp A with an effective DMA transfer on previous ramp B (DMA acknowledge). The update of all circular buffer values for ramp A can be done through a DMA channel triggered on a MC trigger. The update of all circular buffer values for ramp B, can be done through a second DMA channel triggered by the overflow DMA request. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1087 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Figure 41-35. DMA Triggers in RAMP and RAMP2 Operation Mode and Circular Buffer Enabled Ramp A B A B A B Cycle N-2 N-1 N COUNT ZERO STATUS.IDX DMA_CCx_req DMA_OVF_req
"update"
DMA Channel i Update ramp A DMA Channel j Update ramp B DMA Operation with Circular Buffer in DSBOTH Mode When a CC channel is selected as a circular buffer, the related DMA request is not set on a compare match detection, but on start of down-counting phase. If at least one circular buffer is enabled, the DMA overflow request is conditioned to the start of up-counting phase with an effective DMA transfer on previous down-counting phase (DMA acknowledge). When up-counting, all circular buffer values can be updated through a DMA channel triggered by MC trigger. When down-counting, all circular buffer values can be updated through a second DMA channel, triggered by the OVF DMA request. Figure 41-36. DMA Triggers in DSBOTH Operation Mode and Circular Buffer Enabled Cycle N-2 N-1 N Old Parameter Set New Parameter Set COUNT ZERO CTRLB.DIR DMA_CCx_req DMA_OVF_req
"update"
DMA Channel i Update Rising DMA Channel j Update Rising 41.6.4.2 Interrupts The TCC has the following interrupt sources:
Overflow/Underflow (OVF) Retrigger (TRG) Count (CNT) Refer also to the description of EVCTRL.CNTSEL Capture Overflow Error (ERR) Debug Fault State (DFS) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1088 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Recoverable Faults (FAULTn) Non-recoverable Faults (FAULTx) Compare Match or Capture Channels (MCx) These interrupts are asynchronous wake-up sources. Each interrupt source has an Interrupt flag associated with it. The Interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the Interrupt condition occurs. Each interrupt can be individually enabled by writing a 1 to the corresponding bit in the Interrupt Enable Set (INTENSET) register, and disabled by writing a 1 to the corresponding bit in the Interrupt Enable Clear (INTENCLR) register. The status of enabled interrupts can be read from either INTENSET or INTENCLR. An interrupt request is generated when the Interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the Interrupt flag is cleared, the interrupt is disabled or the TCC is reset. See INTFLAG from Related Links for details on how to clear Interrupt flags. The TCC has one common interrupt request line for all the interrupt sources. The user must read the INTFLAG register to determine which Interrupt condition is present. Interrupts must be globally enabled for interrupt requests to be generated. See Nested Vector Interrupt Controller
(NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 41.8.12. INTFLAG 41.6.4.3 Events The TCC can generate the following output events:
Overflow/Underflow (OVF) Trigger (TRG) Counter (CNT) (For further details, refer to the EVCTRL.CNTSEL description.) Compare Match or Capture on compare/capture channels: MCx Writing a 1 (0) to an Event Output bit in the Event Control Register (EVCTRL.xxEO) enables (disables) the corresponding output event. See Event System (EVSYS) from Related Links. The TCC can take the following actions on a channel input event (MCx):
Capture event Generate a recoverable or non-recoverable fault The TCC can take the following actions on counter Event 1 (TCCx EV1):
Counter re-trigger Counter direction control Stop the counter Decrement the counter on event Period and pulse width capture Non-recoverable fault The TCC can take the following actions on counter Event 0 (TCCx EV0):
Counter re-trigger Count on event (increment or decrement, depending on counter direction) Counter start Start counting on the event rising edge. Further events will not restart the counter; the counter will keep counting using prescaled GCLK_TCCx, until it reaches TOP or ZERO, depending on the direction. Counter increment on event. This will increment the counter, irrespective of the counter direction. Count during active state of an asynchronous event (increment or decrement, depending on counter direction). In this case, the counter will be incremented or decremented on each cycle of the prescaled clock, as long as the event is active. Non-recoverable fault 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1089 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) The counter Event Actions are available in the Event Control registers (EVCTRL.EVACT0 and EVCTRL.EVACT1). See EVCTRL from Related Links. Writing a 1 (0) to an Event Input bit in the Event Control register (EVCTRL.MCEIx or EVCTRL.TCEIx) enables
(disables) the corresponding action on input event. Note:When several events are connected to the TCC, the enabled action will apply for each of the incoming events. See Event System (EVSYS) from Related Links for details on how to configure the Event System. Related Links 28. Event System (EVSYS) 41.8.9. EVCTRL 41.6.5 Sleep Mode Operation The TCC can be configured to operate in any Sleep mode. To be able to run in standby the RUNSTDBY bit in the Control A register (CTRLA.RUNSTDBY) must be '1'. The MODULE can in any Sleep mode wake-up the device using interrupts or perform actions through the Event System. 41.6.6 Synchronization Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be synchronized when written or read. The following bits are synchronized when written:
Software Reset and Enable bits in Control A register (CTRLA.SWRST and CTRLA.ENABLE) The following registers are synchronized when written:
Control B Clear and Control B Set registers (CTRLBCLR and CTRLBSET) Status register (STATUS) Pattern and Pattern Buffer registers (PATT and PATTB) Waveform register (WAVE) Count Value register (COUNT) Period Value and Period Buffer Value registers (PER and PERB) Compare/Capture Channel x and Channel x Compare/Capture Buffer Value registers (CCx and CCBx) The following registers are synchronized when read:
Control B Clear and Control B Set registers (CTRLBCLR and CTRLBSET) Count Value register (COUNT): synchronization is done on demand through READSYNC command
(CTRLBSET.CMD) Pattern and Pattern Buffer registers (PATT and PATTB) Waveform register (WAVE) Period Value and Period Buffer Value registers (PER and PERB) Compare/Capture Channel x and Channel x Compare/Capture Buffer Value registers (CCx and CCBx) Required write synchronization is denoted by the "Write-Synchronized" property in the register description. Required read synchronization is denoted by the "Read-Synchronized" property in the register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1090 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.7 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CTRLA 0x04 0x05 0x06
... 0x07 CTRLBCLR CTRLBSET Reserved 0x08 SYNCBUSY 0x0C FCTRLA 0x10 FCTRLB 0x14 WEXCTRL 0x18 DRVCTRL 0x1C
... 0x1D 0x1E 0x1F Reserved DBGCTRL Reserved 0x20 EVCTRL 0x24 INTENCLR 0x28 INTENSET 0x2C INTFLAG 0x30 STATUS 7:0 15:8 23:16 31:24 7:0 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 RESOLUTION[1:0]
ENABLE SWRST ALOCK PRESCSYNC[1:0]
RUNSTDBY PRESCALER[2:0]
MSYNC DMAOS CPTEN5 CPTEN4 CPTEN3 CPTEN2 CPTEN1 CPTEN0 CMD[2:0]
CMD[2:0]
IDXCMD[1:0]
IDXCMD[1:0]
ONESHOT ONESHOT LUPD LUPD DIR DIR PER WAVE PATT COUNT STATUS CTRLB ENABLE SWRST RESTART BLANKPRES C RESTART BLANKPRES C BLANK[1:0]
QUAL KEEP CAPTURE[2:0]
CHSEL[1:0]
BLANKVAL[7:0]
FILTERVAL[3:0]
BLANK[1:0]
QUAL KEEP CAPTURE[2:0]
CHSEL[1:0]
BLANKVAL[7:0]
SRC[1:0]
HALT[1:0]
SRC[1:0]
HALT[1:0]
FILTERVAL[3:0]
OTMX[1:0]
DTIEN3 DTIEN2 DTIEN1 DTIEN0 DTLS[7:0]
DTHS[7:0]
NRE7 NRV7 NRE6 NRV6 NRE5 NRV5 NRE4 NRV4 NRE3 NRV3 NRE2 NRV2 NRE1 NRV1 NRE0 NRV0 INVEN7 INVEN6 INVEN5 INVEN4 INVEN3 INVEN2 INVEN1 INVEN0 FILTERVAL1[3:0]
FILTERVAL0[3:0]
CNTSEL[1:0]
EVACT1[2:0]
EVACT0[2:0]
TCEI1 TCEI0 TCINV1 TCINV0 CNTEO TRGEO OVFEO FDDBD DBGRUN FAULT1 FAULT0 FAULTB FAULTA FAULT1 FAULT0 FAULTB FAULTA FAULT1 FAULT0 FAULTB FAULTA ERR DFS ERR DFS ERR DFS DFS CNT UFS CNT UFS CNT UFS TRG OVF TRG OVF TRG OVF IDX STOP PERBV FAULT1 FAULT0 PATTBV FAULTB FAULTA FAULT1IN FAULT0IN FAULTBIN FAULTAIN 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1091 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x34 COUNT 0x38 0x3A
... 0x3B PATT Reserved 0x3C WAVE 0x40 PER 0x44
... 0x63 0x64 0x66
... 0x6B Reserved PATTB Reserved 0x6C PERB 7:0 15:8 23:16 31:24 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 PGE7 PGV7 PGE6 PGV6 PGE5 PGV5 PGE4 PGV4 PGE3 PGV3 PGE2 PGV2 PGE1 PGV1 PGE0 PGV0 CIPEREN CICCEN3 CICCEN2 CICCEN1 CICCEN0 WAVEGEN[2:0]
SWAP3 SWAP2 SWAP1 SWAP0 DITHER[5:0]
7:0 15:8 PGEB7 PGVB7 PGEB6 PGVB6 PGEB5 PGVB5 PGEB4 PGVB4 PGEB3 PGVB3 PGEB2 PGVB2 PGEB1 PGVB1 PGEB0 PGVB0 7:0 15:8 23:16 31:24 DITHERB[5:0]
41.8 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers require synchronization when read and/or written. Synchronization is denoted by the Read-
Synchronized and/or Write-Synchronized property in each individual register description. Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. Some registers are enable-protected, meaning they can only be written when the module is disabled. Enable-
protection is denoted by the Enable-Protected property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1092 Access Reset Bit Access Reset Bit Access Reset 23 DMAOS R/W 0 15 MSYNC R/W 0 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized (ENABLE, SWRST) CTRLA 0x00 0x00000000 Bit 31 30 29 CPTEN5 R/W 0 28 CPTEN4 R/W 0 27 CPTEN3 R/W 0 26 CPTEN2 R/W 0 25 CPTEN1 R/W 0 24 CPTEN0 R/W 0 22 21 20 19 18 17 16 14 ALOCK R/W 0 12 13 PRESCSYNC[1:0]
R/W 0 R/W 0 4 Bit 7 Access Reset 6 5 RESOLUTION[1:0]
R/W R/W 0 0 11 RUNSTDBY R/W 0 3 10 R/W 0 2 9 PRESCALER[2:0]
R/W 0 8 R/W 0 1 ENABLE R/W 0 0 SWRST R/W 0 Bits 24, 25, 26, 27, 28, 29 CPTENxCapture Channel x Enable These bits are used to select the capture or compare operation on channel x. Writing a '1' to CPTENx enables capture on channel x. Writing a '0' to CPTENx disables capture on channel x. Bit 23 DMAOSDMA One-Shot Trigger Mode This bit enables the DMA One-shot Trigger Mode. Writing a '1' to this bit will generate a DMA trigger on TCC cycle following a TCC_CTRLBSET_CMD_DMAOS command. Writing a '0' to this bit will generate DMA triggers on each TCC cycle. This bit is not synchronized. Bit 15 MSYNCHost Synchronization (only for TCC Client instance) This bit must be set if the TCC counting operation must be synchronized on its Host TCC. This bit is not synchronized. Value 0 1 Description The TCC controls its own counter. The counter is controlled by its Host TCC. Bit 14 ALOCKAuto Lock This bit is not synchronized. Value 0 Description The Lock Update bit in the Control B register (CTRLB.LUPD) is not affected by overflow/underflow, and re-trigger events CTRLB.LUPD is set to '1' on each overflow/underflow or re-trigger event. 1 Bits 13:12 PRESCSYNC[1:0]Prescaler and Counter Synchronization These bits select if on re-trigger event, the Counter is cleared or reloaded on either the next GCLK_TCCx clock, or on the next prescaled GCLK_TCCx clock. It is also possible to reset the prescaler on re-trigger event. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1093 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) These bits are not synchronized. Value Name Description 0x0 0x1 0x2 0x3 GCLK PRESC RESYNC Reserved Counter Reloaded Prescaler Reload or reset Counter on next GCLK Reload or reset Counter on next prescaler clock Reload or reset Counter on next GCLK Reset prescaler counter
Bit 11 RUNSTDBYRun in Standby This bit is used to keep the TCC running in Standby mode. This bit is not synchronized. Value 0 1 Description The TCC is halted in standby. The TCC continues to run in standby. Bits 10:8 PRESCALER[2:0]Prescaler These bits select the Counter prescaler factor. These bits are not synchronized. Name Value DIV1 0x0 DIV2 0x1 DIV4 0x2 DIV8 0x3 DIV16 0x4 DIV64 0x5 DIV256 0x6 DIV1024 0x7 Description Prescaler: GCLK_TCCx Prescaler: GCLK_TCCx/2 Prescaler: GCLK_TCCx/4 Prescaler: GCLK_TCCx/8 Prescaler: GCLK_TCCx/16 Prescaler: GCLK_TCCx/64 Prescaler: GCLK_TCCx/256 Prescaler: GCLK_TCCx/1024 Bits 6:5 RESOLUTION[1:0]Dithering Resolution These bits increase the TCC resolution by enabling the dithering options. These bits are not synchronized. Table 41-9. Dithering Value 0x0 0x1 0x2 0x3 Name NONE DITH4 DITH5 DITH6 Description The dithering is disabled. Dithering is done every 16 PWM frames. PER[3:0] and CCx[3:0] contain dithering pattern selection. Dithering is done every 32 PWM frames. PER[4:0] and CCx[4:0] contain dithering pattern selection. Dithering is done every 64 PWM frames. PER[5:0] and CCx[5:0] contain dithering pattern selection. Bit 1 ENABLEEnable Due to synchronization there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRLA.ENABLE will read back immediately and the ENABLE bit in the SYNCBUSY register
(SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete. Value 0 1 Description The peripheral is disabled. The peripheral is enabled. Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets all registers in the TCC (except DBGCTRL) to their initial state, and the TCC will be disabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1094 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Writing a '1' to CTRLA.SWRST will always take precedence; all other writes in the same write-operation will be discarded. Notes:
1. When the CTRLA.SWRST is written, the user must poll the SYNCBUSY.SWRST bit to know when the reset operation is complete. 2. During a SWRST, access to registers or bits without SWRST are disallowed until the SYNCBUSY.SWRST bit is cleared by hardware. Value 0 1 Description There is no Reset operation ongoing. The Reset operation is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1095 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.2 Control B Clear Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized, Read-Synchronized CTRLBCLR 0x04 0x00 This register allows the user to change this register without doing a read-modify-write operation. Changes in this register will also be reflected in the Control B Set (CTRLBSET) register. Bit 7 Access Reset R/W 0 6 CMD[2:0]
R/W 0 5 R/W 0 4 3 IDXCMD[1:0]
R/W 0 R/W 0 2 ONESHOT R/W 0 1 LUPD R/W 0 0 DIR R/W 0 Bits 7:5 CMD[2:0]TCC Command Writing a 0 to these bits has no effect. Writing a '1' to any of these bits will clear the pending command. Bits 4:3 IDXCMD[1:0]Ramp Index Command These bits can be used to force cycle A and cycle B changes in RAMP2 and RAMP2A operation. On timer/counter update condition, the command is executed, the IDX flag in STATUS register is updated and the IDXCMD command is cleared. Writing zero to these bits has no effect. Writing a '1' to any of these bits will clear the pending command. Value 0x0 0x1 0x2 0x3 Description DISABLE Command disabled: IDX toggles between cycles A and B Set IDX: cycle B will be forced in the next cycle Clear IDX: cycle A will be forced in next cycle Hold IDX: the next cycle will be the same as the current cycle. Name DISABLE SET CLEAR HOLD Bit 2 ONESHOTOne-Shot This bit controls one-shot operation of the TCC. When one-shot operation is enabled, the TCC will stop counting on the next overflow/underflow condition or on a stop command. Writing a '0' to this bit has no effect Writing a '1' to this bit will disable the one-shot operation. Value 0 1 Description The TCC will update the counter value on overflow/underflow condition and continue operation. The TCC will stop counting on the next underflow/overflow condition. Bit 1 LUPDLock Update This bit controls the update operation of the TCC buffered registers. When CTRLB.LUPD is cleared, the hardware UPDATE registers with value from their buffered registers is enabled. This bit has no effect when input capture operation is enabled. Writing a '0' to this bit has no effect. Writing a '1' to this bit will enable the registers updates on hardware UPDATE condition. Value 0 Description The CCBx, PERB, PGVB, and PGEB buffer registers values are copied into the corresponding CCx, PER, PGV, and PGE registers on hardware update condition. The CCBx, PERB, PGVB, and PGEB buffer registers values are not copied into the corresponding CCx, PER, PGV, and PGE registers on hardware update condition. 1 Bit 0 DIRCounter Direction This bit is used to change the direction of the counter. Writing a '0' to this bit has no effect Writing a '1' to this bit will clear the bit and make the counter count up. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1096 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Value 0 1 Description The timer/counter is counting up (incrementing). The timer/counter is counting down (decrementing). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1097 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.3 Control B Set Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized, Read-Synchronized CTRLBSET 0x05 0x00 This register allows the user to change this register without doing a read-modify-write operation. Changes in this register will also be reflected in the Control B Set (CTRLBCLR) register. Bit 7 Access Reset R/W 0 6 CMD[2:0]
R/W 0 5 R/W 0 4 3 IDXCMD[1:0]
R/W 0 R/W 0 2 ONESHOT R/W 0 1 LUPD R/W 0 0 DIR R/W 0 Bits 7:5 CMD[2:0]TCC Command These bits can be used for software control of re-triggering and stop commands of the TCC. When a command has been executed, the CMD bit field will be read back as zero. The commands are executed on the next prescaled GCLK_TCCx clock cycle. Writing zero to this bit group has no effect Writing a value different from 0x0 to this bit field will issue a command for execution. Important:This command requires synchronization before being executed. A valid sequence is the following:
Issue CMD command (CTRLBSET.CMD = command) Wait for CMD synchronization (SYNCBUSY.CTRLB = 0) Wait for CMD read back as zero (CTRLBSET.CMD = 0) Value 0x0 0x1 0x2 0x3 0x4 0x5 Name NONE RETRIGGER STOP UPDATE READSYNC DMAOS Description No action Force start, restart or retrigger Force stop Force update of double buffered registers Force a read synchronization of COUNT One-shot DMA trigger Bits 4:3 IDXCMD[1:0]Ramp Index Command These bits can be used to force cycle A and cycle B changes in RAMP2 and RAMP2A operation. On timer/counter update condition, the command is executed, the IDX flag in STATUS register is updated and the IDXCMD command is cleared. Writing a zero to these bits has no effect. Writing a valid value to these bits will set a command. Value 0x0 0x1 0x2 0x3 Description Command disabled: IDX toggles between cycles A and B Set IDX: cycle B will be forced in the next cycle Clear IDX: cycle A will be forced in next cycle Hold IDX: the next cycle will be the same as the current cycle. Name DISABLE SET CLEAR HOLD Bit 2 ONESHOTOne-Shot This bit controls one-shot operation of the TCC. When in one-shot operation, the TCC will stop counting on the next overflow/underflow condition or a stop command. Writing a '0' to this bit has no effect. Writing a '1' to this bit will enable the one-shot operation. Value 0 Description The TCC will count continuously. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1098 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Value 1 Description The TCC will stop counting on the next underflow/overflow condition. Bit 1 LUPDLock Update This bit controls the update operation of the TCC buffered registers. When CTRLB.LUPD is set, the hardware UPDATE registers with value from their buffered registers is disabled. Disabling the update ensures that all buffer registers are valid before an hardware update is performed. After all the buffer registers are loaded correctly, the buffered registers can be unlocked. This bit has no effect when input capture operation is enabled. Writing a '0' to this bit has no effect. Writing a '1' to this bit will disable the registers updates on hardware UPDATE condition. Value 0 Description The CCBx, PERB, PGVB, and PGEB buffer registers values are copied into the corresponding CCx, PER, PGV, and PGE registers on hardware update condition. The CCBx, PERB, PGVB, and PGEB buffer registers values are not copied into CCx, PER, PGV, and PGE registers on hardware update condition. 1 Bit 0 DIRCounter Direction This bit is used to change the direction of the counter. Writing a '0' to this bit has no effect Writing a '1' to this bit will set the bit and make the counter count down. Note:When the TCC is counting down, the COUNT register must be initialized to the TOP value (PER or CC0 value depending on the mode). Value 0 1 Description The timer/counter is counting up (incrementing). The timer/counter is counting down (decrementing). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1099 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.4 Synchronization Busy Name:
Offset:
Reset:
Property:
SYNCBUSY 0x08 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit Access Reset 7 PER R 0 6 WAVE R 0 5 PATT R 0 4 COUNT R 0 3 STATUS R 0 2 CTRLB R 0 1 ENABLE R 0 0 SWRST R 0 Bit 7 PERPER Synchronization Busy This bit is cleared when the synchronization of the PER register between the clock domains is complete. This bit is set when the synchronization of the PER register between clock domains is started. Bit 6 WAVEWAVE Synchronization Busy This bit is cleared when the synchronization of the WAVE register between the clock domains is complete. This bit is set when the synchronization of the WAVE register between clock domains is started. Bit 5 PATTPATT Synchronization Busy This bit is cleared when the synchronization of the PATTERN register between the clock domains is complete. This bit is set when the synchronization of the PATTERN register between clock domains is started. Bit 4 COUNTCOUNT Synchronization Busy This bit is cleared when the synchronization of the COUNT register between the clock domains is complete. This bit is set when the synchronization of the COUNT register between clock domains is started. Bit 3 STATUSSTATUS Synchronization Busy This bit is cleared when the synchronization of the STATUS register between the clock domains is complete. This bit is set when the synchronization of the STATUS register between clock domains is started. Bit 2 CTRLBCTRLB Synchronization Busy This bit is cleared when the synchronization of the CTRLB register between the clock domains is complete. This bit is set when the synchronization of the CTRLB register between clock domains is started. Bit 1 ENABLEENABLE Synchronization Busy This bit is cleared when the synchronization of the ENABLE bit between the clock domains is complete. This bit is set when the synchronization of the ENABLE bit between clock domains is started. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1100 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Bit 0 SWRSTSWRST Synchronization Busy This bit is cleared when the synchronization of the SWRST bit between the clock domains is complete. This bit is set when the synchronization of the SWRST bit between clock domains is started. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST is cleared by hardware. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1101 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.5 Fault Control A and B Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected FCTRLn 0x0C + n*0x04 [n=0..1]
0x00000000 Bit 31 30 29 28 Access Reset Bit 23 Access Reset R/W 0 Bit 15 BLANKPRESC R/W 0 Access Reset Bit 7 RESTART Access Reset R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 21 R/W 0 13 CAPTURE[2:0]
R/W 0 BLANK[1:0]
5 R/W 0 27 R/W 0 19 20 BLANKVAL[7:0]
R/W 0 12 R/W 0 4 QUAL R/W 0 R/W 0 11 R/W 0 CHSEL[1:0]
3 KEEP R/W 0 26 25 FILTERVAL[3:0]
R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 HALT[1:0]
SRC[1:0]
24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 27:24 FILTERVAL[3:0]Recoverable Fault n Filter Value These bits define the filter value applied on MCEx (x=0,1) event input line. The value must be set to zero when MCEx event is used as synchronous event. Bits 23:16 BLANKVAL[7:0]Recoverable Fault n Blanking Value These bits determine the duration of the blanking of the fault input source. Activation and edge selection of the blank filtering are done by the BLANK bits (FCTRLn.BLANK). When enabled, the fault input source is internally disabled for BLANKVAL* prescaled GCLK_TCCx periods after the detection of the waveform edge. Bit 15 BLANKPRESCRecoverable Fault n Blanking Value Prescaler This bit enables a factor 64 prescaler factor on used as base frequency of the BLANKVAL value. Value 0 1 Description Blank time is BLANKVAL* prescaled GCLK_TCCx. Blank time is BLANKVAL* 64 * prescaled GCLK_TCCx. Bits 14:12 CAPTURE[2:0]Recoverable Fault n Capture Action These bits select the capture and Fault n interrupt/event conditions. Table 41-10. Fault n Capture Action Value Name Description 0x0 0x1 DISABLE Capture on valid recoverable Fault n is disabled CAPT On rising edge of a valid recoverable Fault n, capture counter value on channel selected by CHSEL[1:0]. INTFLAG.FAULTn flag rises on each new captured value. 0x2 CAPTMIN On rising edge of a valid recoverable Fault n, capture counter value on channel selected by CHSEL[1:0], if COUNT value is lower than the last stored capture value (CC). INTFLAG.FAULTn flag rises on each local minimum detection. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1102 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC)
...........continued Value Name Description 0x3 CAPTMAX On rising edge of a valid recoverable Fault n, capture counter value on channel selected by CHSEL[1:0], if COUNT value is higher than the last stored capture value (CC). INTFLAG.FAULTn flag rises on each local maximun detection. 0x4 LOCMIN On rising edge of a valid recoverable Fault n, capture counter value on channel selected by CHSEL[1:0]. INTFLAG.FAULTn flag rises on each local minimum value detection. 0x5 LOCMAX On rising edge of a valid recoverable Fault n, capture counter value on channel selected by 0x6 DERIV0 CHSEL[1:0]. INTFLAG.FAULTn flag rises on each local maximun detection. On rising edge of a valid recoverable Fault n, capture counter value on channel selected by CHSEL[1:0]. INTFLAG.FAULTn flag rises on each local maximun or minimum detection. 0x7 CAPTMARK Capture with ramp index as MSB value. Bits 11:10 CHSEL[1:0]Recoverable Fault n Capture Channel These bits select the channel for capture operation triggered by recoverable Fault n. Value 0x0 0x1 0x2 0x3 Description Capture value stored into CC0 Capture value stored into CC1 Capture value stored into CC2 Capture value stored into CC3 Name CC0 CC1 CC2 CC3 Bits 9:8 HALT[1:0]Recoverable Fault n Halt Operation These bits select the halt action for recoverable Fault n. Value 0x0 0x1 0x2 0x3 Name DISABLE HW SW NR Description Halt action disabled Hardware halt action Software halt action Non-recoverable fault Bit 7 RESTARTRecoverable Fault n Restart Setting this bit enables restart action for Fault n. Value 0 1 Description Fault n restart action is disabled. Fault n restart action is enabled. Bits 6:5 BLANK[1:0]Recoverable Fault n Blanking Operation These bits, select the blanking start point for recoverable Fault n. Description Value Blanking applied from start of the Ramp period 0x0 Blanking applied from rising edge of the waveform output 0x1 Blanking applied from falling edge of the waveform output 0x2 Blanking applied from each toggle of the waveform output 0x3 Name START RISE FALL BOTH Bit 4 QUALRecoverable Fault n Qualification Setting this bit enables the recoverable Fault n input qualification. Value 0 1 Description The recoverable Fault n input is not disabled on CMPx value condition. The recoverable Fault n input is disabled when output signal is at inactive level (CMPx == 0). Bit 3 KEEPRecoverable Fault n Keep Setting this bit enables the Fault n keep action. Value 0 1 Description The Fault n state is released as soon as the recoverable Fault n is released. The Fault n state is released at the end of TCC cycle. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1103 Bits 1:0 SRC[1:0]Recoverable Fault n Source PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) These bits select the TCC event input for recoverable Fault n. Event system channel connected to MCEx event input, must be configured to route the event asynchronously, when used as a recoverable Fault n input. Value 0x0 0x1 0x2 0x3 Description Fault input disabled MCEx (x=0,1) event input Inverted MCEx (x=0,1) event input Alternate fault (A or B) state at the end of the previous period. Name DISABLE ENABLE INVERT ALTFAULT 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1104 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.6 Waveform Extension Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected WEXCTRL 0x14 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset 30 R/W 0 22 R/W 0 14 29 R/W 0 21 R/W 0 13 28 R/W 0 20 R/W 0 12 DTHS[7:0]
DTLS[7:0]
27 R/W 0 19 R/W 0 26 R/W 0 18 R/W 0 25 R/W 0 17 R/W 0 24 R/W 0 16 R/W 0 11 DTIEN3 R/W 0 10 DTIEN2 R/W 0 9 DTIEN1 R/W 0 8 DTIEN0 R/W 0 Bit 7 6 5 4 3 2 Access Reset OTMX[1:0]
1 R/W 0 0 R/W 0 Bits 31:24 DTHS[7:0]Dead-Time High Side Outputs Value This register holds the number of GCLK_TCCx clock cycles for the dead-time high side. Bits 23:16 DTLS[7:0]Dead-time Low Side Outputs Value This register holds the number of GCLK_TCCx clock cycles for the dead-time low side. Bits 8, 9, 10, 11 DTIENxDead-time Insertion Generator x Enable Setting any of these bits enables the dead-time insertion generator for the corresponding output matrix. This will override the output matrix [x] and [x+WO_NUM/2], with the low side and high side waveform respectively. Value 0 1 Description No dead-time insertion override. Dead time insertion override on signal outputs[x] and [x+WO_NUM/2], from matrix outputs[x] signal. Bits 1:0 OTMX[1:0]Output Matrix These bits define the matrix routing of the TCC waveform generation outputs to the port pins, according to 41.6.3.7. Waveform Extension. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1105 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.7 Driver Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected DRVCTRL 0x18 0x00000000 Bit 31 Access Reset R/W 0 Bit Access Reset Bit Access Reset Bit Access Reset 23 INVEN7 R/W 0 15 NRV7 R/W 0 7 NRE7 R/W 0 30 29 FILTERVAL1[3:0]
R/W 0 22 INVEN6 R/W 0 14 NRV6 R/W 0 6 NRE6 R/W 0 R/W 0 21 INVEN5 R/W 0 13 NRV5 R/W 0 5 NRE5 R/W 0 28 R/W 0 20 INVEN4 R/W 0 12 NRV4 R/W 0 4 NRE4 R/W 0 27 R/W 0 19 INVEN3 R/W 0 11 NRV3 R/W 0 3 NRE3 R/W 0 26 25 FILTERVAL0[3:0]
R/W 0 18 INVEN2 R/W 0 10 NRV2 R/W 0 2 NRE2 R/W 0 R/W 0 17 INVEN1 R/W 0 9 NRV1 R/W 0 1 NRE1 R/W 0 24 R/W 0 16 INVEN0 R/W 0 8 NRV0 R/W 0 0 NRE0 R/W 0 Bits 31:28 FILTERVAL1[3:0]Non-Recoverable Fault Input 1 Filter Value These bits define the filter value applied on TCE1 event input line. When the TCE1 event input line is configured as a synchronous event, this value must be 0x0. Bits 27:24 FILTERVAL0[3:0]Non-Recoverable Fault Input 0 Filter Value These bits define the filter value applied on TCE0 event input line. When the TCE0 event input line is configured as a synchronous event, this value must be 0x0. Bits 16, 17, 18, 19, 20, 21, 22, 23 INVENxWaveform Output x Inversion These bits are used to select inversion on the output of channel x. Writing a '1' to INVENx inverts output from WO[x]. Writing a '0' to INVENx disables inversion of output from WO[x]. Bits 8, 9, 10, 11, 12, 13, 14, 15 NRVxNRVx Non-Recoverable State x Output Value These bits define the value of the enabled override outputs, under non-recoverable fault condition. Bits 0, 1, 2, 3, 4, 5, 6, 7 NRExNon-Recoverable State x Output Enable These bits enable the override of individual outputs by NRVx value, under non-recoverable fault condition. Value 0 1 Description Non-recoverable fault tri-state the output. Non-recoverable faults set the output to NRVx level. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1106 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.8 Debug control Name:
Offset:
Reset:
Property: PAC Write-Protection DBGCTRL 0x1E 0x00 Bit 7 6 5 4 3 Access Reset 2 FDDBD R/W 0 1 0 DBGRUN R/W 0 Bit 2 FDDBDFault Detection on Debug Break Detection This bit is not affected by software Reset and must not be changed by software while the TCC is enabled. By default this bit is zero, and the on-chip debug (OCD) fault protection is disabled. When this bit is written to 1, OCD break request from the OCD system will trigger non-recoverable fault. When this bit is set, OCD fault protection is enabled and OCD break request from the OCD system will trigger a non-recoverable fault. Value 0 1 Description No faults are generated when TCC is halted in Debug mode. A non recoverable fault is generated and FAULTD flag is set when TCC is halted in Debug mode. Bit 0 DBGRUNDebug Running State This bit is not affected by software Reset and must not be changed by software while the TCC is enabled. Value 0 1 Description The TCC is halted when the device is halted in Debug mode. The TCC continues normal operation when the device is halted in Debug mode. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1107 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.9 Event Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected EVCTRL 0x20 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset 15 TCEI1 R/W 0 14 TCEI0 R/W 0 Bit 7 6 CNTSEL[1:0]
Access Reset R/W 0 R/W 0 13 TCINV1 R/W 0 5 R/W 0 12 TCINV0 R/W 0 4 EVACT1[2:0]
R/W 0 11 3 R/W 0 10 CNTEO R/W 0 2 R/W 0 9 TRGEO R/W 0 1 EVACT0[2:0]
R/W 0 8 OVFEO R/W 0 0 R/W 0 Bits 14, 15 TCEITimer/Counter Event Input x Enable This bit is used to enable input event x to the TCC. Value 0 1 Description Incoming event x is disabled. Incoming event x is enabled. Bits 12, 13 TCINVTimer/Counter Event x Invert Enable This bit inverts the event x input. Value 0 1 Description Input event source x is not inverted. Input event source x is inverted. Bit 10 CNTEOTimer/Counter Event Output Enable This bit is used to enable the counter cycle event. When enabled, an event will be generated on begin or end of counter cycle depending of CNTSEL[1:0] settings. Value 0 1 Description Counter cycle output event is disabled and will not be generated. Counter cycle output event is enabled and will be generated depend of CNTSEL[1:0] value. Bit 9 TRGEORetrigger Event Output Enable This bit is used to enable the counter retrigger event. When enabled, an event will be generated when the counter retriggers operation. Value 0 1 Description Counter retrigger event is disabled and will not be generated. Counter retrigger event is enabled and will be generated for every counter retrigger. Bit 8 OVFEOOverflow/Underflow Event Output Enable This bit is used to enable the overflow/underflow event. When enabled an event will be generated when the counter reaches the TOP or the ZERO value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1108 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Value 0 1 Description Overflow/underflow counter event is disabled and will not be generated. Overflow/underflow counter event is enabled and will be generated for every counter overflow/
underflow. Bits 7:6 CNTSEL[1:0]Timer/Counter Interrupt and Event Output Selection These bits define on which part of the counter cycle the counter event output is generated. Value 0x0 0x1 0x2 0x3 Description Name An interrupt/event is generated at begin of each counter cycle BEGIN An interrupt/event is generated at end of each counter cycle END BETWEEN An interrupt/event is generated between each counter cycle. BOUNDARY An interrupt/event is generated at begin of first counter cycle, and end of last counter cycle. Bits 5:3 EVACT1[2:0]Timer/Counter Event Input 1 Action These bits define the action the TCC will perform on TCE1 event input. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description Event action disabled. Start, restart or re-trigger TC on event Direction control Stop TC on event Decrement TC on event Period captured into CC0 Pulse Width on CC1 Period captured into CC1 Pulse Width on CC0 Non-recoverable Fault Name OFF RETRIGGER DIR (asynch) STOP DEC PPW PWP FAULT Bits 2:0 EVACT0[2:0]Timer/Counter Event Input 0 Action These bits define the action the TCC will perform on TCE0 event input 0. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description Event action disabled. Start, restart or re-trigger TC on event Count on event. Start TC on event Increment TC on EVENT Count on active state of asynchronous event Name OFF RETRIGGER COUNTEV START INC COUNT (async) Non-recoverable Fault FAULT 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1109 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.10 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x24 0x00000000 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set (INTENSET) register. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset 15 FAULT1 R/W 0 14 FAULT0 R/W 0 13 FAULTB R/W 0 12 FAULTA R/W 0 Bit 7 6 5 4 Access Reset 11 DFS R/W 0 3 ERR R/W 0 10 UFS R/W 0 2 CNT R/W 0 9 8 1 TRG R/W 0 0 OVF R/W 0 Bit 15 FAULT1Non-Recoverable Fault x Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Non-Recoverable Fault x Interrupt Disable/Enable bit, which disables the Non-Recoverable Fault x interrupt. Value 0 1 Description The Non-Recoverable Fault x interrupt is disabled. The Non-Recoverable Fault x interrupt is enabled. Bit 14 FAULT0Non-Recoverable Fault x Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Non-Recoverable Fault x Interrupt Disable/Enable bit, which disables the Non-Recoverable Fault x interrupt. Value 0 1 Description The Non-Recoverable Fault x interrupt is disabled. The Non-Recoverable Fault x interrupt is enabled. Bit 13 FAULTBRecoverable Fault B Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Recoverable Fault B Interrupt Disable/Enable bit, which disables the Recoverable Fault B interrupt. Value 0 1 Description The Recoverable Fault B interrupt is disabled. The Recoverable Fault B interrupt is enabled. Bit 12 FAULTARecoverable Fault A Interrupt Enable Writing a 0 to this bit has no effect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1110 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Writing a 1 to this bit will clear the Recoverable Fault A Interrupt Disable/Enable bit, which disables the Recoverable Fault A interrupt. Value 0 1 Description The Recoverable Fault A interrupt is disabled. The Recoverable Fault A interrupt is enabled. Bit 11 DFSNon-Recoverable Debug Fault Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Debug Fault State Interrupt Disable/Enable bit, which disables the Debug Fault State interrupt. Value 0 1 Description The Debug Fault State interrupt is disabled. The Debug Fault State interrupt is enabled. Bit 10 UFSNon-Recoverable Update Fault Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Non-Recoverable Update Fault Interrupt Disable/Enable bit, which disables the Non-Recoverable Update Fault interrupt. Description Value The Non-Recoverable Update Fault interrupt is disabled. 0 The Non-Recoverable Update Fault interrupt is enabled. 1 Bit 3 ERRError Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Error Interrupt Disable/Enable bit, which disables the Compare interrupt. Value 0 1 Description The Error interrupt is disabled. The Error interrupt is enabled. Bit 2 CNTCounter Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Counter Interrupt Disable/Enable bit, which disables the Counter interrupt. Value 0 1 Description The Counter interrupt is disabled. The Counter interrupt is enabled. Bit 1 TRGRetrigger Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Retrigger Interrupt Disable/Enable bit, which disables the Retrigger interrupt. Value 0 1 Description The Retrigger interrupt is disabled. The Retrigger interrupt is enabled. Bit 0 OVFOverflow Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Overflow Interrupt Disable/Enable bit, which disables the Overflow interrupt request. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1111 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.11 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x28 0x00000000 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear (INTENCLR) register. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset 15 FAULT1 R/W 0 14 FAULT0 R/W 0 13 FAULTB R/W 0 12 FAULTA R/W 0 Bit 7 6 5 4 Access Reset 11 DFS R/W 0 3 ERR R/W 0 10 UFS R/W 0 2 CNT R/W 0 9 8 1 TRG R/W 0 0 OVF R/W 0 Bit 15 FAULT1Non-Recoverable Fault x Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Non-Recoverable Fault x Interrupt Disable/Enable bit, which enables the Non-
Recoverable Fault x interrupt. Value 0 1 Description The Non-Recoverable Fault x interrupt is disabled. The Non-Recoverable Fault x interrupt is enabled. Bit 14 FAULT0Non-Recoverable Fault x Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Non-Recoverable Fault x Interrupt Disable/Enable bit, which disables the Non-Recoverable Fault x interrupt. Value 0 1 Description The Non-Recoverable Fault x interrupt is disabled. The Non-Recoverable Fault x interrupt is enabled. Bit 13 FAULTBRecoverable Fault B Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Recoverable Fault B Interrupt Disable/Enable bit, which enables the Recoverable Fault B interrupt. Value 0 1 Description The Recoverable Fault B interrupt is disabled. The Recoverable Fault B interrupt is enabled. Bit 12 FAULTARecoverable Fault A Interrupt Enable Writing a 0 to this bit has no effect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1112 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Writing a 1 to this bit will set the Recoverable Fault A Interrupt Disable/Enable bit, which enables the Recoverable Fault A interrupt. Value 0 1 Description The Recoverable Fault A interrupt is disabled. The Recoverable Fault A interrupt is enabled. Bit 11 DFSNon-Recoverable Debug Fault Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Debug Fault State Interrupt Disable/Enable bit, which enables the Debug Fault State interrupt. Value 0 1 Description The Debug Fault State interrupt is disabled. The Debug Fault State interrupt is enabled. Bit 10 UFSNon-Recoverable Update Fault Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Non-Recoverable Update Fault Interrupt Disable/Enable bit, which disables the Non-Recoverable Update Fault interrupt. Description Value The Non-Recoverable Update Fault interrupt is disabled. 0 The Non-Recoverable Update Fault interrupt is enabled. 1 Bit 3 ERRError Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Error Interrupt Disable/Enable bit, which enables the Compare interrupt. Value 0 1 Description The Error interrupt is disabled. The Error interrupt is enabled. Bit 2 CNTCounter Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Retrigger Interrupt Disable/Enable bit, which enables the Counter interrupt. Value 0 1 Description The Counter interrupt is disabled. The Counter interrupt is enabled. Bit 1 TRGRetrigger Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Retrigger Interrupt Disable/Enable bit, which enables the Retrigger interrupt. Value 0 1 Description The Retrigger interrupt is disabled. The Retrigger interrupt is enabled. Bit 0 OVFOverflow Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Overflow Interrupt Disable/Enable bit, which enables the Overflow interrupt request. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1113 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.12 Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
INTFLAG 0x2C 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset 15 FAULT1 R/W 0 14 FAULT0 R/W 0 13 FAULTB R/W 0 12 FAULTA R/W 0 Bit 7 6 5 4 Access Reset 11 DFS R/W 0 3 ERR R/W 0 10 UFS R/W 0 2 CNT R/W 0 9 8 1 TRG R/W 0 0 OVF R/W 0 Bit 15 FAULT1Non-Recoverable Fault x Interrupt Flag This flag is set on the next CLK_TCC_COUNT cycle after a Non-Recoverable Fault x occurs. Writing a 0 to this bit has no effect. Writing a 1 to this bit clears the Non-Recoverable Fault x interrupt flag. Bit 14 FAULT0Non-Recoverable Fault x Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Non-Recoverable Fault x Interrupt Disable/Enable bit, which disables the Non-Recoverable Fault x interrupt. Value 0 1 Description The Non-Recoverable Fault x interrupt is disabled. The Non-Recoverable Fault x interrupt is enabled. Bit 13 FAULTBRecoverable Fault B Interrupt Flag This flag is set on the next CLK_TCC_COUNT cycle after a Recoverable Fault B occurs. Writing a 0 to this bit has no effect. Writing a 1 to this bit clears the Recoverable Fault B interrupt flag. Bit 12 FAULTARecoverable Fault A Interrupt Flag This flag is set on the next CLK_TCC_COUNT cycle after a Recoverable Fault B occurs. Writing a 0 to this bit has no effect. Writing a 1 to this bit clears the Recoverable Fault B interrupt flag. Bit 11 DFSNon-Recoverable Debug Fault State Interrupt Flag This flag is set on the next CLK_TCC_COUNT cycle after a Debug Fault State occurs. Writing a 0 to this bit has no effect. Writing a 1 to this bit clears the Debug Fault State interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1114 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Bit 10 UFSNon-Recoverable Update Fault Interrupt Enable This flag is set when the RAMP index changes and the Lock Update bit is set (CTRLBSET.LUPD). Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Non-Recoverable Update Fault Interrupt Disable/Enable bit, which disables the Non-Recoverable Update Fault interrupt. Description Value The Non-Recoverable Update Fault interrupt is disabled. 0 The Non-Recoverable Update Fault interrupt is enabled. 1 Bit 3 ERRError Interrupt Flag This flag is set if a new capture occurs on a channel when the corresponding Match or Capture Channel x interrupt flag is one. In which case, there is nowhere to store the new capture. Writing a 0 to this bit has no effect. Writing a 1 to this bit clears the error interrupt flag. Bit 2 CNTCounter Interrupt Flag This flag is set on the next CLK_TCC_COUNT cycle after a counter event occurs. Writing a 0 to this bit has no effect. Writing a 1 to this bit clears the CNT interrupt flag. Bit 1 TRGRetrigger Interrupt Flag This flag is set on the next CLK_TCC_COUNT cycle after a counter retrigger occurs. Writing a 0 to this bit has no effect. Writing a 1 to this bit clears the re-trigger interrupt flag. Bit 0 OVFOverflow Interrupt Flag This flag is set on the next CLK_TCC_COUNT cycle after an overflow condition occurs. Writing a 0 to this bit has no effect. Writing a 1 to this bit clears the Overflow interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1115 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.13 Status Name:
Offset:
Reset:
Property:
STATUS 0x30 0x00000001
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset Bit Access Reset 15 FAULT1 R/W 0 7 PERBV R/W 0 14 FAULT0 R/W 0 6 13 FAULTB R/W 0 5 PATTBV R/W 0 12 FAULTA R/W 0 4 11 FAULT1IN R 0 3 DFS R/W 0 10 FAULT0IN R 0 2 9 FAULTBIN R 0 1 IDX R 0 8 FAULTAIN R 0 0 STOP R 1 Bits 14, 15 FAULTNon-recoverable Fault x State This bit is set by hardware as soon as non-recoverable Fault x condition occurs. This bit is cleared by writing a one to this bit and when the corresponding FAULTxIN status bit is low. Once this bit is clear, the timer/counter will restart from the last COUNT value. To restart the timer/counter from BOTTOM, the timer/counter restart command must be executed before clearing the corresponding STATEx bit. For further details on timer/counter commands, refer to the available commands description (CTRLBSET.CMD). Bit 13 FAULTBRecoverable Fault B State This bit is set by hardware as soon as recoverable Fault B condition occurs. This bit can be cleared by hardware when the Fault B action is resumed or by writing a 1 to this bit when the corresponding FAULTBIN bit is low. If the software halt command is enabled (FAULTB.HALT=SW), clearing this bit will release the timer/counter. Bit 12 FAULTARecoverable Fault A State This bit is set by hardware as soon as the recoverable Fault A condition occurs. This bit can be cleared by hardware when the Fault A action is resumed or by writing a 1 to this bit when the corresponding FAULTAIN bit is low. If the software halt command is enabled (FAULTA.HALT=SW), clearing this bit will release the timer/counter. Bit 11 FAULT1INNon-Recoverable Fault 1 Input This bit is set while an active Non-Recoverable Fault 1 input is present. Bit 10 FAULT0INNon-Recoverable Fault 0 Input This bit is set while an active Non-Recoverable Fault 0 input is present. Bit 9 FAULTBINRecoverable Fault B Input This bit is set while an active Recoverable Fault B input is present. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1116 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) Bit 8 FAULTAINRecoverable Fault A Input This bit is set while an active Recoverable Fault A input is present. Bit 7 PERBVPeriod Buffer Valid This bit is set when a new value is written to the PERB register. This bit is automatically cleared by hardware on the UPDATE condition when CTRLB.LUPD is set or by writing a 1 to this bit. Bit 5 PATTBVPattern Generator Value Buffer Valid This bit is set when a new value is written to the PATTB register. This bit is automatically cleared by hardware on the UPDATE condition when CTRLB.LUPD is set or by writing a 1 to this bit. Bit 3 DFSDebug Fault State This bit is set by hardware in Debug mode when the DDBGCTRL.FDDBD bit is set. The bit is cleared by writing a 1 to this bit and when the TCC is not in Debug mode. When the bit is set, the counter is halted and the Waveforms state depends on the DRVCTRL.NRE and DRVCTRL.NRV registers. Bit 1 IDXRamp Index In RAMP2 and RAMP2A operation, the bit is cleared during the cycle A and set during the cycle B. In RAMP1 operation, the bit always reads zero. See Ramp Operations from Related Links.. Bit 0 STOPStop This bit is set when the TCC is disabled either on a STOP command or on an UPDATE condition when One-Shot operation mode is enabled (CTRLBSET.ONESHOT=1). This bit is clear on the next incoming counter increment or decrement. Value 0 1 Description Counter is running. Counter is stopped. Related Links 41.6.3.4. Ramp Operations 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1117 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.14 Counter Value Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized COUNT 0x34 0x00000000 Note:Prior to any read access, this register must be synchronized by user by writing the according TCC Command value to the Control B Set register (CTRLBSET.CMD = READSYNC). Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1118 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.15 Pattern PATT Name:
0x38 Offset:
Reset:
0x0000 Property: Write-Synchronized Bit Access Reset Bit Access Reset 15 PGV7 R/W 0 7 PGE7 R/W 0 14 PGV6 R/W 0 6 PGE6 R/W 0 13 PGV5 R/W 0 5 PGE5 R/W 0 12 PGV4 R/W 0 4 PGE4 R/W 0 11 PGV3 R/W 0 3 PGE3 R/W 0 10 PGV2 R/W 0 2 PGE2 R/W 0 9 PGV1 R/W 0 1 PGE1 R/W 0 8 PGV0 R/W 0 0 PGE0 R/W 0 Bits 8, 9, 10, 11, 12, 13, 14, 15 PGVPattern Generation Output Value This register holds the values of pattern for each waveform output. Bits 0, 1, 2, 3, 4, 5, 6, 7 PGEPattern Generation Output Enable This register holds the enable status of pattern generation for each waveform output. A bit written to '1' will override the corresponding SWAP output with the corresponding PGVn value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1119 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.16 Waveform Name:
Offset:
Reset:
Property: Write-Synchronized WAVE 0x3C 0x00000000 Bit 31 30 29 28 Access Reset 27 SWAP3 R/W 0 26 SWAP2 R/W 0 25 SWAP1 R/W 0 24 SWAP0 R/W 0 Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 Access Reset Bit Access Reset 7 CIPEREN R/W 0 11 CICCEN3 R/W 0 10 CICCEN2 R/W 0 9 CICCEN1 R/W 0 8 CICCEN0 R/W 0 6 5 4 3 2 R/W 0 1 WAVEGEN[2:0]
R/W 0 0 R/W 0 Bits 24, 25, 26, 27 SWAPSwap DTI Output Pair x Setting these bits enables the output swap of DTI outputs [x] and [x+WO_NUM/2]. Note, the DTIxEN settings will not affect the swap operation. Bits 8, 9, 10, 11 CICCENCircular CC Enable x Setting this bit enables the compare circular buffer option on the first four Compare/Capture channels. When the bit is set, the CCx register value is copied-back into the CCx register on the UPDATE condition. Bit 7 CIPERENCircular Period Enable Setting this bit enables the period circular buffer option. When the bit is set, the PER register value is copied-back into the PERB register on UPDATE condition. These bits select the Ramp operation (RAMP). These bits are not synchronized. Value 0x0 0x1 0x2 0x3 Description RAMP1 operation Alternative RAMP2 operation RAMP2 operation Name RAMP1 RAMP2A RAMP2 RAMP2C Bits 2:0 WAVEGEN[2:0]Waveform Generation Operation These bits select the waveform generation operation. The settings impact the top value and control if the frequency or PWM waveform generation must be used. These bits are not synchronized. Value Name Description Operation Top Update Waveform Output On Match Waveform Output On Update OVFIF/Event Up Down 0x0 0x1 0x2 NFRQ MFRQ NPWM Normal Frequency Match Frequency Normal PWM PER CC0 PER TOP/Zero TOP/Zero TOP/Zero Toggle Toggle Set Stable Stable Clear TOP TOP TOP Zero Zero Zero 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1120 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC)
...........continued Value Name Description Operation Top Update Waveform Output On Match Waveform Output On Update OVFIF/Event Up Down 0x3 0x4 0x5 0x6 0x7 DSCRITICAL Dual-slope PWM DSBOTTOM Dual-slope PWM DSBOTH DSTOP Dual-slope PWM Dual-slope PWM PER PER PER PER Zero Zero TOP & Zero Zero
~DIR
~DIR
~DIR
~DIR Stable Stable Stable Stable TOP TOP Zero Zero Zero 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1121 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.17 Period Value Name:
Offset:
Reset:
Property: Write-Synchronized PER 0x40 0xFFFFFFFF Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 Access Reset 5 R/W 1 4 R/W 1 3 2 DITHER[5:0]
R/W 1 R/W 1 9 1 8 0 R/W 1 R/W 1 Bits 5:0 DITHER[5:0]Dithering Cycle Number These bits hold the number of extra cycles that are added on the PWM pulse period every 64 PWM frames. Note:This bit field consists of the n LSB of the register. n is dependent on the value of the Resolution bits in the Control A register (CTRLA.RESOLUTION):
CTRLA.RESOLUTION 0x0 - NONE 0x1 - DITH4 0x2 - DITH5 0x3 - DITH6 Bits [n:0]
3:0 4:0 5:0 (depicted) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1122 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.18 Pattern Buffer PATTB Name:
0x64 Offset:
Reset:
0x0000 Property: Write-Synchronized Bit Access Reset Bit Access Reset 15 PGVB7 R/W 0 7 PGEB7 R/W 0 14 PGVB6 R/W 0 6 PGEB6 R/W 0 13 PGVB5 R/W 0 5 PGEB5 R/W 0 12 PGVB4 R/W 0 4 PGEB4 R/W 0 11 PGVB3 R/W 0 3 PGEB3 R/W 0 10 PGVB2 R/W 0 2 PGEB2 R/W 0 9 PGVB1 R/W 0 1 PGEB1 R/W 0 8 PGVB0 R/W 0 0 PGEB0 R/W 0 Bits 8, 9, 10, 11, 12, 13, 14, 15 PGVBPattern Generation Output Value Buffer This register is the buffer for the PGV register. If double buffering is used, valid content in this register is copied to the PGV register on an UPDATE condition. Bits 0, 1, 2, 3, 4, 5, 6, 7 PGEBPattern Generation Output Enable Buffer This register is the buffer of the PGE register. If double buffering is used, valid content in this register is copied into the PGE register at an UPDATE condition. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1123 PIC32CX-BZ2 and WBZ45 Family Timer/Counter for Control Applications (TCC) 41.8.19 Period Buffer Value Name:
Offset:
Reset:
Property: Write-Synchronized PERB 0x6C 0xFFFFFFFF Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 Access Reset 5 R/W 1 4 R/W 1 3 2 DITHERB[5:0]
R/W 1 R/W 1 9 1 8 0 R/W 1 R/W 1 Bits 5:0 DITHERB[5:0]Dithering Buffer Cycle Number These bits represent the PER.DITHER bits buffer. When the double buffering is enabled, the value of this bit field is copied to the PER.DITHER bits on an UPDATE condition. Note:This bit field consists of the n LSB of the register. n is dependent on the value of the Resolution bits in the Control A register (CTRLA.RESOLUTION):
CTRLA.RESOLUTION 0x0 - NONE 0x1 - DITH4 0x2 - DITH5 0x3 - DITH6 Bits [n:0]
3:0 4:0 5:0 (depicted) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1124 PIC32CX-BZ2 and WBZ45 Family Zigbee Bluetooth Radio Subsystem (ZBT) 42. Zigbee Bluetooth Radio Subsystem (ZBT) 42.1 Overview The PIC32CX-BZ2 and the WBZ45 support on-chip IEEE 802.15.4 and 802.15.3 compliant Zigbee, Bluetooth Low Energy 5.2 interface with integrated transceivers. The Wireless Subsystem block is comprised of on-chip Zigbee and Bluetooth 5.0 BBP/MAC, shared RF transceiver and Radio Arbiter. This section provides key features of the on-chip Wireless modules. With integrated Ultra Low Power 2.4 GHz ISM band single transceiver, dual modem and dual MAC, the Radio supports dual Zigbee and Bluetooth 5.2 link protocols. An onboard intelligent Radio Arbiter HW module establishes both the links simultaneously using a single Radio Transmit/Receive with programmable QoS. The RF transceiver includes dual Power Amplifiers architecture and TR Switch. Therefore, medium to high power application use cases are supported without external FEM. Arbitration between Application, Bluetooth link stack, Zigbee link stack and miscellaneous maintenance tasks are handled on the Cortex M4F (w/ DSP, FPU) CPU using available on-chip system memory resources via RTOS. Note:Unique Bluetooth and 802.15.4 MAC address are available in OTP memory region. The software SDK and operational stacks provided by Microchip provide API's to access these addresses. 42.2 Features 2.4 GHz RF Transceiver Integrated 2.4 GHz Ultra Low Power RF Transceiver shared between Bluetooth and Zigbee Modems and Link
(MAC) Controllers Integrated 16 MHz 20 ppm Crystal Oscillator (External Low Cost Crystal) Two PA Design Architecture (LPA (+4 dBm) and MPA (+12 dBm)) to improve TX power efficiency Low RBOM Two-port TRX RFFE Architecture Integrated balun (single-ended RF output) and TRX Switch Hardware Radio Arbiter with programmable QoS:
Resolution: up to per packet level Time-division coexistence between Bluetooth and 802.15.4 Based on shared transceiver and antenna Maintains connections of 802.15.4 and Bluetooth simultaneously Bluetooth Bluetooth Low Energy 5.2 Certified Up to +12 dBm Programmable Transmit Output Power Typical Receiver Power Sensitivity:
-95 dBm for Bluetooth Low Energy 1 Mbps
-92 dBm for Bluetooth Low Energy 2 Mbps
-102 dBm for Bluetooth Low Energy 125 Kbps
-99 dBm for Bluetooth Low Energy 500 Kbps Digital RSSI indicator (-90 dBm ~ -30 dBm) Bluetooth Supported Features:
2M uncoded PHY Long range (Coded PHY) Channel selection algorithm #2 Advertising extensions, offloads CPU with hardware-based scheduler High duty cycle non-connectible advertising Data length extensions 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1125 PIC32CX-BZ2 and WBZ45 Family Zigbee Bluetooth Radio Subsystem (ZBT) Secure connections Privacy upgrades (with hardware white-list support) ECDH P256 Hardware Engine for Link Key Generation when Bluetooth Pairing AES128 Hardware Module for Real-Time Bluetooth Payload Data Encryption HCI Interface via UART Bluetooth Low Energy Profiles:
Bluetooth Low Energy peripheral and central roles Bluetooth Low Energy APIs for application layer to implement standard or customize GATT based profiles/
services Microchip Transparent UART Service Battery Service Device Information Service Multi-link and multi-role Bluetooth Low Energy Services:
Provisioning Over-the-Air (OTA) update (also known as DFU) Advertisement/Beacon Personalized configuration Alert notification service 802.15.4/Zigbee 802.15.4/Zigbee PSDU data rate: 250 Kbps Programmable RX Mode:
-103 dBm RX sensitivity in the Continuous mode
-98 dBm sensitivity in the RPC mode RPC mode provides lower power consumption in RX mode to support California Green Energy Specification at the system level Hardware Assisted MAC:
Auto acknowledge Auto retry Channel access back-off SFD Detection, Spreading, De-spreading, Framing, CRC-16 Computation Independent TX/RX Buffers for improved CPU Offloading while Handling Zigbee Data:
128-byte TX and 128-byte RX frame buffer Hardware Security:
Advanced Encryption Standard (AES) True Random Number Generator (TRNG) Zigbee Stack Support:
Zigbee 3.0 ready Zigbee Pro 2015 Zigbee green power support (proxy, sink and multi-sensor) Proprietary(1) 500 kbps and 1 Mbps are 2.4 GHz Proprietary with DSSS 2 Mpbs are 2.4 GHz Proprietary without DSSS TX Output Power up to +12 dBm Receiver Sensitivity up to -96 dBm Hardware Assisted MAC:
Auto acknowledge Auto retry 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1126 PIC32CX-BZ2 and WBZ45 Family Zigbee Bluetooth Radio Subsystem (ZBT) Channel access back-off SFD Detection, Spreading, De-spreading, Framing, CRC-16 Computation Independent TX/RX Buffers for improved CPU Offloading while Handling Zigbee Data:
128-byte TX and 128-byte RX frame buffer Hardware Security:
Advanced Encryption Standard (AES) True Random Number Generator (TRNG) Note:
1. Proprietary modes are compatible to AT86RF233 modes of similar data rate. 42.3 Wireless Subsystem Top Level Diagram Figure 42-1. Wireless Subsystem Top Level Diagram BLUETOOTH LINK CONTROLLER SPI I/F TX MODEM AHB Manager RX MODEM BB CORE BLUETOOTH Co-Ex XTAL AGC Analog RF R F RF I/F RADIO ARBITER CLK/RST CTRL CONFIG REGS APB Split APB4 Subordinate IRQ[3:0]
A G C B B P X A H REG DCT CTRL FRAME BUFFER ZB LINK CONTROLLER 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1127 PIC32CX-BZ2 and WBZ45 Family Zigbee Bluetooth Radio Subsystem (ZBT) Figure 42-2. Zigbee Baseband Processor Block Diagram C-32 250kbps Data rate selection C-16 500kbps Input byte stream Serial to parallel conveter
(map 4bits to 1 symbol) C-8 Data rate selection Mux 250kbps/
500kbps 1Mbps 2Mbps OQPSK Modulator 42.4 Bluetooth Link Controller The APB interface provides access to internal register banks of the macro. These registers are programmed by the host (firmware) to set various configurations, trigger commands, read status, service interrupts and other functions. All Bluetooth operations are carried out as transmit or receive tasks within the Link controller. There are several task controllers:
Firmware Firmware can trigger tasks by writing the task controller registers. Hardware Schedule Controller This is Bluetooth 5.2 Bluetooth Low Energy advertisement scheduler controller
(Adv. role). Hardware Scanner This is Bluetooth 5.2 Bluetooth Low Energy advertisement scanner (Central role). Bluetooth Low Energy advertisement controller This is Bluetooth 5.2 advertisement controller (Adv. role). The requests from the task controllers are arbitrated and is carried out by the task controller. 42.4.1 Hardware Schedule Controller Hardware Schedule controller is a hardware accelerator that offloads the Bluetooth 5.2 advertising task from the firmware and executes it in hardware completely. 42.4.2 Hardware Scanner Hardware Scanner is another hardware accelerator to be used in the Bluetooth Low Energy/central mode. This offloads the Bluetooth Low Energy task of scanning for advertisements from the firmware. This enables fast scanning and quick connections. 42.4.3 Bluetooth Low Energy Advertisement Controller Bluetooth Low Energy advertisement controller is a hardware controller that supports offloading of Bluetooth 5.2 advertisements. This is a simpler advertising scenario requiring much smaller memory. The task controller manages overall TX/RX functionality and starts TX control FSM / RX control FSM in the baseband as per requirement to transmit/receive a packet. The task controller also manages the coexistence interface with Wi-Fi. The task controller can also be used directly by the firmware to measure the RSSI across various Bluetooth channels, which can, then, be used to generate an AFH channel map. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1128 PIC32CX-BZ2 and WBZ45 Family Zigbee Bluetooth Radio Subsystem (ZBT) 42.4.4 Bluetooth Clock Controller The Bluetooth clock controller/Slot timer provides information on Bluetooth slots and the slot boundary. The Bluetooth clock synchronization and clock adjustment due to RX window uncertainty is also handled by this controller. It controls the timings for Bluetooth Low Energy non-TIFS tasks. TX/RX control FSM (State machines) provide sequencing and control of various phases of a task. These control various elements in the TX and RX data path. The Crypto engine is used for AES encryption and decryption of transmit and receive data. This performs inline encryption as the data passes through the data path in the BB link controller. This controller is also used to perform offline CMAC operation directly under application firmware control. This controller is also used by the Bluetooth Low Energy privacy controller for the generation and decoding of hash needed for resolving private addresses. 42.4.5 Bluetooth Low Energy Privacy Controller Bluetooth Low Energy Privacy controller is to implement the Bluetooth Low Energy privacy feature. It can be used in offline mode by the firmware to generate a Resolvable Private Address (RPA) to be used for a transmission. And it is also used inline by the RX Control FSM to resolve the RPA received in the packet before implementing the device filtering using the white list. The Channel Hop Controller implements the logic needed to compute the next RF channel frequency to be used. A dedicated math unit for big number (128-bit) operations is available for firmware to handle large number operations. This is programmed and used by the firmware directly. There is no direct use of this block by any other hardware block. For simple, secure pairing, the P256 ECC module is available to perform computationally intensive key-matching procedures in hardware. The transmit memory read controller reads the data from the common memory and feeds them to the transmit data path for Bluetooth PDU creations and transmit. The receive memory write controller receives data from the RX data path and writes them to the common memory. 42.5 Zigbee/Proprietary Data Rate Link Controller The Zigbee Link Controller implements Zigbee 3.0 (802.15.4-2011) MAC and baseband functionality in hardware. The CPU interface (APB Subordinate) provides access to internal registers of the macro. These registers are programmed by the host (firmware) to kick off transmit/receive functionality along with the programming of other features. The APB Subordinate contains shadow registers for the status registers in the design for single-cycle, contention-free read accesses. Interrupt controller logic also resides in the APB subordinate module. Separate 128-byte frame buffers are provided for TX and RX. The XAH module implements basic MAC functionality as well as a hardware accelerator for features such as automatic acknowledgement, CSMA-CA and retransmission, automatic FCS check and so on. The BBP module implements Offset-QPSK PHY with 250 kb/s PSDU data rate. It also supports proprietary 500 kbps OQPSK PHY, 1 Mbps MSK PHY, and a 2 Mbps MSK non-spreading PHY. 42.5.1 Transmit Operation A frame transmission comprises of two actions: a write to Frame Buffer and the transmission of its contents. Both actions can be run in parallel if required by critical protocol timing. 42.5.2 Receive Operation A frame reception comprises of two actions: the transceiver listens for, receives and demodulates the frame to the Frame Buffer and signals the reception to the microcontroller. After that process, the microcontroller can read the available frame data from the Frame Buffer via the APB interface. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1129 PIC32CX-BZ2 and WBZ45 Family Zigbee Bluetooth Radio Subsystem (ZBT) 42.6 Radio Arbiter The Radio Arbiter determines the ownership of the Radio between Zigbee and Bluetooth link controllers. It also generates control to select between Zigbee/Bluetooth to drive the controls and data to or from the RF. By default, the Arbiter is IDLE and no Link controller has the ownership. The general intention of the design is to provide a radio arbiter that is flexible enough that the arbitration schemes can be tuned by the firmware with real application Bluetooth/Zigbee scenarios. All design and intellectual property parts of this arbiter design are property of Microchip Technology Inc., released under appropriate NDA. 42.6.1 Arbiter Modes The following are the modes supported by the arbiter:
Bluetooth static Radio ownership is with the Bluetooth Link controller Zigbee static Radio ownership is with the Zigbee Link controller Dynamic Radio ownership decided dynamically at every arbitration event 42.7 RF Physical Layer The top level block diagram of the transceiver architecture is as follows. Figure 42-3. Transceiver Architecture RX VGA/Driver RX VGA/Driver ADC ADC LPF/BPF LPF/BPF RX Mixer LNA RX Mixer Peak Detector RX+LPA Matching Network Modem DAC DAC VCO 2 2 PFD CP MM DIV XTAL Oscillator RX Buffer LPA TX Buffer TX Mixer TX Mixer Biasing Peak Detector MPA Matching Network ACLB Temperature Sensor POR RF CALS BandGap LDOs 42.8 Frequency Synthesizer The PIC32CX-BZ2 and the WBZ45 require 16 MHz for generating the local oscillator frequency between the 2.4 GHz to 2.48 GHz for the transmitter and receiver. The frequency synthesizer integrates all the passives for the loop filter inside the chip. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1130 PIC32CX-BZ2 and WBZ45 Family Zigbee Bluetooth Radio Subsystem (ZBT) 42.8.1 Transmit Mixer and Power Amplifier The PIC32CX-BZ2 and WBZ45 implement a direct conversion I/Q transmitter. The I/Q from the low pass filter of the TX path is converted to the desired output frequency through an I/Q mixer that operates on the LO frequency from the Synthesizer. The VCO operates at 4x the LO frequency. The supply for LPA and MPA is through separated power supply pins that can be connected to the output from the PMU with necessary decoupling. The LPA is a single stage amplifier that provides ~6 dBm output power in standalone mode and ~4 dBm in LPA/MPA shared mode. Both LPA and MPA implement an on-chip BALUN. The LPA pin also acts as the input to the RX section. MPA is a two-stage power amplifier designed to provide a maximum output power of ~12 dBm. MPA also implements an on-chip BALUN to get a single-ended TX output. MPA is NOT internally connected to the receiver. It is mandatory that the LPA pin be used for the Receiver path. On a typical application, the LPA and MPA can be connected directly, eliminating the need for an external switch. 42.8.2 Receiver The receiver path starts with the LPA pin, which is shared with the LPA path and the LNA. PIC32CX-BZ2 implements a low-IF differential receiver. The synthesizer generates the LO for down-conversion on the mixer, which goes through a BPF filter to the ADC. The Receiver implements an AGC to adjust the LNA gain depending upon the input signal level. 42.9 RFLDO The RF section has multiple LDOs to power the various power domains of the RF subsystem, All these LDOs can be powered up from the MLDO/DC-DC mode of the PMU and can get 1.35V and generate 1.2V internally to feed the corresponding RF sections. These LDOs need a bypass capacitor on the output for their operation. See Power Subsystem from Related Links. RF-PLL BUCK-LPA BUCK-MPA BUCK-BB Related Links 7. Power Subsystem 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1131 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics 43. Electrical Characteristics This chapter provides the Electrical Specification and Characteristic of PIC32CX-BZ2 and WBZ45 Module across the operating temperature range of the product. 43.1 Absolute Maximum Electrical Characteristics Exposure to these maximum rating conditions for extended periods may affect device reliability. Functional operation of the device at these or any other conditions above the parameters indicated in the operation listings of this specification is not implied. Table 43-1. Absolute Maximum Ratings Parameter Ambient temperature under bias(Note) Storage temperature Voltage on VDD / VDDIO with respect to GND Value
-40C to +125C
-65C to +150C
-0.3V to +4.0V Voltage on any tolerant pins, with respect to GND
-0.3V to (VDD + 0.3V) Maximum current out of GND pins Maximum current into VDD pins(2) Maximum output current sourced/sunk by any Low Current Mode I/O pin (4x drive strength) Maximum output current sourced/sunk by any High Current Mode I/O pin (8x drive strength) Maximum current sink by all ports Maximum current sourced by all ports(2) ESD Qualification Human Body Model (HBM) per JESD22-A114 300 mA 300 mA 10 mA 15 mA 120 mA 120 mA 2000V Charged Device Model (CDM) (ANSI/ESD STM 5.3.1)(All pins / Corner pins)
+500V/- 500V Notes:
1. Stresses above those listed under Absolute Maximum Ratings may cause permanent damage to the device. This is a stress rating only and functional operation of the device at those or any other conditions above those indicated in the operation listings of this specification is not implied. Exposure to maximum rating conditions for extended periods may affect device reliability. 2. Maximum allowable current is a function of device maximum power dissipation (See the Thermal Operating Conditions table in the Thermal Specifications from Related Links). Related Links 43.3. Thermal Specifications 43.2 DC Electrical Characteristics Table 43-2. Operating Frequency VS. Voltage Param. No. VDDIO, VDDANA Range Temp. Range (in C) Max. MCU Frequency Comments DC_5 1.9V to 3.6V
-40C to +85C 64 MHz Industrial 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1132 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics
...........continued Param. No. VDDIO, VDDANA Range Temp. Range (in C) Max. MCU Frequency Comments DC_7 1.9V to 3.6V
-40C to +125C 64 MHz Extended Note:The same voltage must be applied to VDDIN and VDDANA. 43.3 Thermal Specifications Table 43-3. Thermal Operating Conditions Rating Symbol Min. Typ Max. Unit Industrial Temperature Devices:
Operating ambient temperature range Operating junction temperature range V-Temp Temperature Devices:
Operating ambient temperature range Operating junction temperature range Extended Temperature Range:
Operating ambient temperature range Operating junction temperature range TA TJ TA TJ TA TJ
-40
-40
-40
-40
-40
-40 Maximum allowed power dissipation PDMAX
(TJ TA)/JA
+85
+105
+105
+125
+125
+135 C C C C C C W 43.4 Active Current Consumption DC Electrical Specifications Table 43-4. Active Current Consumption DC Electrical Specifications DC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Clock/Freq Typ (1) APWR_1 APWR_2 IDD_ACTIVE
(2,3) APWR_3 APWR_4 MCU IDD in Active mode w/LDO mode selected MCU IDD in Active mode w/
BUCK mode selected PLL 64 MHz 131 FRC 8 MHz 443 PLL 64 MHz 76.8 FRC 8 MHz 300 Max. Units Conditions A/MHz VDD =
VDDANA =
3.3V 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1133 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-1. Run Mode Current Consumption in Buck Mode at PLL 64 MHz
) A m
n o i t p m u s n o C t n e r r u C 8 7 6 5 4 3 2 1 0
-40 0 25 60 85 105 125 Temperature (in degree Celcius) Figure 43-2. Run Mode Current Consumption in MLDO Mode at PLL 64 MHz 12 10
) A m
n o i t p m u s n o C t n e r r u C 8 6 4 2 0
-40 0 25 60 85 105 125 Temperature (in degree Celcius) 2.4V 2.7V 3.3V 3.6V 1.9V 2.4V 2.7V 3.3V 3.6V 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1134 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Notes:
1. 2. Typical value measured at 3.3V and 25. The test conditions are as follows:
All GPIO except RPA3 pulled up. RPA3 is pulled down. RF system in IDLE state. Not transmitting or receiving packets. All peripherals are disabled. All PB clocks are divided by 16. LPRC is set as LPCLK. SOSC is disabled. PMU 1 MHz clock is derived from FRC. FRC is divided by 8. Cache is enabled and configured to wait states PFMWS[3:0] as 0xF. Backup RAM in the Retention mode. DSU is disconnected. 3. MCU running while(1) loop with 50 NOP instructions. 43.5 Idle Current Consumption DC Electrical Specifications Table 43-5. Idle Current Consumption DC Electrical Specifications DC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Clock/Freq Typ(1) Max. Units IPWR_1 IDD_IDLE (2) MCU IDD in IDLE IPWR_2 IPWR_3 IPWR_4 mode w/LDO mode selected MCU IDD in IDLE mode w/BUCK mode selected A/MHz PLL 64 MHz 83 FRC 8 MHz 336 PLL 64 MHz 52.8 FRC 8 MHz 282 Conditions
(3) VDDIO =
VDDANA =
3.3V 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1135 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-3. Idle Mode Current Consumption in Buck Mode at PLL 64 MHz A m n i t n e r r u C 6 5 4 3 2 1 0
-40 0 25 60 Temperature in Degree C 85 105 125 Figure 43-4. Idle Mode Current Consumption in MLDO Mode at PLL 64 MHz A m n i t n e r r u C 9 8 7 6 5 4 3 2 1 0
-40 0 25 60 Temperature in Degree C 85 105 125 2.4 - 64 2.7 - 64 3.3 - 64 3.6 - 64 1.9 - 64 2.4 - 64 2.7 - 64 3.3 - 64 3.6 - 64 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1136 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Notes:
1. 2. Typical value measured during characterization at 3.3V and 25. The test conditions are as follows:
All GPIO except RPA3 are pulled up. RPA3 is pulled down. All peripherals are disabled. All PB clocks are divided by 16. LPRC is set as LPCLK. SOSC is disabled. PMU 1 MHz clock is derived from FRC. FRC is divided by 8. Cache is enabled and configured to wait states PFMWS[3:0] as 0xF. Backup RAM in the Retention mode. DSU is disconnected. RF system clock is gated. Entry to the Sleep mode is disabled and WFI instruction is executed. No active RF transmission or reception during current measurement. 43.6 Sleep Current Consumption DC Electrical Specifications Table 43-6. Sleep Current Consumption DC Electrical Specifications DC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V
(unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Param. No. Symbol Characteristics VDDIO Typ(1) Max. Units Conditions SPWR_1 IDD_SLEEP SPWR_29 MCU IDD in Sleep mode w/LDO mode selected MCU IDD in Sleep mode w/
BUCK mode selected 3.3V 3.3V 3.3V 3.3V 950 620 470 450 A A A A XTAL ON XTAL OFF XTAL ON XTAL OFF Figure 43-5. Sleep Current with XTAL_OFF_MLDO
) A m
t n e r r u C _ a t o T _ D D l I 5 4 3 2 1 0
-40 0 25 Temperature (Degree C) 60 85 105 125 1.9 2.4 2.7 3.3 3.6 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1137 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-6. Sleep Current with XTAL_OFF_DC_DC
) A m
t n e r r u C _ a t o T _ D D l I 5 4 3 2 1 0
-40 0 25 60 Temperature (Degree C) 85 105 125 Figure 43-7. Sleep Current with XTAL_ON_MLDO 3
) A m
t n e r r u C _ a t o T _ D D l I 2.5 2 1.5 1 0.5 0
-40 0 25 60 Temperature (Degree C) 85 105 125 Figure 43-8. Sleep Current with XTAL_ON_DC_DC
) A m
t n e r r u C _ a t o T _ D D l I 5 4 3 2 1 0
-40 0 25 60 Temperature (Degree C) 85 105 125 2.4 2.7 3.3 3.6 1.9 2.4 2.7 3.3 3.6 2.4 2.7 3.3 3.6 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1138 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Notes:
1. 2. Typical value measured during characterization at 3.3V and 25. The test conditions are as follows:
All GPIO except RPA3 are pulled up. RPA3 is pulled down. All peripherals are disabled (except EIC). All PB clocks are divided by 16. LPRC is set as LPCLK. SOSC is disabled. CLDO is configured at lowest possible voltage (VREG Trim = 0x07). PMU is configured to the Buck PSM mode on the Sleep Mode Entry with current sense is disabled. Cache is enabled and configured to wait states PFMWS[3:0] as 0xF. Backup RAM in the Retention mode. DSU is disconnected. RF system is in low power configuration. Entry to the Sleep mode is enabled and WFI instruction is executed. In XTAL ON mode - PMU Buck clock is derived from POSC 16 MHz and scaled to 1 MHz. FRC is OFF. In XTAL OFF mode - PMU is clocked from FRC and XTAL 16 MHz clock is disabled and clock configuration in CRU changed to FRC. 43.7 Deep Sleep Current Consumption DC Electrical Specifications Table 43-7. Deep Sleep Current Consumption DC Electrical Specifications DC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V
(unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Param. No. Symbol Characteristics VDDIO Typ(1) Max. Units Conditions BPWR_1 IDD_BACKUP
(2) MCU IDD in BPWR_2 Deep Sleep mode powered from VDDIO 3.3V 3.3V 1.2 1.5 A A No backup RAM retained 8 KB backup RAM retained Figure 43-9. Deep Sleep Current RAM ON A n i t n e r r u C 6 5 4 3 2 1 0 1.9 2.4 2.7 3.3 3.6
-40 0 25 60 Temperature ( C) 85 105 125 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1139 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-10. Deep Sleep Current RAM OFF 4 3.5 3 2.5 2 1.5 1 0.5 0 A n i t n e r r u C Notes:
1.9 2.4 2.7 3.3 3.6
-40 0 25 60 Temperature ( C) 85 105 125 1. 2. Typical value measured during characterization at 3.3V and 25. The test conditions are as follows:
All GPIO except RPA3 are pulled up. RPA3 is pulled down. All peripherals are disabled. All PB clocks are divided by 16. LPRC is set as LPCLK. SOSC and POSC is disabled. DSU is disconnected. RF system is in low power configuration. DSWDT is enabled and configured for wake-up. Deep sleep entry is configured and WFI instruction is executed. 43.8 XDS (Extreme Deep Sleep) Current Consumption DC Electrical Specifications Table 43-8. XDS (Extreme Deep Sleep) Current Consumption DC Electrical Specifications DC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V
(unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Param. No. Symbol Characteristics VDDIO Typ(1) Max. Units Conditions OPWR_1 IDD_OFF
(2) MCU IDD in OFF mode powered from VDDIOx 3.3V 0.12 A In OFF mode, the device is entirely powered-off. Note:This mode is left by pulling the RESET pin low, or when a power Reset is done. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1140 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-11. Extreme Deep Sleep Current 2.5 2 1.5 1 0.5 0 A n i t n e r r u C Notes:
1.9 2.4 2.7 3.3 3.6
-40 0 25 60 85 105 125 Temperature ( C) 1. 2. Typical value measured during characterization at 3.3V and 25. The test conditions are as follows:
All GPIO except RPA3 are pulled up. RPA3 is pulled down. All peripherals are disabled. DSU is disconnected. RF system is in low power configuration. DSWDT is disabled. RTCC and POSC is disabled. Deep sleep entry is configured and WFI instruction is executed. 43.9 External XTAL and Clock AC Electrical Specifications Table 43-9. External XTAL and Clock AC Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V
(unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Symbol Characteristics Min. Typ Max. Units Conditions(1) Param. No. XOSC_1 FOSC_XOS C XOSC crystal frequency XOSC_1A TOSC TOSC = 1/
FOSC_XOSC XOSC_2 XOSC_ST(2) XOSC crystal start-up time 16 0.0625 MHz ns 2.5 ms See parameter XOSC1 for FOSC_XOSC value Crystal stabilization time only not oscillator ready 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1141
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V
(unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ Max. Units Conditions(1) XOSC_3 CXIN XOSC_5 CXOUT XOSC_11 CLOAD(3) XOSC_21 ESR XOSC_33 DLEVEL XOSC XIN parasitic pin capacitance XOSC XOUT parasitic pin capacitance XOSC crystal FOSC = 16 MHz XOSC crystal FOSC = 16 MHz MCU crystal oscillator power drive level XOSC_34 FREQ ERROR Center frequency error
-30 Figure 43-12. External XTAL and Clock Diagram 0.35 0.35 9 100 100 pF pF pF W With default crystal trim settings(2) With default crystal trim settings
+30 ppm Across temperature C1 XTAL N X I T U O X 2 C RS 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1142 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Notes:
VDDIO = VDDANA = 3.3V. 1. 2. Refer RDP for information related to crystal trimming. 3. This is for guidance only. A major component of crystal start-up time is based on the second party crystal MFG parasitic that are outside the scope of this specification. The test conditions for crystal load capacitor calculation are as follows:
4. Standard PCB trace capacitance = 1.5 pF per 12.5 mm (0.5 inches) (in other words, PCB STD TRACE W
= 0.175 mm, H = 36 m, T = 113 m). Xtal PCB capacitance typical; therefore, ~= 2.5 pF for a tight PCB xtal layout For CXIN and CXOUT within 4 pF of each other, assume CXTAL_EFF = ((CXIN+CXOUT) / 2). Note:Averaging CXIN and CXOUT will affect the final calculated CLOAD value by less than 0.25 pF. Equation 43-1.Equation 1:
MFG CLOAD Spec =
Assuming C1 = C2 and CXin ~= CXout, the formula can be further simplified and restated to solve for C1 and oscillator PCB stray capacitance C2 by:
CXIN + C1 * CXOUT + C2 / CXIN + C1 + C2 + CXOUT + estimated Equation 43-2.Equation 2 (In other words: Simplified Equation 1) Example:
C1 = C2 =
2 * MFG CLOAD Spec CXTAL_EFF 2 * PCB capacitance XTAL Mfg CLOAD Data Sheet Spec = 12 pF PCB XTAL trace Capacitance = 2.5 pF CXIN pin = 6.5 pF, CXOUT pin = 4.5 pF; therefore, CXTAL_EFF = ((CXIN+CXOUT) / 2) CXTAL_EFF = ((6.5 + 4.5)/2) = 5.5 pF C1 = C2 = ((2 * MFG Cload spec) - CXTAL_EFF - (2 * PCB capacitance)) C1 = C2 = (24 - 5.5 - (2 * 2.5)) C1 = C2 = 13.5 pF (Always rounded down) C1 = C2 = 13 pF (in other words, for hypothetical example crystal external load capacitors) User C1 = C2 = 13 pF CLOAD (max) spec 43.10 XOSC32 AC Electrical Specifications Table 43-10. XOSC32 AC Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature:
-40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions(1) XOSC32_1 FOSC_XOSC32 XOSC32 oscillator XOSC32_3 CXIN32 XOSC32_5 CXOUT32 crystal frequency XOSC32 XIN32 parasitic pin capacitance XOSC32 XOUT32 parasitic pin capacitance on PIC32CX-BZ2 32.768 kHz XIN32, XOUT32 secondary oscillator 0.4 2.4 0.4 2.4 pF At the SOC pins on the Module pF At the SOC pins on the Module 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1143
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature:
-40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions(1) XOSC32_11 CLOAD_X32(3) XOSC32_13 ESR_X32 XOSC32_15 TOSC32 32.768 kHz crystal load capacitance 32.768 kHz crystal ESR TOSC32 = 1/
FOSC_XOSC32 11 75 pF K 30.518 s See parameter XOSC32_1 for FOSC_XOSC32 value This includes system delay and cannot be considered as the exact start-up time of SOSC clock as it is brought out on REFOx XOSC32_17 XOSC32_ST(2) XOSC32 crystal start-
23 ms up time Figure 43-13. XOSC32 Block Diagram C1 XTAL 2 C RS N X I T U O X 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1144 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Notes:
1. 2. 3. VDDIO = VDDANA = 3.3V. This is for guidance only. A major component of crystal start-up time is based on the second party crystal MFG parasitic that is outside the scope of this specification. If this is a major concern, the customer might need to characterize this based on their design choices. The test conditions for crystal load capacitor calculation are as follows:
Standard PCB trace capacitance = 1.5 pF per 12.5 mm (0.5 inches) (in other words, PCB STD TRACE W
= 0.175 mm, H = 36 m, T = 113 m) Xtal PCB capacitance typical; therefore, ~= 2.5 pF for a tight PCB xtal layout For CXIN and CXOUT within 4 pF of each other, assume CXTAL_EFF = ((CXIN / 2) Note:Averaging CXIN and CXOUT will affect the final calculated CLOAD value by less than the tolerance of the capacitor selection. 4. Equation 43-3.Equation 1:
MFG CLOAD Spec =
Assuming C1 = C2 and CXin ~= CXout, the formula can be further simplified and restated to solve for C1 and oscillator PCB stray capacitance C2 by:
CXIN + C1 * CXOUT + C2 / CXIN + C1 + C2 + CXOUT + estimated Equation 43-4.Equation 2 (In other words: Simplified Equation 1) Example:
C1 = C2 =
2 * MFG CLOAD Spec CXTAL_EFF 2 * PCB capacitance XTAL Mfg CLOAD Data Sheet Spec = 12 pF PCB XTAL trace Capacitance = 2.5 pF CXIN pin = 6.5 pF, CXOUT pin = 4.5 pF therefore CXTAL_EFF = ((CXIN / 2) CXTAL_EFF = ((6.5 + 4.5)/2) = 5.5 pF C1 = C2 = ((2 * MFG Cload spec) - CXTAL_EFF - (2 * PCB capacitance)) C1 = C2 = (24 - 5.5 - (2 * 2.5)) C1 = C2 = (24 - 5.5 - 5) C1 = C2 = 13.5 pF (Always rounded down) C1 = C2 = 13 pF (in other words, for hypothetical example crystal external load capacitors) User C1 = C2 = 13 pF CLOAD_X32 (max.) spec 43.11 Low Power Internal 32 kHz RC Oscillator AC Electrical Specifications Table 43-11. Low Power Internal 32 kHz RC Oscillator AC Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V
(unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions LP32K_1 FOSC_LPRC32K Output frequency LP32K_3 LPRC32K_ACC Accuracy LP32K_9 RC32K_Duty LPRC32K OSC duty cycle 32.7 50 kHz kHz
Factory default calibration 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1145 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics 43.12 FRC AC Electrical Specifications Table 43-12. FRC AC Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature:
-40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions FRC1 FINTFREQ FRC2 TSUFRC Internal FRC frequency Start-up time of internal FRC FRC3 FACCU FRC accuracy FRC5 DUTY_CYCLE FRC duty cycle FRC6 C_USE FRC user tune frequency drift 8 15 50
MHz Factory calibrated and user trim bits set to zero s Not characterized FRC7 C_USER_STEP_SIZE FRC user tune
step size 43.13 Frequency AC Electrical Specifications Table 43-13. Frequency AC Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V
(unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions MCU_1 FCY MCU frequency of operation 64 MHz VDDIO(min) to VDDIO(max) MCU_3 TCY MCU clock period 1/FCY s PLL ( Phase Locked Loop) AC Electrical Specifications 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1146 Frequency drift =
[ (Maximum frequency measured - Minimum frequency measured)/
(Default frequency of 8 MHz) ] * 100;
Maximum frequency drift possible by using the frequency trim bits Step size = (% Drift across Osc tune)/(Total number of trim bit combinations); Change in frequency with incremental trim bit PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Table 43-14. PLL MHz (Phase Locked Loop) AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions PLL_1 PLL_FIN PLL_3 PLL_FOUT PLL input frequency PLL output clock frequency PLL_4 PLL_VCO_FREQ PLL VCO frequency (Fixed) 16 96 480 MHz MHz MHz Note:
1. PLL input clock is 16 MHz XOSC. 43.14 QSPI Module Electrical Specifications Table 43-15. QSPI Module Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ.(1) Max. Units Conditions QSPI_1 FCLK QSPI_2 FCLK QSPI_3 TSCKH QSPI_5 TSCKL QSPI_7 TSCKR QSPI_9 TSCKF QSPI_11 TCSS QSPI_13 TCSH SQI serial clock frequency SDR Host mode 0 and 2 SQI serial clock frequency SDR Host mode 1 and 3 Serial clock high time Serial clock low time Serial clock rise time Serial clock fall time CS active setup time CS active hold time QSPI_19 TDIS Data in setup time 32 MHz 32 MHz 8.9 7.8 6.9 7.6 7.3 10.4 7.4 ns ns ns ns ns ns ns 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1147
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ.(1) Max. Units Conditions QSPI_21 TDIH Data in hold time QSPI_23 TDOH Data out hold QSPI_25 TDOV Data out valid 19.8 18 2.4 ns ns ns Note:
1. VDDIO = 3.3V, CLOAD = 30 pF (Typ.). 43.15 Power Supply DC Module Electrical Specifications Table 43-16. Power Supply DC Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions REG_1 VDDCORE _CIN VDDCORE
(CLDO_OUT) input bypass parallel capacitor pair(5) 1 F REG_5 VDD33 VDD33 input bypass parallel capacitor pair(5) REG_6 PMU_VDDI O Input bypass parallel capacitor pair for the PMU power section(5) REG_7 PMU_VDD P Input bypass parallel capacitor pair for the PMU power section(5) 100 nF 10 F 100 nF 4.7 F nF 1 F nF Bulk ceramic or solid tantalum with ESR
<0.5. Min and max represent absolute values including cap tolerances Ceramic XR7/X5R with ESR <0.5 depending on temperature Bulk ceramic or solid tantalum with ESR
<0.5(6) Ceramic XR7/X5R with ESR <0.5 depending on temperature on all VDDIO pins(6) Bulk Ceramic or solid Tantalum with ESR
<0.5(6) Ceramic XR7/X5R with ESR <0.5 depending on temperature on all VDDIO pins(6) Bulk ceramic or solid tantalum with ESR
<0.5(6) Ceramic XR7/X5R with ESR <0.5 depending on temperature on all VDDIN pins(6) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1148
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Max. Units Conditions REG_9 VDDFLASH _CIN VDD_FLASH bypass parallel capacitor pair(5) REG_17 VDDANA_ CIN VDDANA input bypass parallel capacitor pair(5) VDDANA_L EXT VDDANA series ferrite bead DCR
(DC resistance) REG_18 REG_19 REG_20 BUCK_PLL _CIN REG_21 BUCK_BB_ CIN REG_22 BUCK_MP A_CIN REG_23 BUCK_LPA _CIN REG_24 BUCK_CLD O_CIN REG_25 R_EXT Ferrite bead current Rating 100 VDD bypass capacitor on the BUCK_PLL input VDD bypass capacitor on the BUCK_BB input VDD bypass capacitor on the BUCK_LPA input VDD bypass capacitor on the BUCK_MPA input VDD bypass capacitor on the BUCK_CLDO input Bias for the reference current generation Typ. 10 F 100 nF 10 F 0.1 nF Bulk ceramic or solid tantalum with ESR
<0.5(6) Ceramic XR7/X5R with ESR <0.5 depending on temperature on all VDDFLASH pins(6) Bulk ceramic or solid tantalum with ESR
<0.5(6) Ceramic XR7/X5R with ESR <0.5 1 1 1 1 1 0.1 600 at 100 MHz mA F Ceramic XR7/X5R with ESR <0.5 F Ceramic XR7 with ESR
<0.5 F Ceramic XR7 with ESR
<0.5 F Ceramic XR7 with ESR
<0.5 F Ceramic XR7 with ESR
<0.5 30 k 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1149
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. REG_27
VSW_LEXT 2,3) Buck Switch mode regulator inductor inductance Inductor DCR (DC resistance) REG_29 REG_31 REG_32 REG_32A 250 10 VSW_CAP EXT Inductor ISAT Rating(2) Buck Switch mode regulator bulk capacitor capacitance Buck Switch mode regulator filtering capacitor capacitance Typ. 4.7 Max. Units Conditions H Shielded inductor only 0.22 mA F
(7) 100 nF REG_36 VDDCORE VDDCORE 1.2 REG_37 VDD33(4) voltage range VDD33 input voltage range REG_39 VDDANA(4) VDDANA input voltage range REG_40 VDDREG VDDREG input voltage range 1.9 1.9 REG_43 SVDDIO_R VDDIO rise ramp rate to ensure internal Power-on Reset signal 3.3 3.3 1.35 0.1 3.6 3.6 V V V V V/s REG_44 SVDDIO_F VDDIO falling V/s ramp rate to ensure internal Power-on Reset signal REG_45 VP0R+
Power-on Reset 1.5 REG_45_A VP0R-
Power-on Reset 1.5 REG_47 VBOR33(4) VDDIO BOD (All 1.7 modes)(4) V V V MCU Active, cache and prefetch disabled while executing from Flash(1) PMU output voltage Failure to meet this specification may lead to start-up or unexpected behaviors Failure to meet this specification may cause the device to not detect reset VDDIO power up/Down
(See Param REG43, VDDIO Ramp Rate) VDDIO Power up/Down
(See Param REG43, VDDIO Ramp Rate) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1150
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. REG_48 VBOR12 BOR of the 1.2V regulator REG_48A VZBPOR33 Zero power BOR REG_53 TRST(6) External RESET valid active pulse width REG_54 MLDO_DE LAY REG_55 SYS_DELA Y PMU MLDO and CLDO power-up delay System delay before fetching first instruction REG_56 CLK_DELA Y Crystal start-up delay REG_57 REG_58 POWER_O N_DELAY Power-up period BOR_DELA Y Width of the BOR event Max. Units Conditions Typ. 1.0 1.8 11 V V s Minimum Reset active time to guarantee MCU Reset for the module. Reset filter circuit inside Module Minimum Reset active time to guarantee MCU Reset for SoC with no Reset filter circuit 2.5 s 260 s s XOSC_2 s 488 s s Refer to XOSC_2 parameter from the crystal oscillator section Includes system delay since this is measured with a CPU event 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1151 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-14. Power-On Reset Timing Characteristics Internal Clock Sources External Clock Sources REG54 REG55 REG57 REG54 REG55 REG57 REG56 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1152 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-15. External Reset Timing Characteristics Internal Clock Sources External Clock Sources REG53 REG58 REG57 REG55 REG57 REG55 REG56 Notes:
1. 2. Ferrite Bead ISAT(min) (IDDANA(max) * 1.15). Buck Inductor ISAT(min) ((ICAPACITOR + IVDDCORE_MAX) * 1.2) when the BUCK mode is enabled
(shielded inductor only). 3. User must select either LDO or BUCK Mode. The modes are exclusive to each other. 4. 5. VDD33 and VDDANA must be at the same voltage level. All bypass caps must be located immediately adjacent to pin(s) and on the same side of the PCB as the MCU. Each primary power supply group VDDIO, VDDANA, VDDCORE must have one bulk capacitor and all power pins with a 100 nF bypass cap. The RESET pulse width is the minimum pulse width required on the I/O pin after any filtering on the NMCLR pin. Keep the DCR as low as possible to improve efficiency. 6. 7. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1153 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics 43.16 I/O PIN AC/DC Electrical Specifications Table 43-17. I/O PIN AC/DC Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ.(1) Max. Units Conditions DI_1 VOL DI_2 VOL DI_3 VOL DI_4 VOH DI_5 VOH DI_6 VOH DI_7 VIL Output voltage low (Drive strength, 8x) Output voltage low (Drive strength, 4x) Output voltage low (Drive strength, 8x) Output voltage low (Drive strength, 4x) Output voltage low (Drive strength, 8x) Output voltage low (Drive strength, 8x) Output voltage low (Drive strength, 4x) Output voltage low (Drive strength, 8x) Output voltage low (Drive strength, 4x) Output voltage High (Drive strength, 8x) Input voltage low
(Drive strength, 8x) Input voltage low
(Drive strength, 4x) 0.1 V VDDIO = 3.3V at IOL= 10 mA 0.2 VDDIO = 3.3V at IOL= 10 mA 0.2 V VDDIO = 3.3V at IOL= 13 mA 0.3 VDDIO = 3.3V at IOL= 13 mA 0.2 2.3 V V VDDIO = 3.3V at IOL= 15 mA VDDIO = 3.3V at IOH= 5 mA 2.1 VDDIO = 3.3V at IOH= 5 mA 2.2 V VDDIO = 3.3V at IOH= 7 mA 2.0 VDDIO = 3.3V at IOH= 7 mA 2.1 0.7 V V VDDIO = 3.3V at IOH=
10 mA VDDIO = 3.3V 0.5 VDDIO = 3.3V 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1154
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ.(1) Max. Units Conditions DI_8 VIH DI_13 IIL DI_15(5) RPDWN DI_17 RPUP DI_25 TRISE Input voltage high
(Drive strength, 8x) Input voltage high
(Drive strength, 4x) Input pin leakage current Internal pull-down
(Drive strength, 8x) Internal pull-down
(Drive strength, 4x) Internal pull-up
(Drive strength, 8x) Internal pull-up
(Drive strength, 4x) I/O pin rise time (High drive strength, high load) I/O pin rise time (Low drive strength, high load) I/O pin rise time (High drive strength, standard load) I/O pin rise time (Low drive strength, standard load) 2.9 V VDDIO = 3.3V 2.9 VDDIO = 3.3V 71.8 21.4 nA k VDDIO = 3.3V 3.9 k 18.6 k 3.3 k 1.97 ns VDDIO = 3.3V 10.7 ns 2.0 ns 7.6 ns 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1155
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ.(1) Max. Units Conditions DI_27 TFALL I/O pin fall time (High drive strength, high load) I/O pin fall time (Low drive strength, high load) I/O pin fall time (High drive strength, standard load) I/O pin fall time (Low drive strength, standard load) 1.6 ns 8.1 ns 1.6 ns 5.1 ns Notes:
1. 2. 3. All measurements done at 3.3V at 25. VIL source < (GND 0.3). Characterized but not tested. Any number and/or combination of I/O pins not excluded under IICL or IICH conditions are permitted provided the absolute instantaneous sum of the input injection currents from all pins do not exceed the specified IICT limit. To limit the injection current, the user must insert a resistor in series RSERIES (in other words, RS), between the input source voltage and device pin. The resistor value is calculated according to:
For negative Input voltages less than (GND 0.3): RS absolute value of | ((VIL source (GND 0.3)) /
IICL) |
For positive input voltages greater than (VDDIO + 0.3): RS ((VIH source (VDDIO +0.3))/ IICH) For Vpin voltages greater than VDDIO + 0.3 and less than GND 0.3: RS = the larger of the values calculated above 4. High load = 50 pF and Standard load = 30 pF. The drive strength of pads are as follows:
5. 8x pads - PA0, PA1, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10, PA13, PA14, PB10, PB11, PB12, PB13 4x pads - PA2, PB0, PB1, PB2, PB3, PB4, PB5, PB6, PB7, PB8, PB9 43.17 I2C Module Electrical Specifications Note:Traditional Serial Communication Interface documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Host and Client, respectively. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1156 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Table 43-18. I2C Module Host Mode Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions I2CM_1 TL0:SCL Host clock low time 100 kHz mode 400 kHz mode 1 MHz mode I2CM_5 TF:SCL SDAx and SCLx fall time 100 kHz mode 400 kHz mode 1 MHz mode I2CM_7 TR:SCL SDAx and SCLx rise time 100 kHz mode 400 kHz mode 1 MHz mode I2CM_9 TSU:DAT Data input setup time 100 kHz mode 400 kHz mode 1 MHz mode I2CM_11 THD:DAT Data input hold time 100 kHz mode 400 kHz mode 1 MHz mode 5020 1280 712 19 5 5 166 154 154 4900 1200 592 159 93 140 ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns VDDIOx = 3.3V, VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pf VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1157
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions I2CM_13 TSU:STA Start condition setup time I2CM_15 THD:STA Start condition hold time I2CM_21 TAA:SCL Output valid from clock I2CM_23 TBF:SDA Bus free time(1) 100 kHz mode 400 kHz mode 1 MHz mode 100 kHz mode 400 kHz mode 1 MHz mode 100 kHz mode 400 kHz mode 1 MHz mode 100 kHz mode 400 kHz mode 1 MHz mode 5180 1450 867 4990 1250 666 TL0:SC L TL0:SC L TL0:SC L s ns ns s s s ns ns ns ns ns ns VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF Note:
1. The amount of time the bus must be free before a new transmission can start (STOP condition to START condition). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1158 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-16. I2C Start/Stop Bits Host Mode AC Timing Diagram Figure 43-17. I2C Bus Data Host Mode AC Timing Diagram Table 43-19. I2C Module Client Mode Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial -40C TA +125C for Extended Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions I2CS_5 TF:SCL SDAx and SCLx fall time 100 kHz mode 400 kHz mode 1 MHz mode I2CS_7 TR:SCL SDAx and SCLx rise time 100 kHz mode 400 kHz mode 1 MHz mode 19 5 5 166 154 154 ns ns ns ns ns ns VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1159
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial -40C TA +125C for Extended Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions I2CS_9 TSU:DAT Data input setup time 100 kHz mode 400 kHz mode 1 MHz mode I2CS_11 THD:DAT Data input hold time 100 kHz mode 400 kHz mode 1 MHz mode 5580 1470 490 490 ns ns ns ns ns s VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF VDDIOx = 3.3V, IPULL-
UP = 3 mA, CLOAD =
400 pF VDDIOx = 3.3V, IPULL-
UP = 20 mA, CLOAD =
550 pF Note:
1. The amount of time the bus must be free before a new transmission can start (STOP condition to START condition). Figure 43-18. I2C Start/Stop Bits Client Mode AC Timing Diagram 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1160 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-19. I2C Bus Data Client Mode AC Timing Diagram 43.18 SPI Module Electrical Specifications Note:Traditional Serial Communication Interface documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Host and Client, respectively. Table 43-20. SPI Module Host Mode Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions MSP_1 FSCK SCK frequency MSP_3 TSCL MSP_5 TSCH MSP_7 TSCF MSP_9 TSCR MSP_11 TMOV MSP_13 TMOH MSP_15 TMIS SCK output low time SCK output high time SCK and MOSI output fall time SCK and MOSI output rise time MOSI Data output valid after SCK MOSI hold after SCK MISO setup time of data input to SCK 32 24 31.2 31.2 1.8 1.8 11 15 23 MHz Fixed pins Remappable pins See parameter DI27 I/O spec See parameter DI25 I/O spec VDDIOx (Min.), CLOAD =
30 pF (Typ.) ns ns ns ns ns ns ns MSP_17 TMIH MISO hold time of data input to SCK 8 ns 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1161 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-20. SPI Host Module CPHA=0 Timing Diagrams SCK CPOL=0 SCK CPOL=1 MISO
(Mstr Data In MOSI
(Mstr Data Out SP1 SP5 SP9 SP7 SP13 SP17 SP15 MSB SP11 SP3 LSB MSB LSB Figure 43-21. SPI Host Module CPHA=1 Timing Diagrams SP1 SP5 SP9 SP7 SCK CPOL=0 SCK CPOL=1 MISO
(Mstr Data In MOSI
(Mstr Data Out SP15 SP17 SP3 MSB MSB SP11 SP13 LSB LSB Note:
1. Assumes VDDIOx(min) and 30 pF external load on all SPIx pins unless otherwise noted. Table 43-21. SPI Module Client Mode Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. SSP_1 FSCK SCK frequency Typ 16 Max. Units Conditions 16 MHz VDDIOx = 1.9V or VDDIO(min) whichever is greater, CLOAD = 30 pF
(Min) fixed pins Remappable pins SSP_3 TSCL SCK output low time 12 62.5 12 ns 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1162
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. SSP_5 TSCH SSP_7 TSCF SSP_9 TSCR SSP_11 TSOV SSP_15 TSIS SCK output high time SCK and MOSI output fall time SCK and MOSI output rise time MOSI data output valid after SCK MISO setup time of data input to SCK Typ 62.5 3 26 21 23 Max. Units Conditions ns ns ns ns ns See parameter DI27 I/O spec See parameter DI25 I/O spec VDDIOx = 3.3V, CLOAD
= 30 pF (Min) SSP_17 TSIH MISO hold time of data input to SCK 22 ns Figure 43-22. SPI Client Module CPHA=0 Timing Diagrams SP1 SP5 SP9 SP7 SCK CPOL=0 SCK CPOL=1 MISO
(Mstr Data In MOSI
(Mstr Data Out SP19 __ SS SP15 MSB SP17 SP11 SP3 LSB MSB LSB SP13 SP21 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1163 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-23. SPI Client Module CPHA=1 Timing Diagrams SP1 SP5 SP9 SP7 SCK CPOL=0 SCK CPOL=1 MISO
(Mstr Data In MOSI
(Mstr Data Out SP11 __ SS SP15 SP17 SP3 MSB MSB SP19 SP13 LSB LSB SP21 43.19 ADC Electrical Specifications Table 43-22. ADC AC Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions Device Supply ADC_1 VDDANA ADC supply VDDANA(min) Reference Inputs ADC_3 VREF
(6) ADC reference voltage(4) Analog Input Range ADC_7 AFS ADC_9 Full-scale analog input signal range
(Single-ended) Full-scale analog input signal range
(Differential) 0 VDDANA/2 VDDANA(max) VDDANA VDDANA VDDANA/2 V V V V VDDIO = VDDANA External reference voltage VREF =
VDDANA(max) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1164 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Table 43-23. ADC Single-Ended Mode AC Electrical Specifications AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions Single-Ended Mode ADC Accuracy SADC_11 Res Resolution 6 12 bits SADC_13 EN0B(3) Effective number of bits 9.3 bits SADC_19 INL(3) Integral non linearity
-5.2 LSb SADC_25 DNL(3) Differential non linearity -1 LSb 2.7 SADC_31 GERR(3) Gain error
-0.7 LSb 1.8 SADC_37 E0FF(3) Offset error 3.2 LSb Single-Ended Mode ADC Dynamic Performance SADC_49 SINAD(1,2,3) Signal to noise and 57.8 dB distortion SADC_51 SNR(1,2,3)) Signal to noise ratio 58.2 SADC_53 SFDR(1,2,3) Spurious free dynamic 66.2 range SADC_55 THD(1,2,3,5) Total harmonic
-71.3 distortion Selectable 6, 8, 10, 12 bit resolution ranges 1.6 Msps, Internal VREF, VDDANA =
VDDIO = 3.3V 1.6 Msps, Internal VREF, VDDANA =
VDDIO = 3.3V 1.6 Msps, Internal VREF, VDDANA =
VDDIO = 3.3V 1.6 Msps, Internal VREF, VDDANA =
VDDIO = 3.3V Internal VREF, VDDANA = VDDIO =
3.3V VREF = VDDANA = VDDIO = 3.3V at 12-bit resolution, max sampling rate(1,2) Notes:
1. Characterized with an analog input sine wave = (FTP(maximum)/100). Example: FTP(maxium) = 1 Msps/100 2. 3.
= 10 KHz sine wave. Sinewave peak amplitude = 96% ADC_ Full Scale amplitude input with 12-bit resolution. Spec values collected under the following additional conditions:
a. b. ADC Measurements done with 3.3V VREF Voltage. 4. 5. Value taken over 7 harmonics. 6. Referred to as AVDD in the pinout. 12-bit resolution mode. All registers at reset default value otherwise not mentioned. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1165 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Table 43-24. ADC Conversion AC Electrical Requirements AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V
(unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ. Max. Units Conditions ADC_ Clock Requirements ADC_57 TAD ADC clock period 20.8 ns ADC Single-Ended Throughput Rates ADC_59 FTPR
(Single-
ended Mode) Throughput rate(2)
(Single-ended) 2 0.7 Msps VREF = VDDANA =
3.3V 12-bit resolution, DIV_SHR = 2 12-bit resolution, DIV_SHR = 4 Notes:
1. Conversion_time = (SAMC_SHR+15)*TAD. 2. FTPR = 1/(( SAMC_SHR + Resolution + 1 ) * ( 1/( ControlClk/DIV_SHR ))). Table 43-25. ADC Sample AC Electrical Requirements AC Characteristics Param. No. Symbol ADC_65 TCNV ADC_67 Characteristic s Conversion time(1) (Single-
ended Mode) Conversion time(1)
(Differential Mode) Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Min. Typ. Max. Units Conditions 14 12 10 14 12 10 TAD 12-bit resolution 10-bit resolution 8-bit resolution TAD 12-bit resolution 10-bit resolution 8-bit resolution ADC_69 CSAMPLE ADC internal sample cap ADC_71 RSAMPLE ADC internal 5 200 pf impedance Note:
1. ADC Throughput Rate FTP = ((1/((TSAMP + TCNV) * TAD))/(# of user active analog inputs in use on specific target ADC module)). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1166 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics 43.20 Bluetooth Low Energy RF Characteristics Table 43-26. Bluetooth Low Energy RF Characteristics AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ(1) Max. Units Conditions 2400 2480 MHz BTG1 FREQ BTTX1 TXPWR:MPA BTTX2 TXPWR:LPA BTX3 TXIB:1MBPS BTX4 TXIB:2MBPS BTRX1 RXSENSE BTRX2 MAXINSIG Frequency range of operation Bluetooth transmit power MPA Bluetooth transmit power LPA In-band emission for FTX -2 MHz In-band emission for FTX -(3+N) MHz In-band emission for FTX -4 MHz In-band emission for FTX -5 MHz In-band emission for FTX -(6+N) MHz Receiver sensitivity at 1 Mbps Receiver sensitivity at 2 Mbps Receiver sensitivity at 500 kbps Receiver sensitivity at 125 kbps Maximum input signal level at 1 Mbps Maximum input signal level at 2 Mbps Maximum input signal level at 500 kbps Maximum input signal level at 125 kbps
(1)
(5)
(5)
(5) 11.5 4.0
-32
-45
-43
-48
-51 dBm dBm dBm dBm dBm dBm dBm
-95.5 dBm
-92.5 dBm
-98.5 dBm
-102 0 0 0 0 dBm dBm dBm dBm dBm 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1167
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ(1) Max. Units Conditions BTRX3(4) CI1M:COCH CI1M: -1 MHz CI1M: -2 MHz CI1M:ADJ(3+n) CI1M:IMG C/I Co channel rejection C/I adjacent channel rejection C/I adjacent channel rejection C/I alternate channel rejection C/I image frequency rejection CI1M:IMG -1 MHz C/I adjacent channel to image freq rejection BTRX4(4) CIS2:COCH CIS2: -1 MHz CIS2: -2 MHz CIS2:ADJ(3+n) CIS2:IMG C/I Co channel rejection C/I adjacent channel rejection C/I adjacent channel rejection C/I alternate channel rejection C/I image frequency rejection CIS2:IMG -1 MHz C/I adjacent channel to image freq rejection BTRX5(4) CIS8:COCH CIS8: -1 MHz CIS8: -2 MHz CIS8:ADJ(3+n) CIS8:IMG C/I Co channel rejection C/I adjacent channel rejection C/I adjacent channel rejection C/I alternate channel rejection C/I image frequency rejection CIS2:IMG -1 MHz C/I adjacent channel to image freq rejection 13 13 13 15 15 14 11 17 18 17 14 18 6 13 13 14 8 16 dB dB dB dB dB dB dB dB dB dB dB dB dB dB dB dB dB dB 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1168
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9-3.6V (unless otherwise stated) Operating Temperature: -40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ(1) Max. Units Conditions BTRX6(4) CI2M:COCH CI2M: -2 MHz CI2M: -4 MHz CI2M:ADJ(6+2n) CI2M:IMG CI2M:IMG -2 MHz BTRX7(4) BLOCK1M:<2 GHZ C/I Co channel rejection C/I adjacent channel rejection C/I adjacent channel rejection C/I alternate channel rejection C/I image frequency rejection C/I adjacent channel to image freq rejection Blocking performance from 30-2 GHz BLOCK1M:2 GHZ<SIG<2399 MHz Blocking performance from 2003-2399 MHz BLOCK1M:2484 MHZ<SIG<2977 MHz Blocking performance between 2484-2997 MHz BLOCK1M:3 GHZ<SIG<12.75 GHz Blocking performance between 3-12.5 GHz BTRX8(4) BLE1M:INTERMOD BLE2M:INTERMOD Inter modulation performance for BLEM Inter modulation performance for BLEM 13 16 19 16 13 19 20 14 20 20 13.5 19.5 dB dB dB dB dB dB dB dB dB dB dB dB Notes:
1. Measured at 25, averaged across all voltages and channels. 2. Measured on a board with the reference schematic. 3. 4. 5. All measurement across voltage based on the SIG specifications. The specified value is the limit above the SIG specifications. PDU length = 37, channels = 2402/2426/2440/2480 MHz. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1169 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Table 43-27. Bluetooth Low Energy RF Current Characteristics AC Characteristics Param. No. Symbol Characteristics RF Power CPU Frequency Standard Operating Conditions: VDDIO
= VDDANA 1.9-3.6V (unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Min. Typ. Max. Units Conditions IBLETX1 IDDTXMPA IBLETX2 IBLETX3 IBLETX4 IBLETX5 IBLETX6 IBLETX7 IDDTXLPA IBLETX8 IBLETX9 IBLETX10 IBLETX11 IBLETX12 IBLETX7 IDDTXLPA0 IBLETX8 IBLETX9 IBLETX10 IBLETX11 IBLETX12 Current consumption with output power in DC-
DC mode 1 Mbps Current consumption at +12 dBm output power in MLDO mode
+12 dBm
+12 dBm
+12 dBm
+12 dBm
+12 dBm
+12 dBm 64 MHz 42.8 mA 32 MHz 40.5 mA 8 MHz 39.0 mA 64 MHz 96.7 mA 32 MHz 91.8 mA 8 MHz 88.1 mA Current consumption at +4 dBm output power in DC-DC mode 1 Mbps Current consumption at +4 dBm output power in MLDO mode Current consumption at +0 dBm output power in DC-DC mode 1 Mbps Current consumption at 0 dBm output power in MLDO mode 4 dBm 64 MHz 4 dBm 32 MHz 4 dBm 8 MHz 4 dBm 64 MHz 4 dBm 32 MHz 4 dBm 8 MHz 0 dBm 64 MHz 0 dBm 32 MHz 0 dBm 8 MHz 0 dBm 64 MHz 0 dBm 32 MHz 0 dBm 8 MHz 24.9 22.9 21.1 55.5 48.7 45.8 22.7 20.9 18.2 47.6 43.0 39.7 mA mA mA mA mA mA mA mA mA mA mA mA 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1170 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics
...........continued AC Characteristics Param. No. Symbol Characteristics RF Power CPU Frequency Standard Operating Conditions: VDDIO
= VDDANA 1.9-3.6V (unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Min. Typ. Max. Units Conditions IBLERX1 IDDRXBLE1M Current consumption at RX signal level -80 dBm in DC-DC mode Current consumption at RX signal level -80 dBm in MLDO mode IBLERX2 IBLERX3 IBLERX4 IBLERX5 IBLERX6 Notes:
-80 dBm
-80 dBm
-80 dBm
-80 dBm
-80 dBm
-80 dBm 64 MHz 20.6 mA 32 MHz 18.2 mA 8 MHz 16.5 mA 64 MHz 40.6 mA 32 MHz 35.1 mA 8 MHz 30.9 mA Current consumption is measured on a board based upon the Microchip Technology Reference Design. Current consumption is for the entire SoC (including the MCU), measured at the input power rail. Current consumption is measured using HUT code. Current reported is the average of the current during the transmit or receive burst (exclude off cycle of the transmit/receive operation). Figure 43-24. Module Bluetooth Low Energy Receive Sensitivity vs Temperature
) m B d
l e v e l y t i v i t i s n e S
-50
-60
-70
-80
-90
-100
-110
-40 25 Temperature (C) 85 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1171 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Notes:
Bluetooth Low Energy receive sensitivity is measured across temperature at 3.6V, 2440 MHz, uncoded data at 1 Ms/s. PDU length = 37. Sensitivity is measured according to the SIG specifications. Figure 43-25. Module Bluetooth Low Energy Receive Sensitivity vs Frequency
-50
-60
-70
-80
-90
-100
) m B d
l e v e l y t i v i t i s n e S
-110 Notes:
2 0 4 2 6 0 4 2 0 1 4 2 4 1 4 2 8 1 4 2 2 2 4 2 6 2 4 2 0 3 4 2 4 3 4 2 8 3 4 2 2 4 4 2 6 4 4 2 0 5 4 2 4 5 4 2 8 5 4 2 2 6 4 2 6 6 4 2 0 7 4 2 4 7 4 2 8 7 4 2 Frequency (MHz) Bluetooth Low Energy sensitivity is measured across channels at 3.6V at 25, uncoded data at 1 Ms/s. PDU length = 37. Sensitivity is measured according to the SIG specifications. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1172 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-26. Bluetooth Low Energy 1M CI Margin 25 20 15 10 5 0
) B d
n i g r a M Notes:
0 0 4 2 4 0 4 2 8 0 4 2 2 1 4 2 6 1 4 2 0 2 4 2 4 2 4 2 8 2 4 2 2 3 4 2 6 3 4 2 0 4 4 2 4 4 4 2 8 4 4 2 2 5 4 2 6 5 4 2 0 6 4 2 4 6 4 2 8 6 4 2 2 7 4 2 6 7 4 2 0 8 4 2 Frequency (MHz) Bluetooth Low Energy 1M C/I Margin is measured at 2440 MHz at 25, 3.6V, uncoded data at 1 Ms/s. C/I test is done with HUT code based on the SIG specifications. Reported C/I margin is the margin above the C/I specifications from SIG. Figure 43-27. Bluetooth Low Energy Receive Sensitivity vs Voltage
) m B d
l e v e l y t i v i t i s n e S
-50
-60
-70
-80
-90
-100
-110 Notes:
1.9 2.3 2.6 3.6 Supply Voltage (V) Bluetooth Low Energy receive sensitivity is measured at 2440 MHz at 25, uncoded data at 1 Ms/s. PDU length = 37. Sensitivity is measured according to the SIG specifications. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1173 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-28. Bluetooth Low Energy Receive Sensitivity vs Temperature
) m B d
l e v e L y t i v i t i s n e S
-50
-60
-70
-80
-90
-100
-110 Notes:
-40 25 Temperature (C) 125 U Bluetooth Low Energy receive sensitivity is measured across channels at 3.6V, 2440 MHz, uncoded data at 1 Ms/s. PDU length = 37. Sensitivity is measured according to the SIG specifications. Figure 43-29. Bluetooth Low Energy Receive Sensitivity vs Frequency
-50
-60
-70
-80
-90
) m B d
l e v e l y t i v i t i s n e S
-100
-110 2 0 4 2 6 0 4 2 0 1 4 2 4 1 4 2 8 1 4 2 2 2 4 2 6 2 4 2 0 3 4 2 4 3 4 2 8 3 4 2 2 4 4 2 6 4 4 2 0 5 4 2 4 5 4 2 8 5 4 2 2 6 4 2 6 6 4 2 0 7 4 2 4 7 4 2 8 7 4 2 Frequency (MHz) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1174 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Notes:
Bluetooth Low Energy receiver sensitivity is measured across channels at 3.6V at 25, uncoded data at 1 Ms/s. PDU length = 37. Sensitivity is measured according to the SIG specifications. Figure 43-30. Bluetooth Low Energy Receive Current vs Temperature A m n i t n e r r u C 30 25 20 15 10 5 0 Notes:
0 4
5 3
5 2
5 1
5 5
5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 5 0 1 5 1 1 5 2 1 Temperature (C) Bluetooth Low Energy receive current is measured at 3.3V (Buck mode), uncoded data at 1 Ms/s with LNA configured at maximum gain. PDU length = 37. Current is measured on input power rail to SoC (includes processor current as well). Current is measured with HUT code. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1175 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-31. Bluetooth Low Energy Transmit Power vs Frequency
) m B d
l e v e L r e w o P 14 12 10 8 6 4 2 0 Notes:
2 0 4 2 6 0 4 2 0 1 4 2 4 1 4 2 8 1 4 2 2 2 4 2 6 2 4 2 0 3 4 2 4 3 4 2 8 3 4 2 2 4 4 2 6 4 4 2 0 5 4 2 4 5 4 2 8 5 4 2 2 6 4 2 6 6 4 2 0 7 4 2 4 7 4 2 8 7 4 2 Frequency (MHz) Bluetooth Low Energy transmit power is measured across frequency after transmit power calibration at 3.3V
(Buck mode). Transmit power is measured with HUT code. Transmit power is measured after the PA matching and LPF. Figure 43-32. Bluetooth Low Energy Transmit Power vs Transmit Power Level 14 10 6 2
-2
-6
-10
-14
-18
-22
-26
-30
-34
) m B d
r e w o p x T 12 11 10 9 8 7 6 5 4 2 0
-5 -10 -16 -22 -29 BLE Tx Power Level 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1176 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Notes:
Bluetooth Low Energy transmit power is measured at 2440 MHz after transmit power calibration. Transmit power is measured on board based on Microchip Technology Reference Design. Transmit power is measured after PA match and LPF. Transmit power is measured with HUT code. Transmit power is controlled by transmit power settings on HUT code for measurement. Figure 43-33. Bluetooth Low Energy Transmit Power vs VDD Supply Voltage 14 12 10 8 6 4 2 0
) m B d
r e w o p x T Notes:
1.9 2.1 2.3 2.5 2.7 2.9 3.1 3.3 3.5 Voltage (V) n Bluetooth Low Energy transmit power is measured across voltage after transmit power calibration. Transmit power is measured after calibration at +12 dBm ( 0.5 dBm). Transmit power is measured on board based on the Microchip Reference Design. Transmit power is measured after the LPA and PA match section. Transmit power is measured with HUT code. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1177 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-34. Bluetooth Low Energy Transmit Power vs. Temperature 10
) m B d
r e w o p x T 5 0 Notes:
0 4
5 3
5 2
5 1
5 5
5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 Temperature (C) 5 0 1 5 1 1 5 2 1 Bluetooth Low Energy transmit power is measured across temperature after transmit power calibration at 3.6V and 2440 MHz. Transmit power is measured with HUT code. Temperature power compensation is triggered before power measurement. Transmit power is measured after the PA matching and LPF. Figure 43-35. Bluetooth Low Energy Transmit Current vs Temperature 100 90 80 70 60 50 40 30 20 10 0 A m n i t n e r r u C 0 4
5 3
5 2
5 1
5 5
5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 Temperature (C) 5 0 1 5 1 1 5 2 1 Notes:
Bluetooth Low Energy transmit current is measured at 3.3V (Buck mode) at 2440 MHz across temperature. Transmit current is measured after calibration at +12 dBm ( 0.5 dBm). Current is measured on input power rail to SoC. Current is measured with HUT code. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1178 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics 43.21 Zigbee RF Characteristics Table 43-28. Zigbee RF Characteristics AC Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature:
-40C TA +85C for Industrial Temp Symbol Characteristics Min. Typ.(1,2) Max. Units Conditions Param. No. ZBG1 ZBG2 ZBG3 FREQ FCH PSDU ZBT1 TXOPMPA ZBT2 TXOPLPA Frequency range 2405 Channel spacing Bit rate Transmit output power MPA Transmit output power LPA ZBT3 POWERRANGE Output power range ZBT4 EVM ZBRX1 SENS250 SENS500 SENS1M SENS2M Error vector magnitude Receiver sensitivity in 250 kbps Receiver sensitivity in 500 kbps Receiver sensitivity in 1 Mbps Receiver sensitivity in 2 Mbps ZBRX2 PMAX Maximum input level ZBRX3(3) PACRP ZBRX4(3) PACRN ZBRX5(3) PALRP ZBRX6(3) PALRN ZBRX7 LOLEAKLPA ZBRX7A LOLEAKMPA Adjacent channel rejection +5 MHz Adjacent channel rejection -5 MHz Alternate channel rejection +10 MHz Alternate channel rejection -10 MHz LO leakage on LPA mode LO leakage on MPA mode 5 250, 500, 1000, 2000 11.5 4.0 26 10
-99
-96
-94
-88 0 35 31 17 17
-34
-28 2480 MHz MHz kbps dBm dBm dB
%RMS dBm dBm dBm dBm dBm dB dB dB dB dB dB
(4)
(4) TX power on ZB power levels from (-14 to 12 dBm)
(6)
(5)
(5) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1179
...........continued AC Characteristics PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Standard Operating Conditions: VDDIO = VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature:
-40C TA +85C for Industrial Temp Param. No. Symbol Characteristics Min. Typ.(1,2) Max. Units Conditions ZBRX8 RSSIRANGE Dynamic range of RSSI 40 dB Notes:
Specified value is the margin above the 802.15.4 standard limits. 1. Measured on a board based on the Microchip Technology reference design. 2. Measured across channels at 3.3V and according to the 802.15.4 standard specifications. 3. 4. Measured across channels and voltages. 5. 6. LO leakage on LPA mode, measured across voltage. All results are based on measurement conditions as per the 802.15.4 standards. Table 43-29. Zigbee RF Current Characteristics AC Characteristics Param. No. Symbol Characteristics CPU Frequency IZBTX1 IDDTXMPA IZBTX2 IBLETX3 IZBTX4 IZBTX5 IZBTX6 IZBTX7 IDDTXLPA IZBTX8 IZBTX9 IZBTX10 IZBTX11 IZBTX12 IZBRX1 IDDRXZB IZBRX2 IZBRX3 IZBRX4 IZBRX5 IZBRX6 Current consumption at
+12 dBm output power in DC-DC mode 250 kbps Current consumption at
+12 dBm output power in MLDO mode Current consumption at
+4 dBm output power in DC-DC mode 250 kbps Current consumption at
+4 dBm output power in MLDO mode Current consumption at RX signal level -95 dBm in DC-DC mode Current consumption at RX signal level -95 dBm in MLDO mode 64 MHz 32 MHz 8 MHz 64 MHz 32 MHz 8 MHz 64 MHz 32 MHz 8 MHz 64 MHz 32 MHz 8 MHz 64 MHz 32 MHz 8 MHz 64 MHz 32 MHz 8 MHz Standard Operating Conditions: VDDIO =
VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Min. Typ. Max. Units Conditions 43.3 41.3 39.9 96.4 92.1 89.0 27.3 24.9 22.7 51.7 47.6 45.0 19.4 17.4 15 38.5 33.5 30.3 mA mA mA mA mA mA mA mA mA mA mA mA mA mA mA mA mA mA 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1180 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics
...........continued AC Characteristics Symbol Characteristics IDDRXZBRPC Current consumption at RX signal level -95 dBm in DC-DC mode Current consumption at RX signal level -95 dBm in MLDO mode CPU Frequency 64 MHz 32 MHz 8 MHz 64 MHz 32 MHz 8 MHz Param. No. IZBRX1 IZBRX2 IZBRX3 IZBRX4 IZBRX5 IZBRX6 Notes:
Standard Operating Conditions: VDDIO =
VDDANA 1.9V to 3.6V (unless otherwise stated) Operating Temperature: -40C TA
+85C for Industrial Temp Min. Typ. Max. Units Conditions 13.6 11.3 9.8 29 24.2 20.7 mA mA mA mA mA mA Current consumption is measured on a board based upon the Microchip Technology Reference Design. Current consumption is for the entire SoC (including the MCU). Current consumption is measured using the HUT code. Current reported is the average of the current during the transmit burst (exclude off cycle of the transmission). Figure 43-36. Module Zigbee Receive Sensitivity vs. Temperature
-50
-60
-70
-80
-90
) m B d
l e v e l y t i v i t i s n e S
-100
-110 Notes:
-40 25 Temperature (C) 85 Receiver sensitivity is measured based on the 802.15.4 specifications. Receiver sensitivity is measured at 2440 MHz at 3.6V, 250 kbps. Measured after receiver calibration. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1181 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-37. Module Zigbee Receive Sensitivity vs. Frequency
-50
-60
-70
-80
-90
) m B d
l e v e l y t i v i t i s n e S
-100
-110 5 0 4 2 0 1 4 2 5 1 4 2 0 2 4 2 5 2 4 2 0 3 4 2 5 0 3 4 4 4 2 2 Frequency (MHz) 5 4 4 2 0 5 4 2 5 5 4 2 0 6 4 2 5 6 4 2 0 7 4 2 5 7 4 2 0 8 4 2 Notes:
RX sensitivity across channels is measured at 3.6V at 25, 250 kbps. Sensitivity is measured according to the 802.15.4 specifications. Figure 43-38. Zigbee TX Setting vs. Measurement Power 14 10 6 2
-2
-6
-10
-14
) m B d
r e w o P t n e m e r u s a e M
-18 Notes:
0 1 2 3 5 4 6 Zigbee Tx Power Level 8 7 9 10 11 12 13 14 15 Transmit power is measured after calibration. Transmit power is measured across power levels at 2440 MHz at 3.6V, 25. Transmit power is measured after the PA matching and LPF. Transmit power is configured using the transmit power setting in HUT code. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1182 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-39. Zigbee ACR +-5M Margin 40 35 30 25 20 15 10 5 0
) B d
n i g r a M Notes:
2420 2470 2420 2470
-5 5
-freq offset/+freq offset (MHz)/co-channel Adjacent channel rejection is measured at 3.6V at 25, 250 kbps. Measured based on the 802.15.4 adjacent channel relative jamming specification. Margin specified is the margin above the 802.15.4 specifications. Measured after receiver calibration. Figure 43-40. Zigbee ACR +-10M Margin 40 35 30 25 20 15 10 5 0
) B d
n i g r a M Notes:
2420 2470 2420 2470
-5 5
-freq offset/+freq offset (MHz)/co-channel Adjacent channel rejection is measured at 3.6V at 25, 250 kbps. Measured based on the 802.15.4 adjacent channel relative jamming specification. Margin specified is the margin above the 802.15.4 specifications. Measured after receiver calibration. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1183 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-41. Zigbee Receive Sensitivity vs. Temperature
-50
-60
-70
-80
-90
-100
) m B d
l e v e l y t i v i t i s n e S
-110 Notes:
-40 25 125 Temperature (C) Receiver sensitivity is measured based on the 802.15.4 specifications. Sensitivity measured at 3.6V, 25 on 2440 MHz across temperature, 250 kbps. Measured after receiver calibration. Figure 43-42. Zigbee Receive Sensitivity vs. Frequency
-50
-60
-70
-80
-90
) m B d
l e v e l y t i v i t i s n e S
-100
-110 Notes:
5 0 4 2 0 1 4 2 5 1 4 2 0 2 4 2 5 2 4 2 0 3 4 2 5 3 4 2 0 4 4 2 5 4 4 2 0 5 4 2 5 5 4 2 0 6 4 2 5 6 4 2 0 7 4 2 5 7 4 2 0 8 4 2 Frequency (MHz) RX sensitivity is measured across channels at 3.6V at 25, 250 kbps. Sensitivity is measured according to the 802.15.4 specifications. Sensitivity is measured after RX calibration. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1184 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-43. Zigbee Receive Sensitivity vs. VDD Supply Voltage
-50
-60
-70
-80
-90
-100
) m B d
l e v e l y t i v i t i s n e S
-110 Notes:
1.9 2.3 Supply Voltage (V) 2.6 3.6 RX sensitivity is measured at 2440 MHz at 25 across voltage, 250 kbps. Sensitivity is measured according to the 802.15.4 specifications. Sensitivity is measured after RX calibration. Figure 43-44. Zigbee Receive Current vs. Temperature A m n i t n e r r u C 50 45 40 35 30 25 20 15 10 5 0 Notes:
0 4
5 3
5 2
5 1
5 5
5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 Temperature (C) 5 0 1 5 1 1 5 2 1 Receiver operating at 2440 MHz, 3.3V, 25 at maximum LNA gain. Measured after receiver calibration. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1185 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Figure 43-45. Zigbee Transmit Power vs Frequency
) m B d
r e w o P t i m s n a r T 14 12 10 8 6 4 2 0 Notes:
5 0 4 2 0 1 4 2 5 1 4 2 0 2 4 2 5 2 4 2 0 3 4 2 0 4 4 2 5 4 4 2 5 3 4 2 Frequency (MHz) 0 5 4 2 5 5 4 2 0 6 4 2 5 6 4 2 0 7 4 2 5 7 4 2 0 8 4 2 Transmit power is measured after calibration. Transmit power is measured across the channels at 3.6V at 25. Transmit power is measured after the PA matching and LPF. Figure 43-46. Zigbee Transmit Power vs Temperature 14 12 10
) m B d
r e w o P x T 8 6 4 2 0
-40 -35 -25 -15 -5 5 15 25 35 45 55 65 75 85 95 105 115 125 Temperature (C) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1186 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Notes:
Transmit power is measured after calibration. Transmit power is measured at 2440 MHz at 3.6V across temperature. Transmit power is measured after the PA matching and LPF. Transmit power compensation is triggered before measurement across temperature. Figure 43-47. Zigbee Transmit Power vs. VDD Supply Voltage 14 12 10 8 6 4 2 0
) m B d
r e w o P x T Notes:
1.9 2.1 2.3 2.5 2.7 Voltage (V) 2.9 3.1 3.3 3.5 Transmit power is measured after calibration. Transmit power is measured across voltage at 2440 MHz and 25. Transmit power is measured on reference board after the PA matching and LPF. Transmit power is configured using transmit power setting in HUT code. Figure 43-48. Zigbee Transmit Current vs. Temperature A m n i t n e r r u C 100 90 80 70 60 50 40 30 20 10 0 0 4
5 3
5 2
5 1
5 5
5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 Temperature (C) 5 0 1 5 1 1 5 2 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1187 PIC32CX-BZ2 and WBZ45 Family Electrical Characteristics Notes:
Transmit current is measured at input to SoC (includes SoC power consumption). Transmit current is measured at 2440 MHz at 3.3V (Buck mode). Transmit power is calibrated to +12 dBm ( 0.5 dBm on MPA mode). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1188 PIC32CX-BZ2 and WBZ45 Family Packaging Information 44. Packaging Information This chapter provides the information on package markings, dimension and footprint of the PIC32CX-BZ2 and WBZ45 family. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1189 PIC32CX-BZ2 and WBZ45 Family Packaging Information 44.1 PIC32CX-BZ2 SoC Packaging Information 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1190 BA0.10C0.10C0.10CAB0.05CC2XTOP VIEWSIDE VIEWBOTTOM VIEW12N0.10CAB0.10CAB0.10C0.05CSheet 1 of 22X48XNote:For the most current package drawings, please see the Microchip Packaging Specification located athttp://www.microchip.com/packaging48-Lead Very Thin Quad Flat, No Lead Package (MYX) 7x7x0.9 mm Body [VQFN]With 4.04x4.12 mm Exposed Pad 2019 Microchip Technology Inc.Microchip Technology Drawing C04-507 Rev ANOTE1(DATUM B)(DATUM A)NOTE 1SEATINGPLANEA1(A3)ADED2E2(K)48X bLee212N PIC32CX-BZ2 and WBZ45 Family Packaging Information 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1191 For the most current package drawings, please see the Microchip Packaging Specification located athttp://www.microchip.com/packagingNote: 2019 Microchip Technology Inc.REF: Reference Dimension, usually without tolerance, for information purposes only.BSC: Basic Dimension. Theoretically exact value shown without tolerances.Notes:1.2.3.Pin 1 visual index feature may vary, but must be located within the hatched area.Package is saw singulatedDimensioning and tolerancing per ASME Y14.5MSheet 2 of 248-Lead Very Thin Quad Flat, No Lead Package (MYX) 7x7x0.9 mm Body [VQFN]With 4.04x4.12 mm Exposed PadMicrochip Technology Drawing C04-507 Rev ANumber of TerminalsOverall HeightTerminal WidthOverall WidthTerminal LengthExposed Pad WidthTerminal ThicknessPitchStandoffUnitsDimension LimitsA1AbE2A3eLEN0.50 BSC0.20 REF4.020.350.180.800.000.250.404.120.850.027.00 BSCMILLIMETERSMINNOM484.220.450.300.900.05MAXK1.04 REFTerminal-to-Exposed-PadOverall LengthExposed Pad LengthDD23.947.00 BSC4.044.14 PIC32CX-BZ2 and WBZ45 Family Packaging Information 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1192 RECOMMENDED LAND PATTERNDimension LimitsUnitsC2Optional Center Pad WidthContact Pad SpacingOptional Center Pad LengthContact PitchY2X24.204.14MILLIMETERS0.50 BSCMINEMAX6.90Contact Pad Length (X48)Contact Pad Width (X48)Y1X10.850.30NOM12C1Contact Pad Spacing6.90Contact Pad to Contact Pad (X44)G30.20Thermal Via DiameterVThermal Via PitchEV0.301.00BSC: Basic Dimension. Theoretically exact value shown without tolerances.Notes:Dimensioning and tolerancing per ASME Y14.5MFor best soldering results, thermal vias, if used, should be filled or tented to avoid solder loss duringreflow process1.2.For the most current package drawings, please see the Microchip Packaging Specification located athttp://www.microchip.com/packagingNote: 2019 Microchip Technology Inc.Contact Pad to Center Pad (X24)G20.93Microchip Technology Drawing C04-2507 Rev AC1EVC2EVX1Y1G2G3VSILK SCREEN4848-Lead Very Thin Quad Flat, No Lead Package (MYX) 7x7x0.9 mm Body [VQFN]With 4.04x4.12 mm Exposed PadEG1Contact Pad to Center Pad (X24)G10.96X2Y2 PIC32CX-BZ2 and WBZ45 Family Packaging Information 44.2 WBZ451 Module Packaging Information 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1193 Sheet 1 of 2Note:For the most current package drawings, please see the Microchip Packaging Specification located athttp://www.microchip.com/packaging39-Lead PCB Module (ZSX) - 15.5x20.7x2.8 mm Body [MODULE]With Metal Shield and Coaxial Connector 2022 Microchip Technology Inc.Microchip Technology Drawing C04-10052 Rev B14.700.802.002.8020.706.2115.502.04COAXIALCONNECTOR1234567891011121314151617181920212223242526393837363534333231302928270.60TEST POINT 0.800.700.702.24I.D.3.25O.D.9X0.909X 0.900.80TEST POINT 0.801.201.2014.3811.68METALSHIELD0.000.701.756.467.0711.9214.8515.500.0020.7018.892.246.9410.7514.8515.8914.535.287.003.520.802.0014.90(TERMINALCENTER)1.0039X 0.600.800.800.200.301234567891011121314151617181920212223242526393837363534333231302928270.600.30 PIC32CX-BZ2 and WBZ45 Family Packaging Information 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1194 For the most current package drawings, please see the Microchip Packaging Specification located athttp://www.microchip.com/packagingNote: 2022 Microchip Technology Inc.Sheet 2 of 239-Lead PCB Module (ZSX) - 15.5x20.7x2.8 mm Body [MODULE]With Metal Shield and Coaxial ConnectorMicrochip Technology Drawing C04-10052 Rev B PIC32CX-BZ2 and WBZ45 Family Packaging Information 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1195 RECOMMENDED LAND PATTERNFor the most current package drawings, please see the Microchip Packaging Specification located athttp://www.microchip.com/packagingNote: 2022 Microchip Technology Inc.RNotes:Keep this area free from all metal, including ground flll.Keep these areas free from routes and exposed copper. Ground fill with solder mask may be placed here.2.3.All dimensions are in millimeters.1.9X 0.900.3014.80(TEST POINT)(TEST POINT)1312111098765432114151617181920212223242526272829303132333435363738391.000.303.55NOTE 3COPPER KEEPOUT ZONE0.6539-Lead PCB Module (ZSX) - 15.5x20.7x2.8 mm Body [MODULE]With Metal Shield and Coaxial ConnectorMicrochip Technology Drawing C04-12052 Rev BPCB EDGE0.651.10NOTE 31.10NOTE 30.008.357.400.810.003.0139X 1.3039X 0.706.007.4010.008.353.350.681.294.175.076.831.309X 0.900.30 PIC32CX-BZ2 and WBZ45 Family Packaging Information 44.3 WBZ450 Module Packaging Information 30-Lead PCB Module (ZRX) -13.4x18.7x2.8 mm Body For WBZ450 Note:
For the most current package drawings, please see the Microchip Packaging Specification located at http://www.microchip.com/packaging 13.40 6.42 30 18.70 12.24 21 11 20 METAL SHIELD 1.78 6.32 1 2 0.58 10 0.58 SIDE VIEW TOP VIEW 2.80 2.00 END VIEW 0.80 Microchip Technology Drawing C04-10051 Rev A Sheet 1 of 2 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1196 PIC32CX-BZ2 and WBZ45 Family Packaging Information 30-Lead PCB Module (ZRX) -13.4x18.7x2.8 mm Body For WBZ450 Note:
For the most current package drawings, please see the Microchip Packaging Specification located at http://www.microchip.com/packaging 0 0
. 0 0 2
. 0 0 2
. 2 6 5
. 4 8 6
. 6 11 10 0.00 1.80 3.81 2 9
. 0 1 20 30X 0.80 1.00 21 1.2V TEST POINT 0 . 80 4.10 6.59 30X 0.60 30 0.80 RF PAD 14.63 1.35 V TEST POINT 0.80 1.00 1.00 2 1 0.80 0.80 12.12 3.25 O.D. 2.24 I.D. 17.07 0.80 6 5
. 1 8 1
. 6 2 6
. 1 1 BOTTOM VIEW Microchip Technology Drawing C04-10051 Rev A 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1197 PIC32CX-BZ2 and WBZ45 Family Appendix A: Regulatory Approval 45. Appendix A: Regulatory Approval The WBZ450 module has received regulatory approval for the following countries:
Bluetooth Special Interest Group (SIG) QDID: D056857 United States/FCC ID: 2ADHKWBZ450 Canada/ISED:
IC: 20266-WBZ450 HVIN: WBZ450 Europe/CE 45.1 United States The WBZ450 module has received Federal Communications Commission (FCC) CFR47 Telecommunications, Part 15 Subpart C Intentional Radiators single-modular approval in accordance with Part 15.212 Modular Transmitter approval. Single-modular transmitter approval is defined as a complete RF transmission sub-assembly, designed to be incorporated into another device, that must demonstrate compliance with FCC rules and policies independent of any host. A transmitter with a modular grant can be installed in different end-use products (referred to as a host, host product or host device) by the grantee or other equipment manufacturer, then the host product may not require additional testing or equipment authorization for the transmitter function provided by that specific module or limited module device. The user must comply with all of the instructions provided by the Grantee, which indicate installation and/or operating conditions necessary for compliance. A host product itself is required to comply with all other applicable FCC equipment authorization regulations, requirements, and equipment functions that are not associated with the transmitter module portion. For example, compliance must be demonstrated: to regulations for other transmitter components within a host product; to requirements for unintentional radiators (Part 15 Subpart B), such as digital devices, computer peripherals, radio receivers, etc.; and to additional authorization requirements for the non-transmitter functions on the transmitter module (i.e., Suppliers Declaration of Conformity (SDoC) or certification) as appropriate (e.g., Bluetooth and Wi-Fi transmitter modules may also contain digital logic functions). Changes or modifications not expressly approved by the party responsible for compliance could void the user's authority to operate the equipment. 45.1.1 Labeling and User Information Requirements The WBZ450 module has been labeled with its own FCC ID number, and if the FCC ID is not visible when the module is installed inside another device, then the outside of the finished product into which the module is installed must display a label referring to the enclosed module. This exterior label must use the following wording:
Contains Transmitter Module FCC ID: 2ADHKWBZ450 or Contains FCC ID: 2ADHKWBZ450 This device complies with Part 15 of the FCC Rules. Operation is subject to the following two conditions:
(1) this device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation. The user's manual for the finished product must include the following statement:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1198 PIC32CX-BZ2 and WBZ45 Family Appendix A: Regulatory Approval This equipment has been tested and found to comply with the limits for a Class B digital device, pursuant to part 15 of the FCC Rules. These limits are designed to provide reasonable protection against harmful interference in a residential installation. This equipment generates, uses and can radiate radio frequency energy, and if not installed and used in accordance with the instructions, may cause harmful interference to radio communications. However, there is no guarantee that interference will not occur in a particular installation. If this equipment does cause harmful interference to radio or television reception, which can be determined by turning the equipment off and on, the user is encouraged to try to correct the interference by one or more of the following measures:
Increase the separation between the equipment and receiver Reorient or relocate the receiving antenna Connect the equipment into an outlet on a circuit different from that to which the receiver is connected Consult the dealer or an experienced radio/TV technician for help Additional information on labeling and user information requirements for Part 15 devices can be found in KDB Publication 784748, which is available at the FCC Office of Engineering and Technology (OET) Laboratory Division Knowledge Database (KDB) apps.fcc.gov/oetcf/kdb/index.cfm. 45.1.2 RF Exposure All transmitters regulated by FCC must comply with RF exposure requirements. KDB 447498 General RF Exposure Guidance provides guidance in determining whether proposed or existing transmitting facilities, operations or devices comply with limits for human exposure to Radio Frequency (RF) fields adopted by the Federal Communications Commission (FCC). From the FCC Grant: Output power listed is conducted. This grant is valid only when the module is sold to OEM integrators and must be installed by the OEM or OEM integrators. This transmitter is restricted for use with the specific antenna(s) tested in this application for Certification and must not be co-located or operating in conjunction with any other antenna or transmitters within a host device, except in accordance with FCC multi-transmitter product procedures. WBZ450: These modules are approved for installation into mobile host platforms atleast 20cm away from the human body. 45.1.3 Helpful Web Sites Federal Communications Commission (FCC): www.fcc.gov. FCC Office of Engineering and Technology (OET) Laboratory Division Knowledge Database (KDB) apps.fcc.gov/
oetcf/kdb/index.cfm. 45.2 Canada The WBZ450 module has been certified for use in Canada under Innovation, Science and Economic Development Canada (ISED, formerly Industry Canada) Radio Standards Procedure (RSP) RSP-100, Radio Standards Specification (RSS) RSS-Gen and RSS-247. Modular approval permits the installation of a module in a host device without the need to recertify the device. 45.2.1 Labeling and User Information Requirements Labeling Requirements (from RSP-100 - Issue 12, Section 5): The host product shall be properly labeled to identify the module within the host device. The Innovation, Science and Economic Development Canada certification label of a module shall be clearly visible at all times when installed in the host device; otherwise, the host product must be labeled to display the Innovation, Science and Economic Development Canada certification number of the module, preceded by the word Contains or similar wording expressing the same meaning, as follows:
Contains IC: 20266-WBZ450 User Manual Notice for License-Exempt Radio Apparatus (from Section 8.4 RSS-Gen, Issue 5, February 2021): User manuals for license-exempt radio apparatus shall contain the following or equivalent notice in a conspicuous location in the user manual or alternatively on the device or both:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1199 PIC32CX-BZ2 and WBZ45 Family Appendix A: Regulatory Approval This device contains license-exempt transmitter(s)/receiver(s) that comply with Innovation, Science and Economic Development Canadas license-exempt RSS(s). Operation is subject to the following two conditions:
(1) This device may not cause interference;
(2) This device must accept any interference, including interference that may cause undesired operation of the device. Lmetteur/rcepteur exempt de licence contenu dans le prsent appareil est conforme aux CNR dInnovation, Sciences et Dveloppement conomique Canada applicables aux appareils radio exempts de licence. Lexploitation est autorise aux deux conditions suivantes:
1. Lappareil ne doit pas produire de brouillage;
2. Lappareil doit accepter tout brouillage radiolectrique subi, mme si le brouillage est susceptible den compromettre le fonctionnement. Transmitter Antenna (From Section 6.8 RSS-GEN, Issue 5, February 2021): User manuals, for transmitters shall display the following notice in a conspicuous location:
This radio transmitter [IC: 20266-WBZ450] has been approved by Innovation, Science and Economic Development Canada to operate with the antenna types listed below, with the maximum permissible gain indicated. Antenna types not included in this list that have a gain greater than the maximum gain indicated for any type listed are strictly prohibited for use with this device. Le prsent metteur radio [IC: 20266-WBZ450] a t approuv par Innovation, Sciences et Dveloppement conomique Canada pour fonctionner avec les types d'antenne numrs cidessous et ayant un gain admissible maximal. Les types d'antenne non inclus dans cette liste, et dont le gain est suprieur au gain maximal indiqu pour tout type figurant sur la liste, sont strictement interdits pour l'exploitation de l'metteur. Immediately following the above notice, the manufacturer shall provide a list of all antenna types approved for use with the transmitter, indicating the maximum permissible antenna gain (in dBi) and required impedance for each. 45.2.2 RF Exposure All transmitters regulated by Innovation, Science and Economic Development Canada (ISED) must comply with RF exposure requirements listed in RSS-102 - Radio Frequency (RF) Exposure Compliance of Radiocommunication Apparatus (All Frequency Bands). This transmitter is restricted for use with a specific antenna tested in this application for certification, and must not be co-located or operating in conjunction with any other antenna or transmitters within a host device, except in accordance with Canada multi-transmitter product procedures. WBZ450: The device operates at an output power level which is within the ISED SAR test exemption limits at any user distance > 20cm. Tous les metteurs rglements par Innovation, Sciences et Dveloppement conomique Canada (ISDE) doivent tre conformes aux normes RF exigences d'exposition rpertories dans RSS-102 - Conformit l'exposition aux radiofrquences (RF) des radiocommunications Appareil (toutes les bandes de frquence). Cet metteur est limit une utilisation avec une antenne spcifique teste dans cette application pour la certification, et ne doit pas tre co-localis ou fonctionner en conjonction avec toute autre antenne ou metteur dans un dispositif hte, sauf dans conformment aux procdures des produits multi-metteurs du Canada. WBZ450 : L'appareil fonctionne un niveau de puissance de sortie qui se situe dans les limites d'exemption de test ISED SAR tout moment. distance utilisateur > 20 cm. 45.2.3 Helpful Web Sites Innovation, Science and Economic Development Canada (ISED): www.ic.gc.ca/. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1200 PIC32CX-BZ2 and WBZ45 Family Appendix A: Regulatory Approval 45.3 Europe The WBZ450 module has is/are a Radio Equipment Directive (RED) assessed radio module that is CE marked and has been manufactured and tested with the intention of being integrated into a final product. The WBZ450 module has has/have been tested to RED 2014/53/EU Essential Requirements mentioned in the following European Compliance table. Table 45-1. European Compliance Information Certification Safety Health EMC Radio Standard EN 62368 EN 62311 EN 301 489-1 EN 301 489-17 EN 300 328 Article 3.1a 3.1b 3.2 The ETSI provides guidance on modular devices in the Guide to the application of harmonised standards covering articles 3.1b and 3.2 of the RED 2014/53/EU (RED) to multi-radio and combined radio and non-
radio equipment document available at http://www.etsi.org/deliver/etsi_eg/203300_203399/20 3367/01.01.01_60/
eg_203367v010101p.pdf. Note:To maintain conformance to the standards listed in the preceding European Compliance table, the module shall be installed in accordance with the installation instructions in this data sheet and shall not be modified. When integrating a radio module into a completed product, the integrator becomes the manufacturer of the final product and is therefore responsible for demonstrating compliance of the final product with the essential requirements against the RED. 45.3.1 Labeling and User Information Requirements The label on the final product that contains the WBZ450 module has must follow CE marking requirements. 45.3.2 Conformity Assessment From ETSI Guidance Note EG 203367, section 6.1, when non-radio products are combined with a radio product:
If the manufacturer of the combined equipment installs the radio product in a host non-radio product in equivalent assessment conditions (i.e. host equivalent to the one used for the assessment of the radio product) and according to the installation instructions for the radio product, then no additional assessment of the combined equipment against article 3.2 of the RED is required. 45.3.2.1 Simplified EU Declaration of Conformity Hereby, Microchip Technology Inc. declares that the radio equipment type WBZ450 is in compliance with Directive 2014/53/EU. The full text of the EU declaration of conformity, for this product, is available at www.microchip.com/design-centers/
wireless-connectivity/. 45.3.3 Helpful Websites A document that can be used as a starting point in understanding the use of Short Range Devices (SRD) in Europe is the European Radio Communications Committee (ERC) Recommendation 70-03 E, which can be downloaded from the European Communications Committee (ECC) at: http://www.ecodocdb.dk/. Additional helpful web sites are:
Radio Equipment Directive (2014/53/EU):
https://ec.europa.eu/growth/single-market/european-standards/harmonised-standards/red_en European Conference of Postal and Telecommunications Administrations (CEPT):
http://www.cept.org 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1201 PIC32CX-BZ2 and WBZ45 Family Appendix A: Regulatory Approval European Telecommunications Standards Institute (ETSI):
http://www.etsi.org The Radio Equipment Directive Compliance Association (REDCA):
http://www.redca.eu/
45.4 Japan The WBZ450 module has has/have received type certification and is required to be labeled with its own technical conformity mark and certification number as required to conform to the technical standards regulated by the Ministry of Internal Affairs and Communications (MIC) of Japan pursuant to the Radio Act of Japan. Integration of this module into a final product does not require additional radio certification provided installation instructions are followed and no modifications of the module are allowed. Additional testing may be required:
If the host product is subject to electrical appliance safety (for example, powered from an AC mains), the host product may require Product Safety Electrical Appliance and Material (PSE) testing. The integrator should contact their conformance laboratory to determine if this testing is required There is an voluntary Electromagnetic Compatibility (EMC) test for the host product administered by VCCI:
www.vcci.jp/vcci_e/index.html 45.4.1 Labeling and User Information Requirements The label on the final product which contains the WBZ450 module has must follow Japan marking requirements. The integrator of the module should refer to the labeling requirements for Japan available at the Ministry of Internal Affairs and Communications (MIC) website. For the WBZ450 module, due to a limited module size, the technical conformity logo and ID is displayed in the data sheet and/or packaging and cannot be displayed on the module label. The final product in which this module is being used must have a label referring to the type certified module inside:
XXX-XXXXX 45.4.2 Helpful Web Sites Ministry of Internal Affairs and Communications (MIC): www.tele.soumu.go.jp/e/index.htm. Association of Radio Industries and Businesses (ARIB): www.arib.or.jp/english/. 45.5 Korea The WBZ450 module has has/have received certification of conformity in accordance with the Radio Waves Act. Integration of this module into a final product does not require additional radio certification provided installation instructions are followed and no modifications of the module are allowed. 45.5.1 Labeling and User Information Requirements The label on the final product which contains the WBZ450 module has must follow KC marking requirements. The integrator of the module should refer to the labeling requirements for Korea available on the Korea Communications Commission (KCC) website. The WBZ450 module is labeled with its own KC mark. The final product requires the KC mark and certificate number of the module:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1202 PIC32CX-BZ2 and WBZ45 Family Appendix A: Regulatory Approval XXXX-XXX-xxx-XXXXXXXXXXXX 45.5.2 Helpful Websites Korea Communications Commission (KCC): www.kcc.go.kr. National Radio Research Agency (RRA): rra.go.kr. 45.6 Taiwan The WBZ450 module has has/have received compliance approval in accordance with the Telecommunications Act. Customers seeking to use the compliance approval in their product should contact Microchip Technology sales or distribution partners to obtain a Letter of Authority. Integration of this module into a final product does not require additional radio certification provided installation instructions are followed and no modifications of the module are allowed. 45.6.1 Labeling and User Information Requirements For the WBZ450 module, due to the limited module size, the NCC mark and ID are displayed in the data sheet only and cannot be displayed on the module label:
CCANxxLPxxxxTx The user's manual should contain following warning (for RF device) in traditional Chinese:
NCC LP0002 _ 3.8.2 45.6.2 Helpful Web Sites National Communications Commission (NCC): www.ncc.gov.tw 45.7 Other Regulatory Information For information about other countries' jurisdictions not covered here, refer to the www.microchip.com/design-
centers/wireless-connectivity/certifications. Should other regulatory jurisdiction certification be required by the customer, or the customer needs to recertify the module for other reasons, contact Microchip for the required utilities and documentation. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1203 PIC32CX-BZ2 and WBZ45 Family Document Revision History 46. Document Revision History Revision A Date 12/2022 Section Document Description Initial revision 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1204 PIC32CX-BZ2 and WBZ45 Family Microchip Information The Microchip Website Microchip provides online support via our website at www.microchip.com/. This website is used to make files and information easily available to customers. Some of the content available includes:
Product Support Data sheets and errata, application notes and sample programs, design resources, users guides and hardware support documents, latest software releases and archived software General Technical Support Frequently Asked Questions (FAQs), technical support requests, online discussion groups, Microchip design partner program member listing Business of Microchip Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives Product Change Notification Service Microchips product change notification service helps keep customers current on Microchip products. Subscribers will receive email notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest. To register, go to www.microchip.com/pcn and follow the registration instructions. Customer Support Users of Microchip products can receive assistance through several channels:
Distributor or Representative Local Sales Office Embedded Solutions Engineer (ESE) Technical Support Customers should contact their distributor, representative or ESE for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in this document. Technical support is available through the website at: www.microchip.com/support Microchip Devices Code Protection Feature Note the following details of the code protection feature on Microchip products:
Microchip products meet the specifications contained in their particular Microchip Data Sheet. Microchip believes that its family of products is secure when used in the intended manner, within operating specifications, and under normal conditions. Microchip values and aggressively protects its intellectual property rights. Attempts to breach the code protection features of Microchip product is strictly prohibited and may violate the Digital Millennium Copyright Act. Neither Microchip nor any other semiconductor manufacturer can guarantee the security of its code. Code protection does not mean that we are guaranteeing the product is unbreakable. Code protection is constantly evolving. Microchip is committed to continuously improving the code protection features of our products. Legal Notice This publication and the information herein may be used only with Microchip products, including to design, test, and integrate Microchip products with your application. Use of this information in any other manner violates these terms. Information regarding device applications is provided only for your convenience and may be superseded 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1205 PIC32CX-BZ2 and WBZ45 Family by updates. It is your responsibility to ensure that your application meets with your specifications. Contact your local Microchip sales office for additional support or, obtain additional support at www.microchip.com/en-us/support/
design-help/client-support-services. THIS INFORMATION IS PROVIDED BY MICROCHIP "AS IS". MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE, OR WARRANTIES RELATED TO ITS CONDITION, QUALITY, OR PERFORMANCE. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL, OR CONSEQUENTIAL LOSS, DAMAGE, COST, OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE INFORMATION OR ITS USE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THE INFORMATION OR ITS USE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THE INFORMATION. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights unless otherwise stated. Trademarks The Microchip name and logo, the Microchip logo, Adaptec, AVR, AVR logo, AVR Freaks, BesTime, BitCloud, CryptoMemory, CryptoRF, dsPIC, flexPWR, HELDO, IGLOO, JukeBlox, KeeLoq, Kleer, LANCheck, LinkMD, maXStylus, maXTouch, MediaLB, megaAVR, Microsemi, Microsemi logo, MOST, MOST logo, MPLAB, OptoLyzer, PIC, picoPower, PICSTART, PIC32 logo, PolarFire, Prochip Designer, QTouch, SAM-BA, SenGenuity, SpyNIC, SST, SST Logo, SuperFlash, Symmetricom, SyncServer, Tachyon, TimeSource, tinyAVR, UNI/O, Vectron, and XMEGA are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. AgileSwitch, APT, ClockWorks, The Embedded Control Solutions Company, EtherSynch, Flashtec, Hyper Speed Control, HyperLight Load, Libero, motorBench, mTouch, Powermite 3, Precision Edge, ProASIC, ProASIC Plus, ProASIC Plus logo, Quiet- Wire, SmartFusion, SyncWorld, Temux, TimeCesium, TimeHub, TimePictra, TimeProvider, TrueTime, and ZL are registered trademarks of Microchip Technology Incorporated in the U.S.A. Adjacent Key Suppression, AKS, Analog-for-the-Digital Age, Any Capacitor, AnyIn, AnyOut, Augmented Switching, BlueSky, BodyCom, Clockstudio, CodeGuard, CryptoAuthentication, CryptoAutomotive, CryptoCompanion, CryptoController, dsPICDEM, dsPICDEM.net, Dynamic Average Matching, DAM, ECAN, Espresso T1S, EtherGREEN, GridTime, IdealBridge, In-Circuit Serial Programming, ICSP, INICnet, Intelligent Paralleling, IntelliMOS, Inter-Chip Connectivity, JitterBlocker, Knob-on-Display, KoD, maxCrypto, maxView, memBrain, Mindi, MiWi, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, MultiTRAK, NetDetach, Omniscient Code Generation, PICDEM, PICDEM.net, PICkit, PICtail, PowerSmart, PureSilicon, QMatrix, REAL ICE, Ripple Blocker, RTAX, RTG4, SAM-
ICE, Serial Quad I/O, simpleMAP, SimpliPHY, SmartBuffer, SmartHLS, SMART-I.S., storClad, SQI, SuperSwitcher, SuperSwitcher II, Switchtec, SynchroPHY, Total Endurance, Trusted Time, TSHARC, USBCheck, VariSense, VectorBlox, VeriPHY, ViewSpan, WiperLock, XpressConnect, and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. The Adaptec logo, Frequency on Demand, Silicon Storage Technology, and Symmcom are registered trademarks of Microchip Technology Inc. in other countries. GestIC is a registered trademark of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of Microchip Technology Inc., in other countries. All other trademarks mentioned herein are property of their respective companies. 2023, Microchip Technology Incorporated and its subsidiaries. All Rights Reserved. ISBN:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1206 PIC32CX-BZ2 and WBZ45 Family Quality Management System For information regarding Microchips Quality Management Systems, please visit www.microchip.com/quality. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1207 Worldwide Sales and Service AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support:
www.microchip.com/support Web Address:
www.microchip.com Atlanta Duluth, GA Tel: 678-957-9614 Fax: 678-957-1455 Austin, TX Tel: 512-257-3370 Boston Westborough, MA Tel: 774-760-0087 Fax: 774-760-0088 Chicago Itasca, IL Tel: 630-285-0071 Fax: 630-285-0075 Dallas Addison, TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Novi, MI Tel: 248-848-4000 Houston, TX Tel: 281-894-5983 Indianapolis Noblesville, IN Tel: 317-773-8323 Fax: 317-773-5453 Tel: 317-536-2380 Los Angeles Mission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608 Tel: 951-273-7800 Raleigh, NC Tel: 919-844-7510 New York, NY Tel: 631-435-6000 San Jose, CA Tel: 408-735-9110 Tel: 408-436-4270 Canada - Toronto Tel: 905-695-1980 Fax: 905-695-2078 India - Bangalore Tel: 91-80-3090-4444 India - New Delhi Tel: 91-11-4160-8631 India - Pune Tel: 91-20-4121-0141 Japan - Osaka Tel: 81-6-6152-7160 Japan - Tokyo Tel: 81-3-6880- 3770 Korea - Daegu Tel: 82-53-744-4301 Korea - Seoul Tel: 82-2-554-7200 Malaysia - Kuala Lumpur Tel: 60-3-7651-7906 Malaysia - Penang Tel: 60-4-227-8870 Philippines - Manila Tel: 63-2-634-9065 Singapore Tel: 65-6334-8870 Taiwan - Hsin Chu Tel: 886-3-577-8366 Taiwan - Kaohsiung Tel: 886-7-213-7830 Taiwan - Taipei Tel: 886-2-2508-8600 Thailand - Bangkok Tel: 66-2-694-1351 Vietnam - Ho Chi Minh Tel: 84-28-5448-2100 Australia - Sydney Tel: 61-2-9868-6733 China - Beijing Tel: 86-10-8569-7000 China - Chengdu Tel: 86-28-8665-5511 China - Chongqing Tel: 86-23-8980-9588 China - Dongguan Tel: 86-769-8702-9880 China - Guangzhou Tel: 86-20-8755-8029 China - Hangzhou Tel: 86-571-8792-8115 China - Hong Kong SAR Tel: 852-2943-5100 China - Nanjing Tel: 86-25-8473-2460 China - Qingdao Tel: 86-532-8502-7355 China - Shanghai Tel: 86-21-3326-8000 China - Shenyang Tel: 86-24-2334-2829 China - Shenzhen Tel: 86-755-8864-2200 China - Suzhou Tel: 86-186-6233-1526 China - Wuhan Tel: 86-27-5980-5300 China - Xian Tel: 86-29-8833-7252 China - Xiamen Tel: 86-592-2388138 China - Zhuhai Tel: 86-756-3210040 Austria - Wels Tel: 43-7242-2244-39 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4485-5910 Fax: 45-4485-2829 Finland - Espoo Tel: 358-9-4520-820 France - Paris Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Germany - Garching Tel: 49-8931-9700 Germany - Haan Tel: 49-2129-3766400 Germany - Heilbronn Tel: 49-7131-72400 Germany - Karlsruhe Tel: 49-721-625370 Germany - Munich Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Germany - Rosenheim Tel: 49-8031-354-560 Israel - Raanana Tel: 972-9-744-7705 Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Italy - Padova Tel: 39-049-7625286 Netherlands - Drunen Tel: 31-416-690399 Fax: 31-416-690340 Norway - Trondheim Tel: 47-72884388 Poland - Warsaw Tel: 48-22-3325737 Romania - Bucharest Tel: 40-21-407-87-50 Spain - Madrid Tel: 34-91-708-08-90 Fax: 34-91-708-08-91 Sweden - Gothenberg Tel: 46-31-704-60-40 Sweden - Stockholm Tel: 46-8-5090-4654 UK - Wokingham Tel: 44-118-921-5800 Fax: 44-118-921-5820 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1208
1 | User Manual part 1 | Users Manual | 5.00 MiB | January 09 2023 / July 06 2023 | delayed release |
PIC32CX-BZ2 and WBZ45 Family High-performance 2.4 GHz Multi-protocol Wireless MCUs and Modules, supporting Bluetooth Low Energy and 802.15.4 protocols with 32-bit ARM Cortex-M4F, 2 Msps 12-bit ADC Data Sheet Introduction The PIC32CX-BZ2 family is a general purpose, low-cost, 32-bit Microcontroller (MCU) family of devices supporting multi-protocol wireless interfaces (Bluetooth and Zigbee), hardware-based security accelerator, transceiver and Power Management Unit (PMU). The WBZ45 Module is a series of fully RF-certified wireless modules that contain the PIC32CX-BZ2 wireless MCUs with the following antenna options:
PCB Antenna u.FL Connector for External Antenna In addition to the Bluetooth Low Energy (Bluetooth 5.2) and Zigbee (Zigbee 3.0) wireless protocol support, the PIC32CX-BZ2 devices and the WBZ45 modules also support a rich set of standard MCU peripherals, such as Analog-to-Digital Converter (ADC), Serial Peripheral Interface (SPI), Inter-Integrated Circuit (I2C), Quad I/O Serial Peripheral Interface (QSPI), Universal Asynchronous Receiver-Transmitter (UART) and Serial Wire Debug (SWD). PIC32CX-BZ2 SoC Family Features The following section lists the PIC32CX-BZ2 SoC related features:
Operating Conditions of MCUs 1.9V to 3.6V, -40C to +125C, DC to 64 MHz AEC Q100 Grade 1 qualified Core: 64 MHz ARM Cortex-M4 3.35 Coremark/MHz 4 KB Combined Instruction Cache and Data Cache 8-Zone Memory Protection Unit (MPU) Thumb-2 Instruction Set Digital Signal Processing ASE Rev 2 Nested Vector Interrupt Controller (NVIC) Embedded Trace Module (ETM) with Instruction Trace Stream Core Sight Embedded Trace Buffer (ETB) Trace Port Interface Unit (TPIU) IEEE 754-Compliant Floating Point Unit (FPU) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 1 PIC32CX-BZ2 and WBZ45 Family Memories 1 MB On-Chip Self-Programmable Flash with:
Error Correction Code (ECC) Prefetch module to speed up Flash accesses 20-years of data retention support 32 KB NVR Flash (8 Sectors) Private/public boot code and data NV calibration data 128 KB Multi-Port Programmable QoS SRAM Main Memory 64 KB of Error Correction Code (ECC) RAM option Up to 4 KB of Tightly Coupled Memory (TCM) Up to 8 KB Backup SRAM Single 32-bit Backup Register System Internal and External Clock Options Power-on Reset (POR) and Brown-out Detect (BOD) External Interrupt Controller (EIC) Up to four External Interrupts One Non-maskable Interrupt 2-pin Serial Wire Debug (SWD) Programming, Test and Debugging Interface Supported Connectivity Standards Complies with:
Bluetooth v5.2 IEEE 802.15.4, Zigbee 3.0 ETSI EN 300 328 and EN 300 440 Class 2 FCC CFR47 Part 15 and ARIB STD-T66 Power Supply Integrated PMU with:
Buck (DC-DC/switching) mode; supports High Power (PWM) and Low Power (PSK) mode MLDO (linear) mode On-board 1.2V Voltage Regulator (CLDO) Power-on Reset (POR) and Brown-out Detect (BOD) on 3.3V and 1.2V Rails Run, Idle, Dream, Sleep, Deep Sleep and Extreme Deep Sleep Modes Sleep Walking Peripherals Embedded Buck/LDO Regulator Supporting On-the-Fly (OTF) Selection 2.4 GHz RF Transceiver Integrated 2.4 GHz Ultra-low Power RF Transceiver shared among Bluetooth, Zigbee Modems, Link (MAC) Controllers and Proprietary Modulation Schemes Integrated 16 MHz 20 ppm Crystal Oscillator (External Low Cost Crystal) Two PA Design Architecture (LPA (+4 dBm) and MPA (+12 dBm)) to Improve TX Power Efficiency 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 2 PIC32CX-BZ2 and WBZ45 Family Low RBOM Two-port TRX RFFE Architecture Integrated balun (single-ended RF output) and TRX switch Hardware Radio Arbiter with Programmable QoS:
Resolution per packet level Time-division coexistence between Bluetooth and 802.15.4 Based on shared transceiver and antenna Maintains connections of 802.15.4 and Bluetooth simultaneously Bluetooth Bluetooth Low Energy 5.2 Certified Up to +12 dBm Programmable Transmit Output Power Typical Receiver Power Sensitivity:
-95 dBm for Bluetooth Low Energy 1 Mbps
-92 dBm for Bluetooth Low Energy 2 Mbps
-102 dBm for Bluetooth Low Energy 125 Kbps
-99 dBm for Bluetooth Low Energy 500 Kbps Digital RSSI indicator (-50 dBm to -90 dBm) Bluetooth Supported Features:
2M uncoded PHY Long range (Coded PHY) Channel selection algorithm #2 Advertising extensions, offloads CPU with hardware-based scheduler High duty cycle non-connectible advertising Data length extensions Secure connections Privacy upgrades (with hardware white-list support) ECDH P256 Hardware Engine for Link Key Generation when Bluetooth Pairing AES128 Hardware Module for Real-Time Bluetooth Payload Data Encryption Preprogrammed MAC Address Bluetooth Qualification Test Facility (BQTF) Certification Bluetooth Low Energy Profiles:
Bluetooth Low Energy peripheral and central roles Bluetooth Low Energy APIs for application layer to implement standard or customize GATT based profiles/
services Microchip Transparent UART Service Battery Service Device Information Service Custom Service Multi-link and multi-role Bluetooth Low Energy Services:
Provisioning Over-the-Air (OTA) update (also known as DFU) Advertisement/Beacon Personalized configuration Alert notification service 802.15.4/Zigbee Modulation Scheme 802.15.4/Zigbee Physical Layer Service Unit (PSDU) Data Rate: 250 Kbps 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 3 PIC32CX-BZ2 and WBZ45 Family Programmable RX Mode
-103 dBm RX sensitivity in the Continuous mode
-98 dBm sensitivity in RPC mode RPC mode provides lower power consumption in RX mode to support California Green Energy Specification at the system level TX Output Power up to +12 dBm Hardware Assisted MAC Auto acknowledge Auto retry Channel access back-off Preprogrammed MAC Address SFD Detection; Spreading; De-spreading; Framing; CRC-16 Computation Independent TX/RX Buffers for Improved CPU Offloading While Handling Zigbee Data 128-byte TX and 128-byte RX frame buffer Hardware Security Advanced Encryption Standard (AES) True Random Number Generator (TRNG) Zigbee Stack Support Zigbee 3.0 ready Zigbee Pro 2017 Zigbee green power support (proxy, sink and multi-sensor) Proprietary Proprietary Data Rates: 500 Kbps, 1 Mbps and 2 Mbps TX Output Power up to +12 dBm Receiver Sensitivity up to -96 dBm Hardware Assisted MAC Auto acknowledge Auto retry Channel access back-off SFD Detection; Spreading; De-spreading; Framing; CRC-16 Computation Independent TX/RX Buffers for Improved CPU Offloading While Handling Zigbee Data 128-byte TX and 128-byte RX frame buffer Hardware Security Advanced Encryption Standard (AES) True Random Number Generator (TRNG) High Performance Peripherals 16-Channel Direct Memory Access Controller (DMAC) Built-in CRC with memory CRC generation/monitor hardware support One Quad I/O Serial Peripheral Interface (QSPI) execute-In-Place (xIP) support Dedicated AHB memory zone System Peripherals 32-Channel Event System 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 4 PIC32CX-BZ2 and WBZ45 Family All channels can be connected to any event generator All channels provide a pure asynchronous path Twelve channels support synchronous and re-synchronous Four Serial Communication Interfaces (SERCOM), Each Configurable to Operate as:
USART with full-duplex and single-wire half-duplex configuration ISO7816 I2C up to 1 MHz (three SERCOMs support I2C) LIN Commander/Responder RS485 SPI inter-byte space Four 16-bit Timers/Counters (TC), Each Configurable as:
16-bit TC with two compare/capture channels 8-bit TC with two compare/capture channels 32-bit TC with two compare/capture channels Two 24-bit Timer/Counters for Control (TCC) with Extended Functions:
Up to six compare channels with optional complementary output Generation of synchronized Pulse Width Modulation (PWM) pattern across port pins Deterministic fault protection, fast decay and configurable dead-time between complementary output Dithering that increases resolution with up to 5 bits and reduces quantization error One 16-bit Timer/Counters for Control (TCC) with Extended Functions:
Up to two compare channels with optional complementary output 32-bit Real Time Counter (RTCC) with Clock/Calendar Function Up to one Wake-up Pin with Tamper Detection and Debouncing Filter Watchdog Timer (WDT) with Window Mode Deadman Timer (DMT) CRC-32 Generator Frequency Meter (FREQM) Two Configurable Custom Logic (CCL) One Analog Comparator (AC) with Window Compare function One Temperature Sensor (Die Temperature) Advanced Analog 12-bit ADC SAR Module (ADC):
Up to Eight Analog Channels Up to Two MSPS conversion rate Multiple trigger sources Supports die temperature sensor built into RF-Analog (not an external ambient temperature sensor) Two Analog Comparator (AC) with Window Compare Function or single Analog Comparator One dedicated AC and second AC is shared with PMU Controller Security AES Engine with Support for 128/192/256-bit Cryptographic Key One AES with 256-bit Key Length and up to 2 MB/s Data Rate Five confidential modes of operation (ECB, CBC, CFB, OFB and CTR) Supports counter with CBC-MAC mode Galois Counter Mode (GCM) True Random Number Generator (TRNG) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 5 PIC32CX-BZ2 and WBZ45 Family Public Key Cryptography Controller (PUKCC) and Associated Classical Public Key Cryptography Library
(PUKCL) RSA and DSA algorithm Elliptic Curves Cryptography (ECC), ECC GF (2n) and ECCGF (p) Integrity Check Module (ICM) Based on Secure Hash Algorithm (SHA1, SHA224 and SHA256), DMA Assisted Oscillators 16 MHz, 20 PPM Crystal/Resonator Oscillator or External Clock (POSC) for 2.4G RF Transceiver Shared System PLL with Bluetooth/Zigbee RF Data Converter PLL 32.768 kHz Ultra-low Power Internal Oscillator Higher Accuracy 32.768 kHz, 250 ppm Clock Options POSC derived 32 kHz clock 32.768 kHz crystal/resonator oscillator (SOSC) External 32.768 kHz clock source 8 MHz Internal RC Oscillator (FRC) I/O Flexible Peripheral Pin Select (PPS) Support High-Current Sink/Source on Most I/O Pins Configurable Open-Drain Output on Digital I/O Pins Up to 27 Programmable I/O Pins Package PIC32CX1012BZ25048 Package:
48-pin QFN Size 7 mm x 7 mm x 0.9 mm PIC32CX1012BZ25032 Package:
32-pin QFN Size - 5 mm x 5 mm x 1 mm WBZ45 Module Features The WBZ45 modules are wireless MCU modules with BLE 5.2 compliant and Zigbee 3.1 Radio. The following section lists the WBZ45 Module related features, which complement SoC features:
WBZ45 Module Variants WBZ451 based on (PIC32CX1012BZ25048 SoC) WBZ451PE (PCB) WBZ451UE (u.FL) WBZ450 based on (PIC32CX1012BZ25032 SoC) WBZ450PC (PCB) WBZ450UC (u.FL) WBZ450PE (PCB) WBZ450UE (u.FL) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 6 PIC32CX-BZ2 and WBZ45 Family Antenna On-Board PCB Antenna External Antenna Clock Management Integrated 16 MHz POSC System Peripheral, Advanced Analog and Security All features of SoC are accessible Package and Operating Conditions WBZ451 39-pin SMD package with Shield CAN Size 15.5 mm x 20.7 mm x 2.8 mm WBZ450 30-pin SMD package with Shield CAN Size 13.4 mm x 18.7 mm x 2.8 mm Operating Conditions 1.9V to 3.6V, -40C to +85C, DC to 64 MHz Certifications Certified to FCC, ISED and CE Radio Regulations RoHS and REACH Compliant Note:Traditional LIN documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Commander and Responder, respectively. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 7 PIC32CX-BZ2 and WBZ45 Family Table of Contents Introduction.....................................................................................................................................................1 PIC32CX-BZ2 SoC Family Features..............................................................................................................1 Operating Conditions of MCUs............................................................................................................... 1 Core: 64 MHz ARM Cortex
-M4............................................................................................................ 1 Memories................................................................................................................................................ 2 System.................................................................................................................................................... 2 Supported Connectivity Standards..........................................................................................................2 Power Supply.......................................................................................................................................... 2 2.4 GHz RF Transceiver..........................................................................................................................2 Bluetooth................................................................................................................................................. 3 802.15.4/Zigbee Modulation Scheme..................................................................................................... 3 Proprietary...............................................................................................................................................4 High Performance Peripherals................................................................................................................ 4 System Peripherals................................................................................................................................. 4 Advanced Analog.................................................................................................................................... 5 Security................................................................................................................................................... 5 Oscillators............................................................................................................................................... 6 I/O........................................................................................................................................................... 6 Package.................................................................................................................................................. 6 WBZ45 Module Features............................................................................................................................... 6 WBZ45 Module Variants..........................................................................................................................6 Antenna...................................................................................................................................................7 Clock Management................................................................................................................................. 7 System Peripheral, Advanced Analog and Security................................................................................7 Package and Operating Conditions........................................................................................................ 7 Certifications........................................................................................................................................... 7 1. Ordering Information............................................................................................................................. 18 1.1. PIC32CXBZ2 SoC and WBZ45 Module Ordering Information................................................... 18 2. Configuration Summary........................................................................................................................ 19 3. PIC32CX-BZ2 SoC Description............................................................................................................ 20 3.1. PIC32CX-BZ2 SoC Block Diagram............................................................................................ 20 3.2. Pinout Diagram...........................................................................................................................20 4. WBZ45 Module Description.................................................................................................................. 22 4.1. Pinout Diagram...........................................................................................................................22 4.2. Basic Connection Requirement..................................................................................................23 4.3. WBZ45 Module Placement Guidelines.......................................................................................25 4.4. WBZ45 Module Routing Guidelines........................................................................................... 26 4.5. WBZ45 Module RF Considerations............................................................................................27 4.6. WBZ45 Module Antenna Considerations................................................................................... 27 4.7. WBZ45 Module Reflow Profile Information................................................................................ 29 4.8. WBZ45 Module Assembly Considerations................................................................................. 30 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 8 PIC32CX-BZ2 and WBZ45 Family 5. Pinout and Signal Descriptions List.......................................................................................................31 6. I/O Ports and Peripheral Pin Select (PPS)............................................................................................33 6.1. Control Registers........................................................................................................................34 6.2. Peripheral Pin Select (PPS)....................................................................................................... 36 6.3. Function Priority for Device Pins................................................................................................ 49 6.4. I/O Ports Control Registers........................................................................................................ 55 6.5. Operation in Power Saving Modes.............................................................................................72 6.6. Results of Various Resets.......................................................................................................... 73 7. Power Subsystem................................................................................................................................. 74 7.1. Block Diagram............................................................................................................................ 74 7.2. Voltage Regulators..................................................................................................................... 75 7.3. Power Supply Modes................................................................................................................. 75 7.4. Typical Power Supply Connection for SoC.................................................................................76 7.5. Typical Power Supply Connection for Module............................................................................76 7.6. Power-Up Sequence.................................................................................................................. 77 8. Product Memory Mapping Overview..................................................................................................... 78 9. Prefetch Cache (PCHE)........................................................................................................................ 81 9.1. Introduction.................................................................................................................................81 9.2. Features..................................................................................................................................... 81 9.3. Overview.................................................................................................................................... 81 9.4. Prefetch Behavior.......................................................................................................................83 9.5. Configurations............................................................................................................................ 83 9.6. Predictive Prefetch Behavior...................................................................................................... 84 9.7. Coherency Support.................................................................................................................... 84 9.8. Effects of Reset.......................................................................................................................... 84 9.9. Error Conditions......................................................................................................................... 85 9.10. Operation in Power-saving Modes............................................................................................. 85 9.11. Register Summary (PCHE)........................................................................................................ 87 9.12. Register Description................................................................................................................... 87 10. Processor and Architecture...................................................................................................................94 10.1. Cortex M4 Processor..................................................................................................................94 10.2. Nested Vector Interrupt Controller (NVIC)..................................................................................96 10.3. High-Speed Bus System.......................................................................................................... 102 11. Cortex M Cache Controller (CMCC)................................................................................................... 104 11.1. Overview.................................................................................................................................. 104 11.2. Features................................................................................................................................... 104 11.3. Block Diagram.......................................................................................................................... 105 11.4. Signal Description.................................................................................................................... 106 11.5. Product Dependencies............................................................................................................. 106 11.6. Functional Description..............................................................................................................107 11.7. DEBUG Mode...........................................................................................................................109 11.8. RAM Properties........................................................................................................................ 109 11.9. Register Summary.................................................................................................................... 111 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 9 PIC32CX-BZ2 and WBZ45 Family 11.10. Register Description.................................................................................................................111 12. Device Service Unit (DSU)..................................................................................................................124 12.1. Overview.................................................................................................................................. 124 12.2. Features................................................................................................................................... 124 12.3. Block Diagram.......................................................................................................................... 124 12.4. Signal Description.................................................................................................................... 124 12.5. Product Dependencies............................................................................................................. 125 12.6. Debug Operation...................................................................................................................... 126 12.7. Chip Erase................................................................................................................................127 12.8. Programming............................................................................................................................127 12.9. Intellectual Property Protection................................................................................................ 128 12.10. Device Identification................................................................................................................ 129 12.11. Functional Description.............................................................................................................130 12.12. DSU Register Summary..........................................................................................................133 12.13. Register Description................................................................................................................134 13. Clock and Reset Unit (CRU)............................................................................................................... 155 13.1. Overview.................................................................................................................................. 155 13.2. Features................................................................................................................................... 155 13.3. Block Diagram.......................................................................................................................... 156 13.4. System and Peripheral Clock Generation (CLKGEN).............................................................. 158 13.5. Idle Mode..................................................................................................................................158 13.6. Dream Mode.............................................................................................................................158 13.7. FRCDIV.................................................................................................................................... 159 13.8. RFPLL Wrapper....................................................................................................................... 159 13.9. Start-up Considerations............................................................................................................159 13.10. Fail-Safe Clock Monitor...........................................................................................................159 13.11. Fast RC Oscillator................................................................................................................... 159 13.12. Secondary Oscillator............................................................................................................... 160 13.13. Low Power RC Oscillator (LPRC)........................................................................................... 160 13.14. Reference Clock Generator.................................................................................................... 160 13.15. CRU Configuration Registers..................................................................................................162 13.16. Register Summary.................................................................................................................. 163 13.17. Register Description................................................................................................................164 13.18. Resets..................................................................................................................................... 182 14. RAM Error Correction Code (RAMECC)............................................................................................. 197 14.1. Overview.................................................................................................................................. 197 14.2. Features................................................................................................................................... 197 14.3. Block Diagram.......................................................................................................................... 197 14.4. Signal Description.................................................................................................................... 197 14.5. Product Dependencies............................................................................................................. 198 14.6. Functional Description..............................................................................................................199 14.7. Register Summary - RAMECC.................................................................................................200 14.8. Register Description................................................................................................................. 200 15. Power Management Unit (PMU)......................................................................................................... 207 15.1. Overview.................................................................................................................................. 207 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 10 PIC32CX-BZ2 and WBZ45 Family 15.2. Power Modes........................................................................................................................... 207 16. Watchdog Timer (WDT).......................................................................................................................209 16.1. Overview.................................................................................................................................. 209 16.2. Features................................................................................................................................... 209 16.3. Applications.............................................................................................................................. 209 16.4. Block Diagram.......................................................................................................................... 211 16.5. Configuration............................................................................................................................ 211 16.6. Register Summary - WDT........................................................................................................ 212 16.7. Register Description................................................................................................................. 212 17. Deadman Timer (DMT)....................................................................................................................... 214 17.1. Overview.................................................................................................................................. 214 17.2. Features................................................................................................................................... 214 17.3. Block Diagram.......................................................................................................................... 214 17.4. DMT Operation.........................................................................................................................215 17.5. Register Summary....................................................................................................................218 17.6. Register Description................................................................................................................. 219 18. System Configuration and Register Locking (CFG)............................................................................ 228 18.1. Overview.................................................................................................................................. 228 18.2. Applications.............................................................................................................................. 229 18.3. CFG Register Summary........................................................................................................... 230 18.4. Register Description................................................................................................................. 231 19. Register Locking................................................................................................................................. 263 19.1. System Lock Register.............................................................................................................. 263 19.2. Register Summary....................................................................................................................265 19.3. Register Description................................................................................................................. 265 20. Peripheral Module Disable Register (PMD)........................................................................................ 267 20.1. Overview.................................................................................................................................. 267 20.2. Enabling Peripherals................................................................................................................ 267 20.3. Registers and Bits.................................................................................................................... 267 20.4. PMD Register........................................................................................................................... 267 20.5. PMDx Initialization Values by Variant Name.............................................................................271 21. Real-Time Counter and Calendar (RTCC).......................................................................................... 273 21.1. Overview.................................................................................................................................. 273 21.2. Features................................................................................................................................... 273 21.3. Block Diagram.......................................................................................................................... 273 21.4. Signal Description.................................................................................................................... 274 21.5. Product Dependencies............................................................................................................. 275 21.6. Functional Description..............................................................................................................276 21.7. Register Summary - Mode 0 - 32-Bit Counter.......................................................................... 286 21.8. Register Description - Mode 0 - 32-Bit Counter....................................................................... 287 21.9. Register Summary - Mode 1 - 16-Bit Counter.......................................................................... 306 21.10. Register Description - Mode 1 - 16-Bit Counter...................................................................... 307 21.11. Register Summary - Mode 2 - Clock/Calendar........................................................................327 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 11 PIC32CX-BZ2 and WBZ45 Family 21.12. Register Description - Mode 2 - Clock/Calendar.....................................................................328 22. Direct Memory Access Controller (DMAC)..........................................................................................347 22.1. Overview.................................................................................................................................. 347 22.2. Features................................................................................................................................... 347 22.3. Block Diagram.......................................................................................................................... 349 22.4. Signal Description.................................................................................................................... 349 22.5. Product Dependencies............................................................................................................. 349 22.6. Functional Description..............................................................................................................350 22.7. DMAC Register Summary........................................................................................................ 373 22.8. Register Description................................................................................................................. 378 22.9. DMAC Register Summary (SRAM).......................................................................................... 406 22.10. Register Description - SRAM.................................................................................................. 406 23. External Interrupt Controller (EIC).......................................................................................................413 23.1. Overview.................................................................................................................................. 413 23.2. Features................................................................................................................................... 413 23.3. Block Diagram.......................................................................................................................... 413 23.4. Signal Description.................................................................................................................... 413 23.5. Product Dependencies............................................................................................................. 414 23.6. Functional Description..............................................................................................................415 23.7. EIC Register Summary.............................................................................................................421 23.8. Register Description................................................................................................................. 421 24. Flash Memory..................................................................................................................................... 436 24.1. Overview.................................................................................................................................. 436 24.2. Features................................................................................................................................... 436 24.3. Functional Block Diagram........................................................................................................ 437 24.4. Flash Memory Addressing........................................................................................................437 24.5. Memory Configuration.............................................................................................................. 437 24.6. Boot Flash Memory (BFM) Partitions....................................................................................... 438 24.7. Program Flash Memory (PFM) Partitions.................................................................................439 24.8. Error Correcting Code (ECC) and Flash Programming............................................................439 24.9. Interrupts.................................................................................................................................. 440 24.10. Error Detection ....................................................................................................................... 440 24.11. NVMKEY Register Unlocking Sequence.................................................................................441 24.12. Word Programming................................................................................................................. 442 24.13. Quad Word Programming....................................................................................................... 443 24.14. Row Programming.................................................................................................................. 444 24.15. Page Erase............................................................................................................................. 445 24.16. Program Flash Memory (PFM) Erase..................................................................................... 447 24.17. Pre-Program............................................................................................................................448 24.18. Device Code Protection bit (CP)............................................................................................. 448 24.19. Operation in Power-Saving Modes......................................................................................... 448 24.20. Operation in Debug Mode....................................................................................................... 448 24.21. Effects of Various Resets........................................................................................................ 448 24.22. Control Registers.................................................................................................................... 448 25. Integrity Check Monitor (ICM)............................................................................................................. 467 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 12 PIC32CX-BZ2 and WBZ45 Family 25.1. Overview.................................................................................................................................. 467 25.2. Features................................................................................................................................... 467 25.3. Block Diagram.......................................................................................................................... 468 25.4. Signal Description.................................................................................................................... 468 25.5. Product Dependencies............................................................................................................. 468 25.6. Functional Description..............................................................................................................469 25.7. Register Summary - ICM..........................................................................................................481 25.8. Register Description................................................................................................................. 482 26. Peripheral Access Controller (PAC).................................................................................................... 500 26.1. Overview.................................................................................................................................. 500 26.2. Features................................................................................................................................... 500 26.3. Block Diagram.......................................................................................................................... 500 26.4. Product Dependencies............................................................................................................. 500 26.5. Functional Description..............................................................................................................501 26.6. Register Summary....................................................................................................................504 26.7. Register Description................................................................................................................. 504 27. Frequency Meter (FREQM).................................................................................................................519 27.1. Overview.................................................................................................................................. 519 27.2. Features................................................................................................................................... 519 27.3. Block Diagram.......................................................................................................................... 519 27.4. Signal Description.................................................................................................................... 519 27.5. Product Dependencies............................................................................................................. 519 27.6. Functional Description..............................................................................................................520 27.7. Register Summary - FREQM................................................................................................... 523 27.8. Register Description................................................................................................................. 523 28. Event System (EVSYS).......................................................................................................................533 28.1. Overview.................................................................................................................................. 533 28.2. Features................................................................................................................................... 533 28.3. Block Diagram.......................................................................................................................... 533 28.4. Product Dependencies............................................................................................................. 533 28.5. Functional Description..............................................................................................................534 28.6. Register Summary....................................................................................................................540 28.7. Register Description................................................................................................................. 544 29. Serial Communication Interface (SERCOM).......................................................................................560 29.1. Overview.................................................................................................................................. 560 29.2. Features................................................................................................................................... 560 29.3. Block Diagram.......................................................................................................................... 560 29.4. Signal Description.................................................................................................................... 561 29.5. Product Dependencies............................................................................................................. 561 29.6. Functional Description..............................................................................................................562 30. SERCOM Synchronous and Asynchronous Receiver and Transmitter (SERCOM USART).............. 566 30.1. Overview.................................................................................................................................. 566 30.2. USART Features...................................................................................................................... 566 30.3. Block Diagram.......................................................................................................................... 567 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 13 PIC32CX-BZ2 and WBZ45 Family 30.4. Signal Description.................................................................................................................... 567 30.5. Product Dependencies............................................................................................................. 567 30.6. Functional Description..............................................................................................................569 30.7. Register Summary....................................................................................................................582 30.8. Register Description................................................................................................................. 582 31. SERCOM Serial Peripheral Interface (SERCOM SPI)........................................................................601 31.1. Overview.................................................................................................................................. 601 31.2. Features................................................................................................................................... 601 31.3. Block Diagram.......................................................................................................................... 601 31.4. Signal Description.................................................................................................................... 602 31.5. Product Dependencies............................................................................................................. 602 31.6. Functional Description..............................................................................................................603 31.7. Register Summary....................................................................................................................613 31.8. Register Description................................................................................................................. 613 32. SERCOM Inter-Integrated Circuit (SERCOM I2C).............................................................................. 629 32.1. Overview.................................................................................................................................. 629 32.2. Features................................................................................................................................... 629 32.3. Block Diagram.......................................................................................................................... 630 32.4. Signal Description.................................................................................................................... 630 32.5. Product Dependencies............................................................................................................. 630 32.6. Functional Description..............................................................................................................631 32.7. Register Summary - I2C Client.................................................................................................648 32.8. Register Description - I2C Client.............................................................................................. 648 32.9. Register Summary - I2C Host.................................................................................................. 662 32.10. Register Description I2C Host.............................................................................................. 662 33. Quad Serial Peripheral Interface (QSPI).............................................................................................679 33.1. Overview.................................................................................................................................. 679 33.2. Features................................................................................................................................... 679 33.3. Block Diagram.......................................................................................................................... 680 33.4. Signal Description.................................................................................................................... 680 33.5. Product Dependencies............................................................................................................. 680 33.6. Functional Description..............................................................................................................682 33.7. Register Summary....................................................................................................................698 33.8. Register Description................................................................................................................. 699 34. Configurable Custom Logic (CCL)...................................................................................................... 720 34.1. Overview.................................................................................................................................. 720 34.2. Features................................................................................................................................... 720 34.3. Block Diagram.......................................................................................................................... 720 34.4. Signal Description.................................................................................................................... 721 34.5. Product Dependencies............................................................................................................. 721 34.6. Functional Description..............................................................................................................722 34.7. Register Summary....................................................................................................................731 34.8. Register Description................................................................................................................. 731 35. True Random Number Generator (TRNG)..........................................................................................736 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 14 PIC32CX-BZ2 and WBZ45 Family 35.1. Overview.................................................................................................................................. 736 35.2. Features................................................................................................................................... 736 35.3. Block Diagram.......................................................................................................................... 736 35.4. Signal Description.................................................................................................................... 736 35.5. Product Dependencies............................................................................................................. 736 35.6. Functional Description..............................................................................................................737 35.7. Register Summary....................................................................................................................740 35.8. Register Description................................................................................................................. 740 36. Advanced Encryption Standard (AES)................................................................................................ 747 36.1. Overview.................................................................................................................................. 747 36.2. Features................................................................................................................................... 747 36.3. Block Diagram.......................................................................................................................... 748 36.4. Signal Description.................................................................................................................... 749 36.5. Product Dependencies............................................................................................................. 749 36.6. Functional Description..............................................................................................................750 36.7. Register Summary....................................................................................................................758 36.8. Register Description................................................................................................................. 760 37. Public Key Cryptography Controller (PUKCC).................................................................................... 776 37.1. Overview.................................................................................................................................. 776 37.2. Product Dependencies............................................................................................................. 776 37.3. Functional Description..............................................................................................................776 38. Analog-to-Digital Converter (ADC)......................................................................................................888 38.1. Overview.................................................................................................................................. 888 38.2. ADC Operation......................................................................................................................... 889 38.3. ADC Module Configuration.......................................................................................................892 38.4. Additional ADC Functions........................................................................................................ 901 38.5. Interrupts.................................................................................................................................. 907 38.6. Power-Saving Modes of Operation.......................................................................................... 909 38.7. Effects of Reset........................................................................................................................ 910 38.8. Transfer Function......................................................................................................................911 38.9. ADC Sampling Requirements...................................................................................................911 38.10. Connection Considerations..................................................................................................... 912 38.11. Register Description................................................................................................................ 912 39. Analog Comparators (AC)...................................................................................................................957 39.1. Overview.................................................................................................................................. 957 39.2. Features................................................................................................................................... 957 39.3. Block Diagram.......................................................................................................................... 958 39.4. Product Dependencies............................................................................................................. 958 39.5. Functional Description..............................................................................................................960 39.6. Register Summary....................................................................................................................968 39.7. Register Description................................................................................................................. 968 40. Timer/Counter (TC)............................................................................................................................. 984 40.1. Overview.................................................................................................................................. 984 40.2. Features................................................................................................................................... 984 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 15 PIC32CX-BZ2 and WBZ45 Family 40.3. Block Diagram.......................................................................................................................... 985 40.4. Signal Description.................................................................................................................... 985 40.5. Product Dependencies............................................................................................................. 986 40.6. Functional Description..............................................................................................................987 40.7. Register Description............................................................................................................... 1001 41. Timer/Counter for Control Applications (TCC).................................................................................. 1060 41.1. Overview................................................................................................................................ 1060 41.2. Features................................................................................................................................. 1060 41.3. Block Diagram........................................................................................................................ 1061 41.4. Signal Description.................................................................................................................. 1061 41.5. Product Dependencies........................................................................................................... 1061 41.6. Functional Description............................................................................................................1062 41.7. Register Summary..................................................................................................................1091 41.8. Register Description............................................................................................................... 1092 42. Zigbee Bluetooth Radio Subsystem (ZBT)........................................................................................ 1125 42.1. Overview.................................................................................................................................1125 42.2. Features................................................................................................................................. 1125 42.3. Wireless Subsystem Top Level Diagram................................................................................ 1127 42.4. Bluetooth Link Controller ....................................................................................................... 1128 42.5. Zigbee/Proprietary Data Rate Link Controller.........................................................................1129 42.6. Radio Arbiter...........................................................................................................................1130 42.7. RF Physical Layer ................................................................................................................. 1130 42.8. Frequency Synthesizer ..........................................................................................................1130 42.9. RFLDO................................................................................................................................... 1131 43. Electrical Characteristics................................................................................................................... 1132 43.1. Absolute Maximum Electrical Characteristics.........................................................................1132 43.2. DC Electrical Characteristics.................................................................................................. 1132 43.3. Thermal Specifications........................................................................................................... 1133 43.4. Active Current Consumption DC Electrical Specifications......................................................1133 43.5. Idle Current Consumption DC Electrical Specifications..........................................................1135 43.6. Sleep Current Consumption DC Electrical Specifications...................................................... 1137 43.7. Deep Sleep Current Consumption DC Electrical Specifications.............................................1139 43.8. XDS (Extreme Deep Sleep) Current Consumption DC Electrical Specifications................... 1140 43.9. External XTAL and Clock AC Electrical Specifications........................................................... 1141 43.10. XOSC32 AC Electrical Specifications................................................................................... 1143 43.11. Low Power Internal 32 kHz RC Oscillator AC Electrical Specifications.................................1145 43.12. FRC AC Electrical Specifications.......................................................................................... 1146 43.13. Frequency AC Electrical Specifications.................................................................................1146 43.14. QSPI Module Electrical Specifications.................................................................................. 1147 43.15. Power Supply DC Module Electrical Specifications.............................................................. 1148 43.16. I/O PIN AC/DC Electrical Specifications................................................................................1154 43.17. I2C Module Electrical Specifications......................................................................................1156 43.18. SPI Module Electrical Specifications..................................................................................... 1161 43.19. ADC Electrical Specifications................................................................................................ 1164 43.20. Bluetooth Low Energy RF Characteristics.............................................................................1167 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 16 PIC32CX-BZ2 and WBZ45 Family 43.21. Zigbee RF Characteristics.....................................................................................................1179 44. Packaging Information.......................................................................................................................1189 44.1. PIC32CX-BZ2 SoC Packaging Information............................................................................ 1190 44.2. WBZ451 Module Packaging Information................................................................................ 1193 44.3. WBZ450 Module Packaging Information ............................................................................... 1196 45. Appendix A: Regulatory Approval......................................................................................................1198 45.1. United States.......................................................................................................................... 1198 45.2. Canada................................................................................................................................... 1199 45.3. Europe....................................................................................................................................1201 45.4. Japan......................................................................................................................................1202 45.5. Korea......................................................................................................................................1202 45.6. Taiwan.................................................................................................................................... 1203 45.7. Other Regulatory Information................................................................................................. 1203 46. Document Revision History...............................................................................................................1204 Microchip Information............................................................................................................................... 1205 The Microchip Website......................................................................................................................1205 Product Change Notification Service................................................................................................ 1205 Customer Support............................................................................................................................. 1205 Microchip Devices Code Protection Feature.....................................................................................1205 Legal Notice...................................................................................................................................... 1205 Trademarks....................................................................................................................................... 1206 Quality Management System............................................................................................................ 1207 Worldwide Sales and Service............................................................................................................1208 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 17 PIC32CX-BZ2 and WBZ45 Family Ordering Information 1. Ordering Information This chapter provides the ordering information of the PIC32CX-BZ2 and WBZ45 family of devices. 1.1 PIC32CXBZ2 SoC and WBZ45 Module Ordering Information The following table describes the ordering information of the WBZ45 Module. Table 1-1. WBZ45 Module Ordering Details Model No. Module SoC Description WBZ451PE WBZ451UE PIC32CX1012BZ250 48-I/MYX WBZ451 module with PCB antenna WBZ451 module with U.FL connector for external antenna Regulatory Certification Ordering Code FCC, ISED, CE WBZ451PE-I FCC, ISED, CE WBZ451UE-I The following figure illustrates the details of the PIC32CXBZ2 ordering information. Figure 1-1. PIC32CXBZ2 Ordering Information PIC32 CX 10 12 BZ2 50 48 I/E MYX Microchip Brand Architecture Memory Size 10 = 1024 KB RAM Size 12 = 128 KB Family Blueetooth Zigbee Long Range Pin Count 48 Pin Device Temperature Range I = Industrial (-40 to +85 C) E = Extended (-40 to +125 C) T-I = Industrial in T/R T-E = Extended in T/R Package Information QGN 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 18 PIC32CX-BZ2 and WBZ45 Family Configuration Summary 2. Table 2-1. PIC32CX-BZ2 and WBZ45 Family Features Configuration Summary Peripherals Analog Security Wireless Device
) B K
y r o m e M m a r g o r P
) B K
y r o m e M a t a D PIC32CX1012BZ25048 PIC32CX1012BZ24032 WBZ451 WBZ450 1024 128 s n P i 48 32 39 30 e g a k c a P QFN QFN LGA LGA M O C R E S 4 2 4 2
) C T
r e t n u o C
r e m T i
) t i b
6 1
t i b
4 2
C C T I P S Q s l e n n a h C A M D C T R
T U L L C C T D W T M D t n e m e r u s a e M y c n e u q e r F
) s l e n n a h C
m e t s y S t n e v E i s e n L t p u r r e t n I l a n r e t x E 4 2/1 Y 16 Y 1/2 Y Y Y 32 4 r o s n e S e r u t a r e p m e T S E A G N R T
) C C K U P
y h p a r g o t p y r C y e K c i l b u P r o t i n o M k c e h C y t i r g e t n I Y Y Y Y Y
) s l e n n a h C
s r o t a r a p m o C g o l a n A 2 1 2 1
) s l e n n a h C
C D A 8 6 8 6 2
. 5 h t o o t e u B l 0
. 3 i e e b g Z
4
. 5 1
. 2 0 8 Y Y
) m B d
r e w o P X T x a M 12 4 12 4 i s n P O P G I 29 16 29 16 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 19 PIC32CX-BZ2 and WBZ45 Family PIC32CX-BZ2 SoC Description 3. PIC32CX-BZ2 SoC Description This chapter contains device-specific information for the PIC32CX-BZ2 SoC. Note:Traditional AHB and APB documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Manager and Subordinate, respectively. 3.1 PIC32CX-BZ2 SoC Block Diagram The following figure illustrates the block diagram of the core and peripheral modules in the PIC32CX-BZ2 SoC. Figure 3-1. PIC32CX-BZ2 SoC Block Diagram B D D N G p a g d n a B S S V A I O D D V
D D V D D V A R O P 3 3 R O B 2 1 R O B R O B P Z C D C D
O D L M l r t C U M P P C
C D A G E R R W P PORT A/B O W S K L C E C A R T x A T A D E C A R T TPIU 24-bit SysTick K L C W S I O D W S
T F W Cortex-M4 CPU WDSP Serial Wire Single Bank Flash ETM-Coresight ETB MPU FPU Device Service Unit Flash Ctrl, WFT Pre-fetch Cache 16 MHz XTAL N O A D D V
C S O S C R P L
M E S G E R V P L U t n C S D X Wireless Subsystem Flash Controller DMA Controller SRAM Cntrl RAMECC Port-B Port-A Config GP-PortB GP-PortA JTAG/Test/BSCAN I-Cache D-Cache JTAG-ICD CM4 Cache Cntrl. 4 KB
B A T R O P ANx 12-bit ADC AHB Manager Interface High Speed Bus Matrix AHB Subordinate Interface PLL-SYS FRC Osc Dividers CRU DMT WDT PB-PIC Bridge AHB-APB Bridge A Timer/Counter for Control (x3) Timer/
Counter (x4) SERCOM (x2) Freq. Met PAC Ext. Int. Ctrl NMI EXTINTx Event System WOx QSIOx WOx SIOx
B A T R O P AHB-APB Bridge C AHB-APB4 Bridge B Quad SPI AES Integrity Check Monitor Public Key Cryptography D S C n t D S W D T CNTXT RAM
B S R A M 2
B S R A M 1 R T C C VDDBKUPCORE SERCOM(x2) Analog Comparator(x1) TAMPERx SIOx AN[1:0]
CCLIOx CCL (x2) TRNG P O R T A B
3.2 Pinout Diagram This section provides details on pin diagrams for each variant of the PIC32CX-BZ2 SoC. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 20 PIC32CX-BZ2 and WBZ45 Family PIC32CX-BZ2 SoC Description Figure 3-2. PIC32CX1012BZ25048 SoC Pin Diagram (Bottom View) 13 14 15 16 17 18 19 20 21 22 23 24 12 11 10 9 8 7 6 5 4 3 2 1 25 26 27 28 29 30 31 32 33 34 35 36 Note:
1. It is required that the exposed paddle on the bottom of the SoC be connected to ground in the PCB. 48 47 46 45 44 43 42 41 40 39 38 37 PIC32CX1012BZ25048 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 21 PIC32CX-BZ2 and WBZ45 Family WBZ45 Module Description 4. WBZ45 Module Description The WBZ45 contains the PIC32CX-BZ2 SoC with following antenna options:
PCB antenna u.FL connector for external antenna The following figure represents the WBZ45 module block diagram. Figure 4-1. WBZ45 Module Block Diagram PIC32CX-BZ2 SoC Power Encryption Subsystem Wireless Subsystem DC-DC/MLDO Integrity Check Monitor Radio Transceiver CLDO Bandgap AES Public Key Crypto Bluetooth Zigbee TRNG Proprietary Modulation Printed Antenna/u.FL External Antenna RF Matching Circuit Oscillators Cortex M4 CPU WDSP 64 MHz
B P A B H A PWM Timer/Counter System Peripherals SWD/Trace Debug Debug M Q E R F L C C
B K 8 2 1 M A R S B K 8 p u k c a B M A R 1 MB Flash Panel, 32 kB NVR 4.1 Pinout Diagram The following figure illustrates the module pinout diagram. SERCOM I2C/SPI/USART QSPI GPIO/EIC PPS QSPI GPIO ADC/AC Analog Pins Power Supply Storage and Filtering 16 MHz Crystal 32 kHz Osc Pins 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 22 PIC32CX-BZ2 and WBZ45 Family WBZ45 Module Description Figure 4-2. WBZ451 Module Pin Diagram (Top View) Note:It is required that the exposed paddle on the bottom of the module be connected to ground in the PCB. WBZ451 4.2 Basic Connection Requirement The WBZ45 module requires attention to a minimal set of device pin connections before proceeding with development. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 23 PIC32CX-BZ2 and WBZ45 Family WBZ45 Module Description Figure 4-3. Module Basic Connection and Interface Diagram U1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 EGND GND GND NMCLR P B0 P B3 P B5 VDD_A GND PA11 PA12 GND P B6 P B7 VDD GND R1 10k C1 0.1uF R2 0 GND VDD C2 0.1uF C3 4.7uF GND GND P B0 P B3 P B5 PA11 PA12 P B3 P B6 P B7 WBZ451 8 B P 9 B P 4 A P 0 1 B P 1 1 B P D N G 0 A P 1 A P 2 1 B P 3 1 B P 5 A P 6 A P D N G P B4 P B1 P B2 PA3 PA2 PA14 PA13 PA10 PA7 PA9 PA8 VDD VDD 39 38 37 36 35 34 33 32 31 30 29 28 27 P B4 P B1 P B2 PA3 PA2 PA14 PA13 PA10 PA7 PA9 PA8 VDD C4 0.1uF C5 4.7uF 4 1 5 1 6 1 7 1 8 1 9 1 0 2 1 2 2 2 3 2 4 2 5 2 6 2 GND GND 8 B P 9 B P 4 A P 0 1 B P 1 1 B P 0 A P 1 A P 2 1 B P 3 1 B P 5 A P 6 A P GND GND 4.2.1 Power Pins It is recommended that a bulk and a decoupling capacitor be added at the input supply pin (VDD, VDD_A and GND pins) of the WBZ45 module. It is recommended that 4.7 F be on the VDD_A pin and 4.7 F and a 0.1 F be on the VDD pin. The value of the capacitors are based on typical application requirements and are the minimum recommended values. Depending on the application requirement (in other words, a noisy power line or other known noise sources), the values of capacitors can be adjusted to provide a clean supply to the module. All capacitors must be placed close to the Module Power supply pins. 4.2.2 Master Clear (MCLR) Pin The MCLR pin provides for two specific device functions:
Device Reset Device programming and debugging Pulling the MCLR pin low generates a device Reset. Module Basic Connection and Interface Diagram illustrates a typical MCLR circuit, see the Module Basic Connection and Interface Diagram in the Basic Connection Requirement from Related Links. The module has sufficient filtering (0.1 F) and pull-up (10k) on the Reset line. On a typical application, no extra filtering is required on this pin. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 24 PIC32CX-BZ2 and WBZ45 Family WBZ45 Module Description Related Links 4.2. Basic Connection Requirement 4.2.3 SWD Lines The CM4_SWCLK, CM4_SWDIO and CM4_SWO pins are used for SWD Programming and debugging purposes. It is recommended that the CM4_SWCLK and CM4_SWDIO pin be used for the WBZ45 module for SWD as the default configuration (CM4_SWO can be optional). Keep the trace length between the SWD pins of the WBZ45 module and the SWD header as short as possible. If the SWD connector is expected to experience an ESD event, a series resistor is recommended with the value in the range of a few tens of s, not to exceed 100. Note:Provide an option for adding an external pull-up on SWDIO. 4.2.4 Unused I/O Pins It is recommended that unused I/O pins not be allowed to float as inputs. They can be configured as inputs and pulled up. Alternatively, depending on the application, they can be pulled down as well. Note:Pin PA3 has to be pulled down for optimal power consumption. 4.2.4.1 GPIO Pins/PPS Functions Most of the WBZ45 module pins can be configured as GPIOs pins or for PPS functionality. To find the functionality supported by each of these GPIOs, see I/O Ports and Peripheral Pin Select (PPS) from Related Links. It is recommended that a series resistor be added on the host board for all critical, high frequency pins and clocks for EMI considerations. The value of the series resistor depends on the actual pin configuration. These resistors must be placed close to the module. Example of Host Board on Top Layer illustrates the placement of the series resistor;
see the Example of Host Board on Top Layer figure in the WBZ45 Module Routing Guidelines from Related Links. Related Links 6. I/O Ports and Peripheral Pin Select (PPS) 4.4. WBZ45 Module Routing Guidelines 4.3 WBZ45 Module Placement Guidelines For any Bluetooth Low Energy/Zigbee product, the antenna placement affects the performance of the whole system. The antenna requires free space to radiate RF signals and it must not be surrounded by the ground plane. Thus, for the best PCB antenna performance, it is recommended that the WBZ45 module be placed at the edge of the host board. It is recommended that the WBZ45 module ground outline edge be aligned with the edge of the host board ground plane as shown in the following figure. A low-impedance ground plane for the WBZ45 module ensures the best radio performance (best range and lowest noise). The ground plane can be extended beyond the minimum recommendation as required for the host board EMC and noise reduction. For the best performance, keep metal structures and components (such as mechanical spacers, bump-on and so on) at least 31.75 mm away from the PCB trace antenna as illustrated in the following figure. It is recommended that the antenna on the WBZ45 module not be placed in direct contact with or in close proximity to plastic casing or objects. Keep a minimum clearance of 10 mm in all directions around the PCB antenna as shown in the following figure. Keeping metallic and plastic objects close to the antenna can detune the antenna and reduce the performance of the device. Exposed GND pads on the bottom of the WBZ45 module must be soldered to the host board (see the Example of Host Board on Top Layer figure in the WBZ45 Module Routing Guidelines from Related Links). A PCB cutout or a copper keepout is required under the RF test point (see WBZ451 Module Packaging Information from Related Links). Copper keepout areas are required on the top layer under voltage test points (see WBZ451 Module Packaging Information from Related Links). Alternatively, the entire region, except the exposed ground paddle, can be solder-masked. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 25 PIC32CX-BZ2 and WBZ45 Family WBZ45 Module Description The following figure illustrates the examples of WBZ45 module placement on a host board with a ground plane. Refer to the following figure for placement-specific guidance. Figure 4-4. Module Placement Guidelines Module PCB Edge 16mm 31.75 mm (Keep out clearance region) for all metalic and plastic structures around the antenna. Refer to antenna specific details of the respective antenna. Edge of Host PCB Ground Plane No Copper Region 6mm Host PCB Ground Plane Related Links 4.4. WBZ45 Module Routing Guidelines 44.2. WBZ451 Module Packaging Information 4.4 WBZ45 Module Routing Guidelines Use the multi-layer host board for routing signals on the inner layer and the bottom layer. The top layer (underneath the module) of the host board must be ground with as many GND vias as possible, shown in the following figure. Avoid fan-out of the signals under the module or antenna area. Use a via to fan-out signals to theedge of the WBZ45 module. For a better GND connection to the WBZ45 module, solder the exposed GND pads of the WBZ45 module on the host board. For the module GND pad, use a GND via of a minimum 10 mil (hole diameter) for good ground to all the layers and thermal conduction path. Having a series resistor on the host board for all GPIOs is recommended. These resistors must be placed close to the WBZ45 module. Refer to the following figure for the placement of the series resistor. The SOSC crystal (32.768 kHz) on the host board must be placed close to the WBZ45 module and follow the shortest trace routing length with no vias (see the following figure). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 26 PIC32CX-BZ2 and WBZ45 Family WBZ45 Module Description Figure 4-5. Example of Host Board on Top Layer Copper Keep out Region End of Ground Plane on the Base Board 32 kHz Crystal Placement and Routing Host PCB Board Edge Optional Series Resistor on the Digital Lines Module Footprint Exposed Grounding Pad Underneath Module No Routing Underneath the Module 4.5 WBZ45 Module RF Considerations The overall performance of the system is significantly affected by the product design, environment and application. The product designer must ensure system-level shielding (if required) and verify the performance of the product features and applications. Consider the following guidelines for optimal RF performance:
The WBZ45 module must be positioned in a noise-free RF environment and must be kept far away from high-frequency clock signals and any other sources of RF energy. The antenna must not be shielded by any metal objects. The power supply must be clean and noise-free. Make sure that the width of the traces routed to GND, VDD rails are sufficiently large for handling peak TX current consumption. Note:The WBZ45 module includes RF shielding on top of the board as a standard feature. 4.6 WBZ45 Module Antenna Considerations 4.6.1 PCB Antenna For the WBZ45 module, the PCB antenna is fabricated on the top copper layer and covered in a solder mask. The layers below the antenna do not have copper trace. It is recommended that the module be mounted on the edge of the host board and to have no PCB material below the antenna structure of the module and no copper traces or planes on the host board in that area. The following table lists the technical specification of the PCB antenna when tested with the WBZ45 module mounted on an Evaluation Board. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 27 PIC32CX-BZ2 and WBZ45 Family WBZ45 Module Description Table 4-1. PCB Antenna Specification for WBZ45 Parameter Operating frequency Peak gain Efficiency Specification 2400 to 2480 MHz 2.36 dBi at 2420 MHz 50%
4.6.2 External Antenna Placement Recommendations The following recommendations must be applied for the placement of the antenna and its cable:
The antenna cable must not be routed over circuits generating electrical noise on the host board or alongside or underneath the module. It is preferred that the cable is routed straight out of the module. The antenna must not be placed in direct contact or in close proximity of the plastic casing/objects. (Except when the selected antenna specifically recommends it). Do not enclose the antenna within a metal shield. Keep any components that may radiate noise, signals or harmonics within the 2.4-2.5 GHz frequency band away from the antenna and, if possible, shield those components. Any noise radiated from the host board in this frequency band degrades the sensitivity of the module. The antenna must be placed at a distance greater than 5 cm away from the module. The following figure illustrates the antenna keepout area where the antenna must not be placed. These recommendations are based on an open-air measurement and do not take into account any metal shielding of the customer end product. When a metal enclosure is used, the antenna can be located closer to the WBZ45 Module. Note:These are generic guidelines and it is recommended that customers check and fine-tune the antenna positioning in the final host product based on RF performance. The following figure illustrates an indication on how to route the antenna cable depending on the location of the antenna with respect to the WBZ45 PCB; there are two possible options for the optimum routing of the cable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 28 PIC32CX-BZ2 and WBZ45 Family WBZ45 Module Description Figure 4-6. WBZ45 Antenna Placement Guidelines c 5cm from board edge Preferred cable routing directions c 5cm from board edge Table 4-2. List of Certified Antenna Serial Number Part Number Vendor Antenna Type Gain Comment 1 2 3 4 5 6 7 8 9 10 W3525B039 001-0016 001-0001 Pulse LSR LSR 1461530100 Molex PCB PIFA Dipole PCB 2 dBi Cable length 100 mm 2.5 dBi Flex PIFA antenna 2 dBi 3 dBi RPSMA connector*
100 mm (Dual Band) ANT-2.4-LPW-125 Linx Technologies Dipole 2.8 dBi 125 mm RFA-02-P05-D034 Alead RFA-02-P33-D034 Alead ABAR1504-S2450 ABRACON WBZ451 LGA WBZ450 LGA PCB PCB PCB 2 dBi 2 dBi 150 mm 150 mm 2.28 dBi 250 mm 2.36 dBi Only for WBZ451 module 4.14 dBi Only for WBZ450 module 4.7 WBZ45 Module Reflow Profile Information The WBZ45 module was assembled using the IPC/JEDEC J-STD-020 Standard lead free reflow profile. The WBZ45 module can be soldered to the host board using standard leaded or lead-free solder reflow profiles. To avoid damaging the module, adhere to the following recommendations:
For Solder Reflow Recommendations, refer to the Solder Reflow Recommendation Application Note (AN233). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 29 PIC32CX-BZ2 and WBZ45 Family WBZ45 Module Description Do not exceed a peak temperature (TP) of 250C. Refer to the solder paste data sheet for specific reflow profile recommendations from the vendor. Use no-clean flux solder paste. Do not wash as moisture can be trapped under the shield. Use only one flow. If the PCB requires multiple flows, apply the module on the final flow. 4.7.1 Cleaning The exposed GND pad helps to self-align the module, avoiding pad misalignment. The recommendation is to use the no clean solder pastes. Ensure full drying of no-clean paste fluxes as a result of the reflow process. As per the recommendation by the solder paste vendor, this requires longer reflow profiles and/or peak temperatures toward the high end of the process window. The uncured flux residues can lead to corrosion and/or shorting in accelerated testing and possibly the field. 4.8 WBZ45 Module Assembly Considerations The WBZ45 module is assembled with an EMI shield to ensure compliance with EMI emission and immunity rules. The EMI shield is made of a tin-plated steel (SPTE) and is not hermetically sealed. Use the solutions such as IPA and similar solvents to clean this module. Cleaning solutions containing acid must never be used on the module. 4.8.1 Conformal Coating The modules are not intended for use with a conformal coating, and the customer assumes all risks (such as the module reliability, performance degradation and so on) if a conformal coating is applied to the modules. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 30 PIC32CX-BZ2 and WBZ45 Family Pinout and Signal Descriptions List 5. Pinout and Signal Descriptions List The following table provides details on signal names classified by the peripherals along with the device pinout for each variant of the PIC32CX-BZ2 SoC and WBZ45 module. Table 5-1. Pinout and Signal Descriptions List PIC32CX-BZ2 SoC WBZ45 Module 24032 25048 450 451 Pad Name 1, 5, 8, 18, 21, 27 1, 2, 8, 11, 19, 26 GND 32 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 22 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 PMU_BK VPMU_VDD PMU_MLDO 20 21 35 24 PA0 PA1 PA2 PA5 19 16, 17 27, 28 VDD 20 25 24 22 23 2 3 10 11 25 31 29 30 32 22 23 33 34 3 4 38 37 5 39 PA6 PA7 PA8 PA9 PA10 PB12 PB13 PA13 PA14 CLDO_O BUCK_CLDO EXTR(8) BUCK_BB XO_N XO_P BUCK_PLL BUCK_LPA LPA_OUT MPA_OUT BUCK_MPA NMCLR PB0 PB1 PB2 PB3 PB4 AC ADC EIC(4) GPIO (1, 2) QSPI RTCC SERCOM OSC RF DEBUG Peripherals AC_CMP1 AC_CMP0 AC_CMP1_ALT RA0 RA1 RA2 RA5 RA6 RA7 RA8 RA9 RA10 RB12 RB13 RA13 RA14 QSPI_DATA2 RTC_IN3 QSPI_DATA3 RTC_IN2 RTC_IN1 SERCOM0_PAD0 SERCOM0_PAD1 SERCOM1_PAD0 PGC2ENTRY TRACECLK SERCOM1_PAD1 FECTRL0 PGD2ENTRY RTC_IN0_ALT SERCOM1_PAD2 FECTRL1 RTC_OUT_ALT SERCOM1_PAD3 FECTRL2 QSPI_DATA0 QSPI_DATA1 RTC_EVENT SERCOM2_PAD0 COEXCTRL0 SERCOM2_PAD1 COEXCTRL1 XO XO+
LPA MPA COEXCTRL2 FECTRL3 TRACEDATA3, PGC1 AC_AIN2 AC_AIN3 AC_AIN0 AC_AIN1 AN4 AN5 AN6 AN7 AN0 RB0 RB1 RB2 RB3 INT0 RB4 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 31 PIC32CX-BZ2 and WBZ45 Family Pinout and Signal Descriptions List AC ADC EIC(4) GPIO (1, 2) QSPI RTCC SERCOM OSC RF DEBUG Peripherals Pad Name PB5 AVDD PB6 AN1 RB5 ANN0,AN2 RB6 PB7 LVDIN AN3 RB7 VDD PB9 PB8 PA4 PB10 PB11 PA11 PA12 PA3 VPMU_VDD NC RB9 RB8 RA4 RB10 RB11 RA11(5) RA12(5) RA3 RTC_OUT SERCOM0_PAD3 QSPI_CS QSPI_SCK SOSCI SOSCO RTC_IN0 SERCOM0_PAD2 SCLKI FECTRL4 TRACEDATA0, PGC4 FECTRL5 TRACEDATA1, PGD1 TRACEDATA2, CM4_SWO, PGD4 CM4_SWDIO CM4_SWCLK
...........continued PIC32CX-BZ2 SoC WBZ45 Module 24032 25048 450 451 23 24 25 26 27 28 29(6) 29 30 30(6) 31 35 36 37 38 39 40 41 42 43 44 45 46 47 48 9 4 12 15 14 13 6 7 6 7 12 13 15 14 16 17 18 9 10 36 26, 28, 29, 30 Notes:
1. 2. 3. 4. 5. 6. 7. 8. All GPIOs (RAn and RBn ) can be used by remappable peripherals via PPS. All GPIOs (RAn and RBn) can be used as I/O Change Notification (IOCAn and IOCBn). The metal paddle at the bottom of the device must be connected to system ground. These peripherals have signals that are only available via the PPS remappable pins. This pin can be used as Input only pin if not using SOSC. For 24032 only, pin 29 and pin 30 act as GPIO PA4/PA3 respectively ONLY if CFGCON0.GPSOSCE = 0. If CFGCON0.GPSOSCE = 1, these pins are SOSC 32 kHz crystal inputs OR as digital input only RA11/RA12 respectively. These I/O pins are 5.5V tolerant: NMCLR, PA0, PA1, PA2, PA4, PA5, PA6, PA7, PA8, PA9, PA10, PA13, PA14, PB10, PB11, PB12, PB13. All other I/O pins are 3.3V tolerant. External resistor used to set internal reference current of the SOC. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 32 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) 6. I/O Ports and Peripheral Pin Select (PPS) General purpose I/O (GPIO) pins allow the PIC32CX-BZ2 devices to monitor and control other devices. To add flexibility and functionality, some pins are multiplexed with alternate function(s). These functions depend on which peripheral features are on the device. In general, when a peripheral is functioning, that pin may not be used as a general purpose I/O pin. For more details on pin multiplexing, see GPIO Pins/PPS Functions from Related Links. There are default priorities for each GPIO pin as well. For details on priorities, see Function Priority for Device Pins from Related Links. It must be noted that fuse values stored in NVR memory can be used to alter the power-on default function for certain GPIO pins. See System Configuration Registers (CFG) from Related Links. Some of the key features of the I/O ports are:
Individual output pin open-drain enable/disable Individual input pin weak pull-up and pull-down Monitor selective inputs and generate interrupt when change in pin state is detected Operation during Sleep and Idle modes Fast bit manipulation using CLR, SET and INV registers Slew rate control The following figure illustrates a block diagram of a typical multiplexed I/O port. Figure 6-1. Typical Multiplexed Port Structure Block Diagram PIO Module RD ODC Data Bus PB1_CLK WR ODC RD TRIS WR TRIS WR LAT WR PORT RD LAT RD PORT Sleep PB1_CLK Peripheral Module Peripheral Module Enable Peripheral Output Enable Peripheral Output Data PPS Control PB1_CLK ODC D CK Q Q EN TRIS LAT D CK EN D CK EN Q Q Q Q 1 0 I/O Cell 0 1 1 0 1 0 Output Multiplexers I/O Pin Q Q D CK Q Q D CK Synchronization Peripheral Input Peripheral Input Buffer R 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 33 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Related Links 4.2.4.1. GPIO Pins/PPS Functions 6.3. Function Priority for Device Pins 18. System Configuration and Register Locking (CFG) 6.1 Control Registers Before reading and writing any I/O port, the desired pin(s) must be properly configured for the application. Each I/O port has nine registers directly associated with the operation of the port and one control register. Each I/O port pin has a corresponding bit in these registers. Throughout this section, the letter x, denotes any or all port module instances. For example, TRISx represents TRISA or TRISB. Any bit and its associated data and control registers that is not valid for a particular device will be disabled and will read as zeros. 6.1.1 Configuring Tri-State Functions (TRISx) The TRISx registers configure the data direction flow through port I/O pins. The TRISx register bits determine whether a PORTx I/O pin is an input or an output:
If a data direction bit is 1, the corresponding I/O port pin is an input. If a data direction bit is 0, the corresponding I/O port pin is an output. A read from a TRISx register reads the last value written to that register. All I/O port pins are defined as inputs after a Power-on Reset (POR). 6.1.2 Configuring Port Functions (PORTx) The PORTx registers allow I/O pins to be accessed:
A write to a PORTx register writes to the corresponding LATx register (PORTx data latch). Those I/O port pin(s) configured as outputs are updated. A write to a PORTx register is effectively the same as a write to a LATx register. A read from a PORTx register reads the synchronized signal applied to the port I/O pins. 6.1.3 Configuring Latch Functions (LATx) The LATx registers (PORTx data latch) hold data written to port I/O pins:
A write to a LATx register latches data to corresponding port I/O pins. Those I/O port pins configured as outputs are updated. A read from a LATx register reads the data held in the PORTx data latch, not from the port I/O pins. 6.1.4 Open-Drain Configuration (ODCx) Each I/O pin can be individually configured for either normal digital output or open-drain output. This is controlled by the open-drain control register, ODCx, associated with each I/O pin. If the ODCx bit for an I/O pin is a 1, the pin acts as an open-drain output. If the ODCx bit for an I/O pin is a 0, the pin is configured for a normal digital output (the ODCx bit is valid only for output pins). After a Reset, the status of all the bits of the ODCx register is set to 0. The maximum open-drain voltage allowed is the same as the maximum VIH specification. The ODCx register setting functions in all of the I/O modes, allowing the output to behave as an open-drain even if a peripheral is controlling the pin. Although, the user may achieve the same result by manipulating the corresponding LATx and TRISx bits, this procedure does not allow the peripheral to operate in the Open-Drain mode (except for the default operation of the I2C pins). I2C pins are already open-drain pins; therefore, the ODCx settings do not influence the I2C pins. 6.1.5 Configuring Analog and Digital Port Pins (ANSELx) The ANSELx register controls the operation of the analog port pins. The port pins that are to function as analog inputs must have their corresponding ANSEL and TRISx bits set. To use port pins for I/O functionality with digital modules, such as Timers, SERCOMs and so on, the corresponding ANSELx bit must be cleared. The ANSELx register has a default value of 0xFFFF; therefore, all pins that share analog functions are, by default, analog and not digital. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 34 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) If the TRISx bit is cleared (output) while the ANSELx bit is set, the digital output level (VOH or VOL) is converted by an analog peripheral, such as the ADC module or the comparator module. When the PORTx register is read, all pins configured as analog input channels are read as cleared (a low-level). Pins configured as digital inputs do not convert an analog input. Analog levels on any pin defined as a digital input (including the ANx pins) can cause the input buffer to consume current that exceeds the device specifications. 6.1.6 Input Change Notification (CN) The Input Change Notification (CN) function of the I/O ports allows PIC32CX-BZ2 devices to generate interrupt requests to the processor in response to a change-of-state on selected input pins. This feature can detect input change of states even in the Sleep mode, when the clocks are disabled. The following control registers are associated with the CN functionality of each I/O port:
Change Notice Pull-up Enable (CNPUEx) Change Notice Pull-down Enable (CNPDx) Change Notice Control (CNCONx) Change Notice Enable (CNENx/CNNEx) Change Notice Status (CNSTATx/CNFx) or the positive edge control Each I/O pin also has a weak pull-up and a weak pull-down connected to it. The pull-ups act as a current source or sink source connected to the pin and eliminate the need for external resistors when push button or keypad devices are connected. The pull-ups and pull-downs are enabled separately using the CNPUEx and the CNPDx registers, which contain the control bits for each of the pins. Setting any of the control bits enables the weak pull-ups and/or pull-downs for the corresponding pins. Note:Pull-ups and pull-downs on change notification pins must always be disabled when the port pin is configured as a digital output The CNCONx registers provide change notice control. The CNENx/CNNEx registers contain the CN interrupt enable control bits for each of the input pins. Setting any of these bits enables a CN interrupt for the corresponding pins. CNENx enables a mismatch CN interrupt condition when EDGEDETECT is not set. When EDGEDETECT is set, CNNEx controls the negative edge while CNENx controls the positive. On devices that do not have EDGEDETECT, this CN logic acts as if EDGEDETECT is not set. The CNSTATx/CNFx registers indicate whether a change occurred on the corresponding pin since the last read of the PORTx bit. The CNFx registers indicate the type of change that occurred. 6.1.7 Registers for Peripheral Pin Select The Peripheral Pin Select [pin name]R register ([pin name]R) and the Peripheral Pin Select Output (RPnR) register
(RPnR) provide the control bits for the peripheral pin select input and output. See [pin name]R and RPnR from Related Links. Related Links 6.2.7.4. [pin name]R 6.2.9.1. RPnR 6.1.8 Slew Rate Control Some I/O pins can be configured for various types of slew rate control on its associated port. This is controlled by the slew rate control bits in the SRCON1x and SRCON0x registers that are associated with each I/O port. The slew rate control is configured using the corresponding bit in each register, as shown in the following table. As an example, writing 0x0001, 0x0000 to SRCON1A and SRCON0A, respectively, can enable slew rate control on the RA0 pin and sets the slew rate to the slow edge rate. Note:Slew rate control bits must not be enabled with pad configured as an input. Table 6-1. Slew Rate Control Bit Settings(1) SRCON1x SRCON0x Description 1 1 Slew rate control is enabled and is set to the slowest edge rate 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 35 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS)
...........continued SRCON1x SRCON0x Description 1 0 0 0 1 0 Slew rate control is enabled and is set to the slow edge rate Slew rate control is enabled and is set to the medium edge rate Slew rate control is disabled and is set to the fastest edge rate 1. By default, all the port pins are set to the fastest edge rate. 6.1.9 CLR, SET and INV Registers Every I/O module register has corresponding SET, CLR and INV registers, which provide atomic bit manipulations. As the name of the registers imply, a value written to a SET, CLR or INV register effectively performs the implied operation, but only on the corresponding base register and only bits specified as 1 are modified. Bits specified as 0 are not modified. For example, Writing 0x0001 to the TRISASET register sets only bit 0 in the base register TRISA Writing 0x0020 to the PORTBCLR register clears only bit 5 in the base register PORTB Writing 0x9000 to the LATAINV register inverts only bits 15 and 12 in the base register LATA Reading the SET, CLR and INV registers returns an undefined value. To see the influences of a write operation to a SET, CLR or INV register, the base register must be read instead. A typical method to toggle an I/O pin requires a read-modify-write operation performed on a PORTx register in the software. For example, a read from a PORTx register, mask and modify the desired output bit or bits, and write the resulting value back to the PORTx register. This method is vulnerable to a read-modify-write issue where the port value may change after it is read and before the modified data can be written back, thus, changing the previous state. This method also requires more instructions. A more efficient and atomic method uses the PORTxINV register. A write to the PORTxINV register effectively performs a read-modify-write operation on the target base register, equivalent to the software operation described previously; however, it is done in the hardware. To toggle an I/O pin using this method, a 1 is written to the corresponding bit in the PORTxINV register. This operation reads the PORTx register, inverts only those bits specified as 1, and writes the resulting value to the LATx register, thus, toggling the corresponding I/O pins all in a single atomic instruction cycle. PORTAINV = 0x0001. 6.2 Peripheral Pin Select (PPS) A major challenge in general purpose devices is providing the largest possible set of peripheral features while minimizing the conflict of features on I/O pins. The challenge is even greater on low pin-count devices. In an application where more than one peripheral needs to be assigned to a single pin, inconvenient workarounds in application code or a complete redesign may be the only option. The PPS configuration provides an alternative to these choices by enabling peripheral set selection and their placement on a wide range of I/O pins. By increasing the pinout options available on a particular device, the users can better modify the device to their entire application, rather than trimming the application to fit the device. This feature operates over a fixed subset of digital I/O pins. The users may independently map the input and/or output of most digital peripherals to these I/O pins. The PPS configuration is performed in the software and generally does not require the device to be reprogrammed. The hardware safeguards that prevent accidental or spurious changes to the peripheral mapping are included once the PPS configuration is established. In PPS mode, Maximum peripheral clock frequency = Direct mode clock frequency/2. Note:Direct Mode is a mode in which peripherals are running based on Function Priority for Pins and not using PPS. 6.2.1 Re-Mappable Pin Groupings The re-mappable pins, as well as the available input and output functions, are divided into four groups. The re-mappable pins of group k may be assigned pin functions only from group k (k = 1,2,3,4). The pins used by each peripheral are spread across all four groups when possible to maximize flexibility. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 36 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) 6.2.2 Enabling Remap Pins Each remap pin (RPx) must be enabled by disabling all higher priority pin functions on that pin before it can be used. Typically, all functions other than GPIO are considered higher priority than remap pins. 6.2.3 RP Register Protection The <INPUT>R and RPxxR registers are implemented with two levels of protection:
I/O Lock Feature All PPS registers may only be written while CFGCON0.IOLOCK = 0; once the IOLOCK is set, the registers cannot be written. IOLOCK Protection The state of the IOLOCK bit can only be changed once it is unlocked using the CFGCON0.CFGLOCK[1:0] register. These features prevent the RP registers from being inadvertently written during normal operation because changing the pinout functionality may have detrimental system-level outcome. 6.2.4 Available Pins The number of available pins is dependent on the particular device and its pin count. Pins that support the PPS feature include the designation RPn in their full pin designation, where:
RP Designates a remappable peripheral n Remappable port number 6.2.5 Available Peripherals The peripherals managed by the PPS are all digital-only peripherals. These include general serial communications
(SERCOM), general purpose timer clock inputs, timer-related peripherals (input capture and output compare), interrupt-on-change inputs and reference clocks (input and output). In comparison, some digital-only peripheral modules are never included in the PPS feature. This is because the peripherals function requires special I/O circuitry on a specific port and cannot be easily connected to multiple pins. These modules include I2C among others. A similar requirement excludes all modules with analog inputs, such as the ADC. A key difference between remappable and non-remappable peripherals is that remappable peripherals are not associated with a default I/O pin. The peripheral must always be assigned to a specific I/O pin before it can be used. In contrast, non-remappable peripherals are always available on a default pin, assuming that the peripheral is active and not conflicting with another peripheral. When a remappable peripheral is active on a given I/O pin, it takes priority over all other digital I/O and digital communication peripherals associated with the pin. Priority is given regardless of the type of peripheral that is mapped. Remappable peripherals never take priority over any analog functions associated with the pin. 6.2.6 Controlling PPS The PPS features are controlled through two sets of SFRs: one to map peripheral inputs and another to map outputs. They are separately controlled; therefore, a particular peripherals input and output (if the peripheral has both) can be placed on any selectable function pin without constraint. The association of a peripheral to a peripheral-selectable pin is handled in two different ways, depending on whether an input or output is mapped. 6.2.7 Remappable Inputs When configuring a PAD for a new peripheral functionality, the existing PPS configuration must be cleared prior to using the same PAD for the different peripheral functionality. 6.2.7.1 Enabling Remappable Peripheral Inputs With PPS, each remappable input pin function (EXTINT0, SERCOM0_PAD3 and so on) is assigned to be driven from a specific device pin by programming the corresponding <INPUT>R[3:0] register (meaning, EXTINT0R[3:0], SCOM0P3R[3:0], and so on) with a value defined in the Input Pin Selection Group 1, Input Pin Selection Group 2, Input Pin Selection Group 3, Input Pin Selection Group 4 tables and [pin name]R register. See these tables in the Remappable Input Example and [pin name]R from Related Links. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 37 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Assigning a remappable input pin function does not automatically enable the digital input buffer on the pin. The buffer must be enabled for each remap pin (RPx) by disabling all higher priority pin functions on that pin. Typically, all functions other than GPIO are considered higher priority than remap pins. See Function Priority for Device Pins for the list and priority of pin functions on each pin from Related Links. The mapping is dynamic; therefore, in order to avoid glitching outputs, the user is responsible for turning off the appropriate peripherals before remapping the pin functions associated with that peripheral. On Reset, all inputs are mapped to a default value and all outputs are disabled; therefore, the mapping may safely be performed after any device Reset. Related Links 6.2.7.3. Remappable Input Example 6.2.7.4. [pin name]R 6.3. Function Priority for Device Pins 6.2.7.2 Remappable Input Priority Only a single pin can be selected for any of the remappable peripheral inputs; therefore, priority encoding is not needed for RP inputs. Note:A remappable input function does not have any control over the output of the RPx pin. In this way, it is possible to drive a remappable output function on an RPx pin and a completely different remappable input function on the same pin. This can be useful, for instance, in driving an EVSYS output back into a Timer clock or gating input by assigning both functions to the same remap pin. Note:To allow flexibility on 32 or 48-pin devices, the same input functions are repeated in multiple groups. Therefore, in order to differentiate between them, the Off code is provided in the Input Pin Selection Group 1, Input Pin Selection Group 2, Input Pin Selection Group 3 and Input Pin Selection Group 4 tables. See these tables in the Remappable Input Example from Related Links. The software must ensure that the unused group register offset of a (repeated) input function is programmed to 4h0 for proper operation. Failure to do so will lead to unknown behavior. Related Links 6.2.7.3. Remappable Input Example 6.2.7.3 Remappable Input Example For example, the following figure illustrates the remappable pin selection for the EXTINT0 input. To remap the EXTINT0 input to a particular pin, the EXTINT0R remap register must be programmed. EXTINT0 is in group 1;
therefore, it can be mapped to any pin that is in group 1 (RPA3, RPA7, RPA9, RPA11, RPB0, RPB4, RPB8 and so on). To map it to RPB0, program the value 4 (4b0100) into the EXINTR0R SFR register. See the following Input Pin Selection Group 1 table. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 38 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Figure 6-2. EXTINT0 Remappable Pin Selection EXTINT0R[3:0]
RPA3 RPA7 RPA11 RPn EXTINT0 Input to Peripheral 0 1 2 n Note:For input only, the PPS functionality does not have priority over the TRISx settings. Therefore, when configuring the RPn pin for input, the corresponding bit in the TRISx register must also be configured for input
(set to 1). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 39 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Table 6-2. Input Pin Selection Group 1 Peripheral Pin
[pin name]R SFR
[pin name]R bits
[pin name]R Value to RPn Pin Selection EXTINT0 EXTINT0R EXTINT0[3:0]
0000 = OFF SERCOM0_PAD3 SCOM0P3R SCOM0P3R[3:0]
SERCOM1_PAD2 SCOM1P2R SCOM1P2R[3:0]
SERCOM2_PAD1 SCOM2P1R SCOM2P1R[3:0]
SERCOM3_PAD0 SCOM3P0R SCOM3P0R[3:0]
QSCK QD1 REFI CCLIN0 CCLIN3 QSCKR QD1R REFIR CCLIN0R CCLIN3R QSCKR[3:0]
QD1R[3:0]
REFIR[3:0]
CCLIN0R[3:0]
CCLIN3R[3:0]
TC0_WO0G1 TC0WO0G1R TC0WO0G1R[3:0]
TC1_WO0G1 TC1WO0G1R TC1WO0G1R[3:0]
TC2_WO0G1 TC2WO0G1R TC2WO0G1R[3:0]
TC3_WO0G1 TC3WO0G1R TC3WO0G1R[3:0]
Table 6-3. Input Pin Selection Group 2 0001 = RPA3 0010 = RPA7 0011 = RPA11 0100 = RPB0 0101 = RPB4 0110 = RPB8 0111 = RPB12 1000 = RPA2 1001 = RPA6 1010 = RPA10 1011 = RPA14 1100 = RPB3 1101 = RPB7 1110 = RPB11 1111 = RPA9 Peripheral Pin
[pin name]R SFR
[pin name]R bits
[pin name]R Value to RPn Pin Selection EXTINT1 EXTINT1R EXTINT1R[3:0]
0000 = OFF SERCOM0_PAD0 SCOM0P0R SCOM0P0R[3:0]
SERCOM1_PAD3 SCOM1P3R SCOM1P3R[3:0]
SERCOM2_PAD2 SCOM2P2R SCOM2P2R[3:0]
SERCOM3_PAD1 SCOM3P1R SCOM3P1R[3:0]
QD2 CCLIN1 CCLIN4 QD2R CCLIN1R CCLIN4R QD2R[3:0]
CCLIN1R[3:0]
CCLIN4R[3:0]
TC0_WO0G2 TC0WO0G2R TC0WO0G2R[3:0]
TC1_WO1G2 TC1WO1G2R TC1WO1G2R[3:0]
TC2_WO1G2 TC2WO1G1R TC2WO1G1R[3:0]
TC3_WO1G2 TC3WO1G1R TC3WO1G1R[3:0]
0001 = RPA4 0010 = RPA8 0011 = RPA12 0100 = RPB1 0101 = RPB5 0110 = RPB9 0111 = RPB13 1000 = RPA3 1001 = RPA7 1010 = RPA11 1011 = RPB0 1100 = RPB4 1101 = RPB8 1110 = RPB12 1111 = RPA0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 40 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Table 6-4. Input Pin Selection Group 3 Peripheral Pin
[pin name]R SFR [pin name]R bits
[pin name]R Value to RPn Pin Selection EXTINT2 EXTINT2R EXTINT2R[3:0]
0000 = OFF SERCOM0_PAD1 SCOM0P1R SCOM0P1R[3:0]
SERCOM1_PAD0 SCOM1P0R SCOM1P0R[3:0]
SERCOM2_PAD3 SCOM2P3R SCOM2P3R[3:0]
SERCOM3_PAD2 SCOM3P2R SCOM3P2R[3:0]
QD3 CCLIN2 CCLIN5 QD3R QD3R[3:0]
CCLIN2R CCLIN2R[3:0]
CCLIN5R CCLIN5R[3:0]
TC0_WO1G3 TC0WO1G3R TC0WO1G3R[3:0]
TC2_WO0G3 TC2WO0G3R TC2WO0G3R[3:0]
TC3_WO0G3 TC3WO0G3R TC3WO0G3R[3:0]
0001 = RPA5 0010 = RPA9 0011 = RPA13 0100 = RPB2 0101 = RPB6 0110 = RPB10 0111 = RPA0 1000 = RPA4 1001 = RPA8 1010 = RPA12 1011 = RPB1 1100 = RPB5 1101 = RPB9 1110 = RPB13 1111 = RPA1 Table 6-5. Input Pin Selection Group 4 Peripheral Pin
[pin name]R SFR [pin name]R bits
[pin name]R Value to RPn Pin Selection EXTINT3 EXTINT3R EXTINT3R[3:0]
0000 = OFF NMI NMIR NMIR[3:0]
SERCOM0_PAD2 SCOM0P2R SCOM0P2R[3:0]
SERCOM1_PAD1 SCOM1P1R SCOM1P1R[3:0]
SERCOM2_PAD0 SCOM2P0R SCOM2P0R[3:0]
SERCOM3_PAD3 SCOM3P3R SCOM3P3R[3:0]
QD0 QD0R QD0R[3:0]
TC0_WO1G4 TC0WO1G4R TC0WO1G4R[3:0]
TC2_WO1G4 TC2WO1G4R TC2WO1G4R[3:0]
TC3_WO1G4 TC3WO1G4R TC3WO1G4R[3:0]
0001 = RPA6 0010 =RPA10 0011 = RPA14 0100 = RPB3 0101 =RPB7 0110 = RPB11 0111 = RPA1 1000 = RPA5 1001 = RPA9 1010 = RPA13 1011 = RPB2 1100 = RPB6 1101 = RPB10 1110 = RPA8 1111 = RPA2 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 41 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) 6.2.7.4 Peripheral Pin Select Input Register Name:
Offset:
Reset:
Property:
Notes:
[pin name]R See the following Note 0x00
1. For the Offset address, see Peripheral Pin Select Input Registers table in the I/O Ports Control Registers from Related Links. 2. Register values can only be changed if the IOLOCK Configuration bit (CFGCON0[13]) = 0. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 Access Reset Bit 7 6 5 4 3 1 2
[pin name]R[3:0]
8 0 Access Reset R/W-0 0 R/W-0 0 R/W-0 0 R/W-0 0 Bits 3:0 [pin name]R[3:0]Peripheral Pin Select Input bits Where [pin name] refers to the pins that are used to configure peripheral input mapping. See Input Pin Selection Group 1, Input Pin Selection Group 2, Input Pin Selection Group 3 and Input Pin Selection Group 4 tables in the Remappable Input Example for input pin selection values from Related Links. Note:This field is only writable when CFGCON0.IOLOCK = 0. Related Links 6.2.7.3. Remappable Input Example 6.4. I/O Ports Control Registers 6.2.8 Output Mapping The remappable pin output assigns a peripheral output function to an output pin. Once the group for the output pin is identified, see the following table, which shows the peripheral output functions and its group. Each remappable output can be programmed to an output function that is from its same output group number. As an example, if RPA0 is part of GROUP2, then it can be programmed to have any GROUP2 output function on its pin. Therefore, for a given output peripheral signal, the user must first choose which remappable pin to use, choose a Group number for that pin and, then, program the control registers for that pin. For example, RPA<0-10, 13, 14>
G<1, 2, 3, 4> R or RPB<0-13> G<1, 2, 3, 4>R. See Remappable Output Pin Configuration Group1, Remappable Output Pin Configuration Group2, Remappable Output Pin Configuration Group3, and Remappable Output Pin Configuration Group4 tables in the Pin Output RP Registers from Related Links. The rules for which group belongs to which pin must be followed, such that multiple peripherals are not driving the same pin from different groups. For instance, pin RPA0 (PA0) as an output belongs to Group2 and Group3. If the peripheral driving the signal to RPA0 is coming from Group2, the software must ensure that all Group3 signals for RPA0 are disabled with an OFF value in the corresponding RPA0G3R control register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 42 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) A null output is associated with the output register reset value of 0. This is done to ensure that remappable outputs remain disconnected from all output pins, by default. Table 6-6. PPS Output Groups Group1 Group2 Group3 Group4 SERCOM0_PAD3 SERCOM0_PAD0 SERCOM0_PAD1 SERCOM0_PAD2 SERCOM0_PAD2 SERCOM0_PAD3 SERCOM0_PAD0 SERCOM0_PAD1 SERCOM0_PAD1 SERCOM0_PAD2 SERCOM0_PAD3 SERCOM0_PAD0 SERCOM1_PAD0 SERCOM1_PAD1 SERCOM1_PAD2 SERCOM1_PAD3 SERCOM1_PAD2 SERCOM1_PAD3 SERCOM1_PAD0 SERCOM1_PAD1 SERCOM1_PAD1 SERCOM1_PAD2 SERCOM1_PAD3 SERCOM1_PAD0 SERCOM2_PAD0 SERCOM2_PAD1 SERCOM2_PAD2 SERCOM2_PAD3 SERCOM2_PAD1 SERCOM2_PAD2 SERCOM2_PAD3 SERCOM2_PAD0 SERCOM3_PAD0 SERCOM3_PAD1 SERCOM3_PAD2 SERCOM3_PAD3 SERCOM3_PAD3 SERCOM3_PAD0 SERCOM3_PAD1 SERCOM3_PAD2 TCC0_WO0 TCC0_WO4 TCC0_WO2 TCC1_WO0 TCC1_WO4 TCC1_WO2 TCC2_WO0 TC0_WO1 REFO1 TC1_WO0 TC2_WO0 TC3_WO0 QSPI_SCK QSPI_CS QSPI_DATA3 QSPI_DATA2 QSPI_DATA1 CCL_OUT0 TCC0_WO1 TCC0_WO5 TCC0_WO3 TCC1_WO1 TCC1_WO5 TCC1_WO3 TCC2_WO1 TC0_WO1 REFO2 TC1_WO1 TC2_WO1 TC3_WO1 QSPI_SCK QSPI_CS QSPI_DATA0 QSPI_DATA3 QSPI_DATA2 CCL_OUT1 TCC0_WO2 TCC0_WO0 TCC0_WO4 TCC1_WO2 TCC1_WO0 TCC1_WO4 TCC2_WO0 TC0_WO0 REFO3 TC1_WO0 TC2_WO0 TC3_WO0 QSPI_SCK QSPI_CS QSPI_DATA1 QSPI_DATA0 QSPI_DATA3 CCL_OUT0 TCC0_WO3 TCC0_WO1 TCC0_WO5 TCC1_WO3 TCC1_WO1 TCC1_WO5 TCC2_WO1 TC0_WO0 REFO4 TC1_WO1 TC2_WO1 TC3_WO1 QSPI_SCK QSPI_CS QSPI_DATA2 QSPI_DATA1 QSPI_DATA0 CCL_OUT1 Related Links 6.2.9. Pin Output RP Registers 6.2.9 Pin Output RP Registers Register RPnR shows the RP Remap Register format for output functions. See RPnR from Related Links. Each RP pin has a 4-bit field that can be assigned to the desired output function. See the following tables for a complete list of output function values and associated register names. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 43 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) The mapping is dynamic; therefore, to avoid glitching outputs, the user must ensure that the appropriate peripherals are turned off before remapping the functions. On Reset, all inputs are mapped to a default value and all outputs are disabled; therefore, the mapping must be performed after any device Reset. Figure 6-3. Example Muiltiplexing of Remappable Output Signal for RPA0 (Map Output Function to Pin) RPA0G2R[4:0]
1'b0 SERCOM0_PAD0_Enable SERCOM0_PAD3_Enable
(Others) 0 1 2 31 RPA0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 44 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Table 6-7. Remappable Output Pin Configuration Group1 Output Pin
[pin name]R SFR
[pin name]R bits
[pin name]R Value to RPn Pin Selection RPA2 RPA2G1R RPA2G1R[4:0]
00000 = OFF RPA3 RPA3G1R RPA3G1R[4:0]
RPA5 RPA5G1R RPA5G1R[4:0]
RPA6 RPA6G1R RPA6G1R[4:0]
RPA7 RPA7G1R RPA7G1R[4:0]
RPA9 RPA9G1R RPA9G1R[4:0]
RPA10 RPA10G1R RPA10G1R[4:0]
RPA14 RPA14G1R RPA14G1R[4:0]
RPB0 RPB0G1R RPB0G1R[4:0]
RPB3 RPB3G1R RPB3G1R[4:0]
RPB4 RPB4G1R RPB4G1R[4:0]
RPB7 RPB7G1R RPB7G1R[4:0]
RPB8 RPB8G1R RPB8G1R[4:0]
RPB11 RPB11G1R RPB11G1R[4:0]
RPB12 RPB12G1R RPB12G1R[4:0]
00001 = SERCOM0_PAD3 00010 = SERCOM0_PAD2 00011 = SERCOM0_PAD1 00100 = SERCOM1_PAD0 00101 = SERCOM1_PAD2 00110 = SERCOM1_PAD1 00111 = SERCOM2_PAD0 01000 = SERCOM2_PAD1 01001 = SERCOM3_PAD0 01010 = SERCOM3_PAD3 01011 = TCC0_WO0 01100 = TCC0_WO4 01101 = TCC0_WO2 01110 = TCC1_WO0 01111 = TCC1_WO4 10000 = TCC1_WO2 10001 = TCC2_WO0 10010 = TC0_WO1 10011 = REFO1 10100 = TC1_WO0 10101 = TC2_WO0 10110 = TC3_WO0 10111 = QSCK 11000 = QCS 11001 = QD3 11010 = QD2 11011 = QD1 11100 = CCLOUT0 11101 = RESERVED 11110 = RESERVED 11111 = RESERVED 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 45 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Table 6-8. Remappable Output Pin Configuration Group2 Output Pin
[pin name]R SFR
[pin name]R bits
[pin name]R Value to RPn Pin Selection RPA0 RPA0G2R RPA0G2R[4:0]
RPA3 RPA4 RPA6 RPA7 RPA8 RPB0 RPB1 RPB4 RPB5 RPB8 RPB9 RPA3G2R RPA4G2R RPA6G2R RPA7G2R RPA8G2R RPB0G2R RPB1G2R RPB4G2R RPB5G2R RPB8G2R RPB9G2R RPA3G2R[4:0]
RPA4G2R[4:0]
RPA6G2R[4:0]
RPA7G2R[4:0]
RPA8G2R[4:0]
RPB0G2R[4:0]
RPB1G2R[4:0]
RPB4G2R[4:0]
RPB5G2R[4:0]
RPB8G2R[4:0]
RPB9G2R[4:0]
RPB12 RPB12G2R RPB12G2R[4:0]
RPB13 RPB13G2R RPB13G2R[4:0]
00000 = OFF 00001 = SERCOM0_PAD0 00010 = SERCOM0_PAD3 00011 = SERCOM0_PAD2 00100 = SERCOM1_PAD1 00101 = SERCOM1_PAD3 00110 = SERCOM1_PAD2 00111 = SERCOM2_PAD1 01000 = SERCOM2_PAD2 01001 = SERCOM3_PAD1 01010 = SERCOM3_PAD0 01011 = TCC0_WO1 01100 = TCC0_WO5 01101 = TCC0_WO3 01110 = TCC1_WO1 01111 = TCC1_WO5 10000 = TCC1_WO3 10001 = TCC2_WO1 10010 = TC0_WO1 10011 = REFO2 10100 = TC1_WO1 10101 = TC2_WO1 10110 = TC3_WO1 10111 = QSCK 11000 = QCS 11001 = QD0 11010 = QD3 11011 = QD2 11100 = CCLOUT1 11101 = RESERVED 11110 = RESERVED 11111 = RESERVED 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 46 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Table 6-9. Remappable Output Pin Configuration - Group3 Output Pin
[pin name]R SFR
[pin name]R bits
[pin name]R Value to RPn Pin Selection RPA0G3R RPA0G3R[4:0]
00000 = OFF RPA1G3R RPA1G3R[4:0]
RPA3G3R RPA4G3R RPA5G3R RPA8G3R RPA9G3R RPA3G3R[4:0]
RPA4G3R[4:0]
RPA5G3R[4:0]
RPA8G3R[4:0]
RPA9G3R[4:0]
RPA13 RPA13G3R RPA13G3R[4:0]
RPA0 RPA1 RPA3 RPA4 RPA5 RPA8 RPA9 RPB1 RPB2 RPB5 RPB6 RPB9 RPB10 RPB13 RPB1G3R RPB2G3R RPB5G3R RPB6G3R RPB9G3R RPB1GX3R[4:0]
RPB2G3R[4:0]
RPB5G3R[4:0]
01011 = TCC0_WO2 RPB6G3R[4:0]
01100 = TCC0_WO0 RPB9G3R[4:0]
RPB10G3R RPB10G3R[4:0]
RPB13G3R RPB13G3R[4:0]
00001 = SERCOM0_PAD1 00010 = SERCOM0_PAD0 00011 = SERCOM0_PAD3 00100 = SERCOM1_PAD2 00101 = SERCOM1_PAD0 00110 = SERCOM1_PAD3 00111 = SERCOM2_PAD2 01000 = SERCOM2_PAD3 01001 = SERCOM3_PAD2 01010 = SERCOM3_PAD1 01101 = TCC0_WO4 01110 = TCC1_WO2 01111 = TCC1_WO0 10000 = TCC1_WO4 10001 = TCC2_WO0 10010 = TC0_WO0 10011 = REFO3 10100 = TC1_WO0 10101 = TC2_WO0 10110 = TC3_WO0 10111 = QSCK 11000 = QCS 11001 = QD1 11010 = QD0 11011 = QD3 11100 = CCLOUT0 11101 = RESERVED 11110 = RESERVED 11111 = RESERVED 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 47 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Table 6-10. Remappable Output Pin Configuration Group4 Output Pin
[pin name]R SFR
[pin name]R Value to RPn Pin Selection RPA1 RPA2 RPA4 RPA5 RPA6 RPA8 RPA9 RPA10 RPA13 RPA14 RPB2 RPB3 RPB6 RPB7 RPB10 RPB11 RPA1G4R RPA2G4R RPA4G4R RPA5G4R RPA6G4R RPA8G4R RPA9G4R RPA10G4R RPA13G4R RPA14G4R RPB2G4R RPB3G4R RPB6G4R RPB7G4R RPB10G4R RPB11G4R Related Links 6.2.9.1. RPnR 00000 = OFF 00001 = SERCOM0_PAD2 00010 = SERCOM0_PAD1 00011 = SERCOM0_PAD0 00100 = SERCOM1_PAD3 00101 = SERCOM1_PAD1 00110 = SERCOM1_PAD0 00111 = SERCOM2_PAD3 01000 = SERCOM2_PAD0 01001 = SERCOM3_PAD3 01010 = SERCOM3_PAD2 01011 = TCC0_WO3 01100 = TCC0_WO1 01101 = TCC0_WO5 01110 = TCC1_WO3 01111 = TCC1_WO1 10000 = TCC1_WO5 10001 = TCC2_WO1 10010 = TC0_WO0 10011 = REFO4 10100 = TC1_WO1 10101 = TC2_WO1 10110 = TC3_WO1 10111 = QSCK 11000 = QCS 11001 = QD2 11010 = QD1 11011 = QD0 11100 = CCLOUT1 11101 = RESERVED 11110 = RESERVED 11111 = RESERVED 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 48 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) 6.2.9.1 Peripheral Pin Select Output Register Name:
Offset:
Reset:
Property:
RPnR See the following Note 0x0
Notes:
1. For the Offset address, see the Peripheral Pin Select Output Registers table in the I/O Ports Control Registers from Related Links. 2. Register values can only be changed if the IOLOCK Configuration bit (CFGCON0.IOLOCK) = 0. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 Access Reset 4 R/W 0 3 R/W 0 2 RPnR[4:0]
R/W 0 9 1 8 0 R/W 0 R/W 0 Bits 4:0 RPnR[4:0]Peripheral Pin Select Output Register Output bits. For output pin selection values, see Remappable Output Pin Configuration Group1, Remappable Output Pin Configuration Group2, Remappable Output Pin Configuration Group3, and Remappable Output Pin Configuration Group4 tables in the Pin Output RP Registers from Related Links. Note:This field is only writable, when CFGCON0.IOLOCK = 0. Related Links 6.4. I/O Ports Control Registers 6.2.9. Pin Output RP Registers 6.3 Function Priority for Device Pins The device pins have an associated priority order where functionality is exhibited on each pin. This priority order impacts the availability of PPS functionality. For example, if SERCOM0 is enabled with outputs chosen to be High Speed/Direct mode in the DEVCFG1 fuses (bit 17), pins PA3, PA4, PA5 and PA6 are given priority to be used as SERCOM0 pins instead of GPIO/PPS pins. See the following tables for the priority in which functions are brought out on each device pin. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 49 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Table 6-11. Priority for Device Pins PAn (n=0-14) Pin Name
(1) Functions in Priority Order Reference Peripheral Pin Number
(48-pin) I/O Type pa0 QSPI_DATA2 RTC_IN3 RPA0 IOCA0 RA0 pa1 QSPI_DATA3 AC_CMP1 RTC_IN2 RPA1 IOCA1 RA1 4 5 QSPI RTCC PPS Change Notification GPIO QSPI Analog Comparator RTCC PPS Change Notification GPIO pa2 AC_CMP0 Analog Comparator 6 RTC_IN1 RPA2 IOCA2 RA2 SCLKI pa3 RTCC PPS Change Notification GPIO Secondary Oscillator - Digital 47 SERCOM0_PAD2 SERCOM0 RTC_IN0 RPA3 IOCA3 RA3 RTCC PPS Change Notification GPIO pa4 SERCOM0_PAD3 SERCOM0 42 RTC_OUT RPA4 IOCA4 RA4 pa5 SERCOM0_PAD0 RPA5 IOCA5 RA5 RTCC PPS Change Notification GPIO SERCOM0 PPS Change Notification GPIO 7 I/O I I/O I I/O I/O O I I/O I I/O O I I/O I I/O I I/O I I/O I I/O I/O O I/O I I/O I/O I/O I I/O DIG/ST ST/STMV DIG/ST ST DIG/ST DIG/ST DIG ST/STMV DIG/ST ST DIG/ST DIG ST/STMV DIG/ST ST DIG/ST ST/STMV DIG/ST ST/STMV DIG/ST ST DIG/ST DIG/ST DIGMV DIG/ST ST DIG/ST DIG/ST/
I2C(1)/SMB DIG/ST ST DIG/ST 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 50 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS)
...........continued Pin Name
(1) Functions in Priority Order Reference Peripheral Pin Number
(48-pin) I/O Type pa6 PGC2ENTRY SERCOM0_PAD1 DEBUG SERCOM0 AC_CMP1_ALT Analog Comparator RPA6 IOCA6 RA6 pa7 TRACECLK SERCOM1_PAD0 RPA7 IOCA7 RA7 pa8 PGD2ENTRY FECTRL0 SERCOM1_PAD1 RPA8 IOCA8 RA8 pa9 FECTRL1 SERCOM1_PAD2 RTC_IN0_ALT RPA9 IOCA9 RA9 pa10 FECTRL2 SERCOM1_PAD3 RTC_OUT_ALT RPA10 IOCA10 RA10 SOSCI SOSCO pa11 pa12 PPS Change Notification GPIO DEBUG SERCOM1 PPS Change Notification GPIO DEBUG RF Radio SERCOM1 PPS Change Notification GPIO RF Radio SERCOM1 RTCC PPS Change Notification GPIO RF Radio SERCOM1 RTCC PPS Change Notification GPIO Secondary Oscillator Secondary Oscillator 9 10 11 12 13 45 46 I I/O O I/O I I/O I I/O I/O I I/O I O I/O I/O I I/O O I/O I I/O I I/O O I/O O I/O I I/O ST DIG/ST/
I2C(1)/SMB DIG DIG/ST ST DIG/ST DIG DIG/ST/
I2C(1)/SMB DIG/ST ST DIG/ST ST DIG DIG/ST/
I2C(1)/SMB DIG/ST ST DIG/ST DIG DIG/ST ST/STMV DIG/ST ST DIG/ST DIG DIG/ST DIGMV DIG/ST ST DIG/ST 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 51 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS)
...........continued Pin Name
(1) Functions in Priority Order Reference Peripheral pa13 COEXCTRL0 SERCOM2_PAD0 RPA13 IOCA13 RA13 pa14 COEXCTRL1 SERCOM2_PAD1 RPA14 IOCA14 RA14 RF Radio SERCOM2 PPS Change Notification GPIO RF Radio SERCOM2 PPS Change Notification GPIO Pin Number
(48-pin) 16 17 I/O Type I/O I/O I/O I I/O I/O I/O I/O I I/O DIG/ST DIG/ST/
I2C(1)/SMB DIG/ST ST DIG/ST DIG/ST DIG/ST/
I2C(1)/SMB DIG/ST ST DIG/ST Note:
1. SERCOMx_PADx supports SPI, UART, and I2C modes. SERCOM I2C mode is specifically mentioned in the
"Type" column as it does not support Peripheral Pin Select (PPS) functionality. Table 6-12. Priority for Device Pins PBn (n=0-13) Pin Name
(1) Functions in Priority Order pb0 COEXCTRL2 AN4 AC_AIN2 RPB0 IOCB0 RB0 AN5 Reference Peripheral RF Radio ADC Analog Comparator PPS Change Notification GPIO ADC pb1 pb2 AC_AIN3 Analog Comparator RPB1 IOCB1 RB1 AN6 PPS Change Notification GPIO ADC AC_AIN0 Analog Comparator RPB2 IOCB2 RB2 PPS Change Notification GPIO Pin Number
(48-pin) 30 31 32 I/O I/O I I I/O I I/O I I I/O I I/O I I I/O I I/O Type DIG/ST ANALOG ANALOG DIG/ST ST DIG/ST ANALOG ANALOG DIG/ST ST DIG/ST ANALOG ANALOG DIG/ST ST DIG/ST 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 52 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS)
...........continued Pin Name
(1) Functions in Priority Order Reference Peripheral Pin Number
(48-pin) I/O 33 34 35 37 pb3 AN7 ADC AC_AIN1 Analog Comparator RPB3 IOCB3 RB3 pb4 PGC1ENTRY FECTRL3 AN0 TP4 RPB4 INT0 IOCB4 RB4 pb5 PGC4ENTRY TRACEDAT0 FECTRL4 AN1 TP5 RPB5 IOCB5 RB5 pb6 PGD1ENTRY TRACEDAT1 FECTRL5 AN2 ANN0 RPB6 IOCB6 RB6 PPS Change Notification GPIO Debug RF Radio ADC DO NOT USE PPS Edge Interrupt Change Notification GPIO Debug Debug RF Radio ADC DO NOT USE PPS Change Notification GPIO Debug Debug RF Radio ADC ADC (Differential) PPS Change Notification GPIO Type ANALOG ANALOG DIG/ST ST DIG/ST ST DIG ANALOG DIG/ST ST/STMV ST I I I/O I I/O I O I I/0 I I I/O DIG/ST I O O I I/O I I/O I O O I I I/O I I/O ST DIG DIG ANALOG DIG/ST ST DIG/ST ST DIG DIG ANALOG ANALOG DIG/ST ST DIG/ST 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 53 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS)
...........continued Pin Name
(1) Functions in Priority Order pb7 PGD4ENTRY CM4_SWO TRACEDAT2 AN3 LVDIN RPB7 IOCB7 RB7 pb8 CM4_SWCLK RPB8 IOCB8 RB8 pb9 CM4_SWDIO RPB9 IOCB9 RB9 pb10 QSPI_CS RPB10 IOCB10 RB10 pb11 QSPI_SCK RPB11 IOCB11 RB11 pb12 QSPI_DATA0 RPB12 IOCB12 RB12 pb13 QSPI_DATA1 RTC_EVENT RPB13 IOCB13 RB13 Reference Peripheral Pin Number
(48-pin) I/O 38 41 40 43 44 14 15 Debug Debug Debug ADC LVD Voltage Reference PPS Change Notification GPIO DEBUG PPS Change Notification GPIO DEBUG PPS Change Notification GPIO QSPI PPS Change Notification GPIO QSPI PPS Change Notification GPIO QSPI PPS Change Notification GPIO QSPI RTCC PPS Change Notification GPIO I O O I I I/O I I/O I I/O I I/O I/O I/O I I/O O I/O I I/O I/O I/O I I/O I/O I/O I I/O I/O O I/O I I/O Type ST DIG DIG ANALOG ANALOG DIG/ST ST DIG/ST ST DIG/ST ST DIG/ST DIG/ST DIG/ST ST DIG/ST DIG DIG/ST ST DIG/ST DIG/ST DIG/ST ST DIG/ST DIG/ST DIG/ST ST DIG/ST DIG/ST DIGMV DIG/ST ST DIG/ST 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 54 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) 6.4 I/O Ports Control Registers Notes:The following conventions are used in the following tables:
x = Unknown value on Reset
= Unimplemented, read as 0; Reset values are shown in hexadecimal 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 55 a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y l i I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 5 6 Table 6-13. PortA Register Map e g n a R t i B r e t s i g e R s s e r d d A l a u t r i V
) 0 0 2 2 _ 0 0 4 4 x 0
rotatethispage90 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0010 TRISA 31:16 0000 15:0 TRISA14 TRISA13 TRISA12* TRISA11*
TRISA10 TRISA9 TRISA8 TRISA7 TRISA6 TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 0000 0020 PORTA 31:16 0000 15:0 RA14 RA13 RA12*
RA11*
RA10 RA9 RA8 RA7 RA6 RA5 RA4 RA3 RA2 RA1 RA0 0000 0030 LATA 31:16 0000 15:0 LATA14 LATA13 LATA12*
LATA11*
LATA10 LATA9 LATA8 LATA7 LATA6 LATA5 LATA4 LATA3 LATA2 LATA1 LATA0 0000 0040 ODCA 31:16 15:0 ODCA14 ODCA13 0050 CNPUA 31:16 15:0 CNPUA14 CNPUA13 0060 CNPDA 31:16 15:0 CNPDA14 CNPDA13 0070 CNCONA 31:16 15:0 ON FRZ SIDL 0080 CNENA 31:16 15:0 CNENA14 CNENA13 0090 CNSTATA 31:16 0000 ODCA10 ODCA9 ODCA8 ODCA7 ODCA6 ODCA5 ODCA4 ODCA3 ODCA2 ODCA1 ODCA0 0000 0000 CNPUA10 CNPUA9 CNPUA8 CNPUA7 CNPUA6 CNPUA5 CNPUA4 CNPUA3 CNPUA2 CNPUA1 CNPUA0 0000 0000 CNPDA10 CNPDA9 CNPDA8 CNPDA7 CNPDA6 CNPDA5 CNPDA4 CNPDA3 CNPDA2 CNPDA1 CNPDA0 0000 EDGEDETECT 0000 0000 0000 CNENA10 CNENA9 CNENA8 CNENA7 CNENA6 CNENA5 CNENA4 CNENA3 CNENA2 CNENA1 CNENA0 0000 0000 0000 15:0 CN STATA14 CN STATA13 CN STATA12 CN STATA11 CN STATA10 CN STATA9 CN STATA8 CN STATA7 CN STATA6 CN STATA5 CN STATA4 CN STATA3 CN STATA2 CN STATA1 CN STATA0 00A0 CNNEA 31:16 15:0 CNNEA14 CNNEA13 00B0 CNFA 31:16 15:0 CNFA14 CNFA13 0000 CNNEA10 CNNEA9 CNNEA8 CNNEA7 CNNEA6 CNNEA5 CNNEA4 CNNEA3 CNNEA2 CNNEA1 CNNEA0 0000 0000 CNFA10 CNFA9 CNFA9 CNFA7 CNFA76 CNFA5 CNFA4 CNFA3 CNFA2 CNFA71 CNFA0 0000 I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y l i I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 5 7
...........continued r e t s i g e R s s e r d d A l a u t r i V
) 0 0 2 2 _ 0 0 4 4 x 0
rotatethispage90 e g n a R t i B Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 00C0 SRCON0A 31:16 15:0 SR014 SR013 00D0 SRCON1A 31:16 15:0 SR114 SR113 SR010 SR09 SR08 SR07 SR06 SR05 SR04 SR03 SR110 SR19 SR18 SR17 SR16 SR15 SR14 SR13 0000 SR01 SR00 0000 0000 SR11 SR10 0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) 1. All registers in this table have corresponding CLR, SET and INV registers at their virtual addresses, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET and INV Registers from Related Links. Note:
* - Not applicable for PIC32CX1012BZ25048 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 58 a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y l i I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 5 9 Table 6-14. PortB Register Map e g n a R t i B r e t s i g e R s s e r d d A l a u t r i V
) 0 0 3 2 _ 0 0 4 4 x 0
rotatethispage90 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0100 ANSELB 31:16 15:0 0110 TRISB 31:16 15:0 0120 PORTB 31:16 15:0 0130 LATB 31:16 15:0 0140 ODCB 31:16 15:0 0150 CNPUB 31:16 15:0 0160 CNPDB 31:16 15:0 0170 CNCONB 31:16 0180 CNENB 31:16 15:0 0190 CNSTATB 31:16 15:0 01A0 CNNEB 31:16 15:0 0000 ANSB7 ANSB6 ANSB5 ANSB4 ANSB3 ANSB2 ANSB1 ANSB0 FFFF 0000 TRISB13 TRISB12 TRISB11 TRISB10 TRISB9 TRISB8 TRISB7 TRISB6 TRISB5 TRISB4 TRISB3 TRISB2 TRISB1 TRISB0 0000 RB13 RB12 RB11 RB10 RB9 RB8 RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 0000 0000 0000 LATB13 LATB12 LATB11 LATB10 LATB9 LATB8 LATB7 LATB6 LATB5 LATB4 LATB3 LATB2 LATB1 LATB0 0000 0000 ODCB13 ODCB12 ODCB11 ODCB10 ODCB9 ODCB8 ODCB7 ODCB6 ODCB5 ODCB4 ODCB3 ODCB2 ODCB1 ODCB0 0000 0000 CNPUB13 CNPUB12 CNPUB11 CNPUB10 CNPUB9 CNPUB8 CNPUB7 CNPUB6 CNPUB5 CNPUB4 CNPUB3 CNPUB2 CNPUB1 CNPUB0 0000 0000 CNPDB13 CNPDB12 CNPDB11 CNPDB10 CNPDB9 CNPDB8 CNPDB7 CNPDB6 CNPDB5 CNPDB4 CNPDB3 CNPDB2 CNPDB1 CNPDB0 0000 15:0 ON FRZ SIDL EDGE DETECT 0000 0000 0000 CNENB13 CNENB12 CNENB11 CNENB10 CNENB9 CNENB8 CNENB7 CNENB6 CNENB5 CNENB4 CNENB3 CNENB2 CNENB1 CNENB0 0000 CN STATB13 CN STATB12 CN STATB11 CN STATB10 CN STATB9 CN STATB8 CN STATB7 CN STATB6 CN STATB5 CN STATB4 CN STATB3 CN STATB2 CN STATB1 CN STATB0 0000 0000 0000 CNNEB13 CNNEB12 CNNEB11 CNNEB10 CNNEB9 CNNEB8 CNNEB7 CNNEB6 CNNEB5 CNNEB4 CNNEB3 CNNEB2 CNNEB1 CNNEB0 0000 I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y i l I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 6 0
...........continued r e t s i g e R s s e r d d A l a u t r i V
) 0 0 3 2 _ 0 0 4 4 x 0
rotatethispage90 e g n a R t i B Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 01B0 CNFB 31:16 15:0 01C0 SRCON0B 31:16 15:0 01D0 SRCON1B 31:16 15:0 0000 CNFB13 CNFB12 CNFB11 CNFB10 CNFB9 CNFB8 CNFB7 CNFB6 CNFB5 CNFB4 CNFB3 CNFB2 CNFB1 CNFB0 0000 SR013 SR012 SR011 SR010 SR113 SR112 SR111 SR110 0000 0000 0000 0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) 1. All registers in this table have corresponding CLR, SET and INV registers at their virtual address, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET and INV Registers from Related Links. Notes:The following conventions are used in the following tables:
R = Readable bit W = Writable bit U = Unimplemented bit, read as 0
-n = Value at POR 1 = Bit is set 0 = Bit is cleared x = Bit is unknown 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 61 a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y l i I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 6 2 Table 6-15. Peripheral Pin Select Input Registers s s e r d d A l a u t r i V
) 0 0 0 1 _ 0 0 4 4
rotatethispage90 0000h e m a N r e t s i g e R EXTINT0R 0004h EXTINT1R 0008h EXTINT2R 000Ch EXTINT3R 003Ch NMIR 0040h SCOM0P0R 0044h SCOM0P1R 0048h SCOM0P2R 004Ch SCOM0P3R 0050h SCOM1P0R 0054h SCOM1P1R 0058h SCOM1P2R e g n a R t i B 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0000 EXTINT0R[3:0]
0000 0000 EXTINT1R[3:0]
0000 0000 EXTINT2R[3:0]
0000 0000 EXTINT3R[3:0]
0000 0000 NMIR[3:0]
0000 0000 SCOM0P0R[3:0]
0000 0000 SCOM0P1R[3:0]
0000 0000 SCOM0P2R[3:0]
0000 0000 SCOM0P3R[3:0]
0000 0000 SCOM1P0R[3:0]
0000 0000 SCOM1P1R[3:0]
0000 0000 SCOM1P2R[3:0]
0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y i l I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 6 3
...........continued s s e r d d A l a u t r i V
) 0 0 0 1 _ 0 0 4 4
rotatethispage90 005Ch e m a N r e t s i g e R SCOM1P3R 0060h SCOM2P0R 0064h SCOM2P1R 0068h SCOM2P2R 006Ch SCOM2P3R 0070h SCOM3P0R 0074h SCOM3P1R 0078h SCOM3P2R 007Ch SCOM3P3R 0080h QSCKR 0084h QD0R 0088h QD1R e g n a R t i B 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0000 SCOM1P3R[3:0]
0000 0000 SCOM2P0R[3:0]
0000 0000 SCOM2P1R[3:0]
0000 0000 SCOM2P2R[3:0]
0000 0000 SCOM2P3R[3:0]
0000 0000 SCOM3P0R[3:0]
0000 0000 SCOM3P1R[3:0]
0000 0000 SCOM3P2R[3:0]
0000 0000 SCOM3P3R[3:0]
0000 0000 QSCKR[3:0]
0000 0000 QD0R[3:0]
0000 0000 QD1R[3:0]
0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y l i I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 6 4
...........continued s s e r d d A l a u t r i V
) 0 0 0 1 _ 0 0 4 4
rotatethispage90 008Ch e m a N r e t s i g e R QD2R 0090h QD3R 0094h REFIR 0098h CCLIN0R 009Ch CCLIN1R 00A0h CCLIN2R 00A4h CCLIN3R 00A8h CCLIN4R 00ACh CCLIN5R 00B0h TC0WO0G1R 00B4h TC0WO0G2R 00B8h TC0WO1G3R e g n a R t i B 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0000 QD2R[3:0]
0000 0000 QD3R[3:0]
0000 0000 REFIR[3:0]
0000 0000 CCLIN0R[3:0]
0000 0000 CCLIN1R[3:0]
0000 0000 CCLIN2R[3:0]
0000 0000 CCLIN3R[3:0]
0000 0000 CCLIN4R[3:0]
0000 0000 CCLIN5R[3:0]
0000 0000 TC0WO0G1R[3:0]
0000 0000 TC0WO0G2R[3:0]
0000 0000 TC0WO1G3R[3:0]
0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y i l I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 6 5
...........continued s s e r d d A l a u t r i V
) 0 0 0 1 _ 0 0 4 4
rotatethispage90 00BCh e m a N r e t s i g e R TC0WO1G4R 00C0h TC1WO0G1R 00C4h TC1WO1G2R 00C8h TC2WO0G1R 00CCh TC2WO0G3R 00D0h TC2WO1G2R 00D4h TC2WO1G4R 00D8h TC3WO0G1R 00DCh TC3WO0G3R 00E0h TC3WO1G2R 00E4h TC3WO1G4R e g n a R t i B 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0000 TC0WO1G4R[3:0]
0000 0000 TC1WO0G1R[3:0]
0000 0000 TC1WO0G2R[3:0]
0000 0000 TC2WO0G1R[3:0]
0000 0000 TC2WO0G3R[3:0]
0000 0000 TC2WO1G2R[3:0]
0000 0000 TC2WO1G4R [3:0]
0000 TC3WO0G1R [3:0]
0000 TC3WO0G3R[3:0]
0000 TC3WO1G2R [3:0]
0000 TC3WO1G4R[3:0]
0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y i l I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 6 6 Table 6-16. Peripheral Pin Select Output Registers s s e r d d A l a u t r i V
) 1
) 0 0 0 1 _ 0 0 4 4
rotatethispage90 0200h e m a N r e t s i g e R RPA0G2R*
0204h RPA0G3R*
0208h RPA1G3R*
020Ch RPA1G4R*
0210h RPA2G1R*
0214h RPA2G4R*
0218h RPA3G1R 021Ch RPA3G2R 0220h RPA3G3R 0224h RPA4G2R 0228h RPA4G3R 022Ch RPA4G4R e g n a R t i B 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0000 RPA0G2R[4:0]
0000 0000 RPA0G3R[4:0]
0000 0000 RPA1G3R[4:0]
0000 0000 RPA1G4R[4:0]
0000 0000 RPA2G1R[4:0]
0000 0000 RPA2G4R [4:0]
0000 0000 RPA3G1R[4:0]
0000 0000 RPA3G2R[4:0]
0000 0000 RPA3G3R[4:0]
0000 0000 RPA4G2R[4:0]
0000 0000 RPA4G3R[4:0]
0000 0000 RPA4G4R[4:0]
0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y i l I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 6 7
...........continued s s e r d d A l a u t r i V
) 1
) 0 0 0 1 _ 0 0 4 4
rotatethispage90 0230h e m a N r e t s i g e R RPA5G1R 0234h RPA5G3R 0238h RPA5G4R 023Ch RPA6G1R 0240h RPA6G2R 0244h RPA6G4R 0248h RPA7G1R 024Ch RPA7G2R 0250h RPA8G2R 0254h RPA8G3R 0258h RPA8G4R 025Ch RPA9G1R e g n a R t i B 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0000 RPA5G1R[4:0]
0000 0000 RPA5G3R[4:0]
0000 0000 RPA5G4R[4:0]
0000 0000 RPA6G1R[4:0]
0000 0000 RPA6G2R[4:0]
0000 0000 RPA6G4R[4:0]
0000 0000 RPA7G1R[4:0]
0000 0000 RPA7G2R[4:0]
0000 0000 RPA8G2R[4:0]
0000 0000 RPA8G3R[4:0]
0000 0000 RPA8G4R[4:0]
0000 0000 RPA9G1R[4:0]
0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y i l I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 6 8
...........continued s s e r d d A l a u t r i V
) 1
) 0 0 0 1 _ 0 0 4 4
rotatethispage90 0260h e m a N r e t s i g e R RPA9G3R 0264h RPA9G4R 0268h RPA10G1R 026Ch RPA10G4R 0278h RPA13G3R*
027Ch RPA13G4R*
0280h RPA14G1R*
0284h RPA14G4R*
028Ch RPB0G1R*
0290h RPB0G2R*
0294h RPB1G2R*
0298h RPB1G3R*
e g n a R t i B 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0000 RPA9G3R[4:0]
0000 0000 RPA9G4R[4:0]
0000 0000 RPA10G1R[4:0]
0000 0000 RPA10G4R[4:0]
0000 0000 RPA13G3R[4:0]
0000 0000 RPA13G4R[4:0]
0000 0000 RPA14G1R[4:0]
0000 0000 RPA14G4R[4:0]
0000 0000 RPB0G1R[4:0]
0000 0000 RPB0G2R[4:0]
0000 0000 RPB1G2R[4:0]
0000 0000 RPB1G3R[4:0]
0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y i l I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 6 9
...........continued s s e r d d A l a u t r i V
) 1
) 0 0 0 1 _ 0 0 4 4
rotatethispage90 029Ch e m a N r e t s i g e R RPB2G3R*
02A0h RPB2G4R*
02A4h RPB3G1R*
02A8h RPB3G4R*
02ACh RPB4G1R 02B0h RPB4G2R 02B4h RPB5G2R 02B8h RPB5G3R 02BCh RPB6G3R 02C0h RPB6G4R 02C4h RPB7G1R 02C8h RPB7G4R e g n a R t i B 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0000 RPB2G3R[4:0]
0000 0000 RPB2G4R[4:0]
0000 0000 RPB3G1R[4:0]
0000 0000 RPB3G4R[4:0]
0000 0000 RPB4G1R[4:0]
0000 0000 RPB4G2R[4:0]
0000 0000 RPB5G2R[4:0]
0000 0000 RPB5G3R[4:0]
0000 0000 RPB6G3R[4:0]
0000 0000 RPB6G4R[4:0]
0000 0000 RPB7G1R[4:0]
0000 0000 RPB7G4R[4:0]
0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y i l I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 7 0
...........continued s s e r d d A l a u t r i V
) 1
) 0 0 0 1 _ 0 0 4 4
rotatethispage90 02CCh e m a N r e t s i g e R RPB8G1R 02D0h RPB8G2R 02D4h RPB9G2R 02D8h RPB9G3R 02DCh RPB10G3R*
02E0h RPB10G4R*
02E4h RPB11G1R*
02E8h RPB11G4R*
02ECh RPB12G1R*
02F0h RPB12G2R*
02F4h RPB13G2R*
02F8h RPB13G3R*
e g n a R t i B 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 31:16 15:0 Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0000 RPB8G1R[4:0]
0000 0000 RPB8G2R[4:0]
0000 0000 RPB9G2R[4:0]
0000 0000 RPB9G3R[4:0]
0000 0000 RPB10G3R[4:0]
0000 0000 RPB10G4R[4:0]
0000 0000 RPB11G1R[4:0]
0000 0000 RPB11G4R[4:0]
0000 0000 RPB12G1R[4:0]
0000 0000 RPB12G2R[4:0]
0000 0000 RPB13G2R[4:0]
0000 0000 RPB13G3R[4:0]
0000 I
O P o r t s a n d P e r i p h e r a l i P n S e l e c t
P P S
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) Related Links 6.1.9. CLR, SET and INV Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 71 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) 6.4.1 Change Notice Control for PORTx Register Name:
Offset:
Reset:
Property:
CNCONx See the following Note 0x0
Note:
1. For the Offset address, see the PortA Register Map and PortB Register Map tables in the I/O Ports Control Registers from Related Links. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset 15 ON R/W 0 Bit 7 Access Reset 14 FRZ R/W 0 6 13 SIDL R/W 0 5 12 10 11 EDGEDETECT R/W 0 4 3 2 9 1 8 0 Bit 15 ONChange Notice (CN) Control ON bit 1 = Change Notice is enabled 0 = Change Notice is disabled Bit 14 FRZFreeze in the Debug mode bit 1 = Freezes the module operation when the emulator is in the Debug mode 0 = Continues the module operation when the emulator is in the Debug mode Bit 13 SIDLStop in the Idle mode bit 1 = Discontinues the module operation when device enters the Idle mode 0 = Continues the module operation even in the Idle mode Bit 11 EDGEDETECTChange Notification Style bit 1 = Edge Style. Detects edge transitions (CNFx used for CN Event). 0 = Mismatch Style. Detects change from last PORTx read (CNSTATx used for CN Event). Related Links 6.4. I/O Ports Control Registers 6.5 Operation in Power Saving Modes 6.5.1 I/O Port Operation in Sleep Mode As the device enters the Sleep mode, the system clock is disabled; however, the CN module continues to operate. If one of the enabled CN pins changes state, the corresponding interrupt flag is set in NVIC and device wakes from the Sleep (or Idle) mode and executes the CN Interrupt Service Routine. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 72 PIC32CX-BZ2 and WBZ45 Family I/O Ports and Peripheral Pin Select (PPS) 6.5.2 I/O Port Operation in Idle Mode As the device enters the Idle mode, the system clock sources remain functional. The SIDL bit (CNCONx[13]) selects whether the module will stop or continues to function in the Idle mode. If SIDL = 1, the module continues to sample Input CN I/O pins in the Idle mode; however, synchronization is disabled. If SIDL = 0, the module continues to synchronize and samples input CN I/O pins in the Idle mode. 6.6 Results of Various Resets Table 6-17. Results of Resets Available Reset Name Device Reset Description All I/O registers are forced to their reset states upon a device Reset. Power-on Reset (PoR) All I/O registers are forced to their reset states upon a Power-on Reset (POR). Watchdog Reset All I/O registers are unchanged upon a Watchdog Reset. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 73 PIC32CX-BZ2 and WBZ45 Family Power Subsystem 7. Power Subsystem 7.1 Block Diagram Figure 7-1. Power Subsystem Block Diagram AVDD VDDIO VDDANA DOMAIN POR33 BOR33 FRC BOR12 LPRC 8 MHz ADC SOSC BANDGAP PMU_BX_LX PMU_SUBSYSTEM MLDO-OUT PMU_VDDIO PMU_VDDP DC-DC, MLDO PMU CONTROLLER - VDDIO PMU CONTROLLER - VDDCORE FLASH_VDD Memory SUBSYSTEM 1 MB FLASH NVM CTRL SRAM BLOCK SRAM CTRL ALWAYS ON LPRC32K XDS SYSTEM ULPLDO BACKUP DS-SYS-CTRL INT0/MCLR AN/GPIO RTCC WDT 2x4 kB BACKUP RAM RF SUBSYSTEM ANALOG RF 5 x RFLDO ZB/ BLE MODEM CPU SUBSYSTEM CLDO ZB/BLE MAC Cortex M4 CPU MPU FPU ETM CPU PERIPHERALS CRU CLDO BUCK_CLDO BUCK_LPA BUCK_MPA BUCK_BR BUCK_PLL The power domains of PIC32CX-BZ2 and WBZ45 are as follows:
VDD - 1.9V to 3.6V, Main Supply powering VDDIO, FLASH_VDD, AVDD, PMU_VDDIO, PMU_VDDP VDDIO 1.9V to 3.6, powering the AON, PMU-CTRL, AN/GPIO, INT0/MCLR, BKUP FLASH_VDD 1.9V to 3.6V, Filtered version of VDD (powering the Flash) AVDD 1.9V to 3.6V, Filtered version of VDD for system analog functionality PMU_VDDIO 1.9V to 3.6V, Filtered version of VDD (powering the PMU sub-system) PMU_VDDP 1.9V to 3.6V, Filtered version of VDD (powering the PMU sub-system) GND 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 74 PIC32CX-BZ2 and WBZ45 Family Power Subsystem Common GND for digital, analog and RF sub-systems Other power supply pins are as follows:
CLDO Output pin for the internal voltage regulator for decoupling, this pin must not be used as an external power supply source CLDO output is 1.2V CLDO powers the VDDCORE VDDCORE serves as the internal voltage regulator output. It powers the core, memories, peripherals PMU_BK_LX Switching node for the Buck converter PMU_MLDO_OUT 1.35V output pin from the internal LDO. This is the shared output pin for both MLDO and the DC-DC converter PMU_MLDO_OUT powers the LDOs in the Wireless subsystem (BUCK_LPA, BUCK_MPA, BUCK_PLL, BUCK_BB and BUCK_CLDO) For decoupling recommendations for the different power supplies, refer to the schematic checklist. 7.2 Voltage Regulators The following voltage regulators are available in the power subsystem:
MLDO Linear voltage regulator generating 1.35V for powering CLDO and other RF LDOs operates from 1.9V to 3.6V DC-DC Switching voltage regulator generating 1.35V operates from 2.4V to 3.6V ULP_VREG Ultra low power voltage regulator for operation in back-up mode RF LDOs Powering the different blocks of the RF subsystem CLDO Powering the VDDCORE of PIC32CX-BZ2 7.3 Power Supply Modes The PIC32CX-BZ2 supports a single power supply from 1.9V to 3.6V. The IO supply cannot be decoupled from the main supply. The same voltage must be applied to VDDx, PMU_VDDIO, VPMU_VDDC and AVDD with different levels of filtering. The internal voltage regulator has the following four different modes:
Linear mode This mode does not require any external inductor. This is the default mode when the CPU and peripherals are running. In this mode, the SoC is powered through the MLDO. Switching mode (Buck) This is the most efficient mode when the CPU and peripherals are running. In this mode, the SoC is powered by the DC-DC converter. Low Power (PSK) mode This is the mode used when the device is in Standby mode. Shutdown mode When the device is in Backup mode, the internal regulator is turned off. Selecting between the Switching mode and Linear mode can be done by software on-the-fly, but the power supply must be designed according to which mode is to be used. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 75 PIC32CX-BZ2 and WBZ45 Family Power Subsystem 7.4 Typical Power Supply Connection for SoC Figure 7-2. Typical Power Supply Connection for SoC VDD (1.9V to 3.6V) VDDIO AVDD FB 10 F 0.1 F 10 F 0.1 F PMU_VDDIO/PMU_VDDC CLDO_OUT 1 F 0.1 F 4.7 F 4.7 F PMU_VDDP FLASH_VDD 10 F 0.1 F 4.7 H PMU_BK_LX 10 F 0.1 F PMU_MLDO_OUT BUCK_CLDO BUCK_LPA BUCK_MPA BUCK_BB BUCK_PLL 1 F 1 F 1 F 1 F 1 F 7.5 Typical Power Supply Connection for Module The module requires only a single power supply on the VDD pins of the module. VDD can be from 1.9V to 3.6V 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 76 PIC32CX-BZ2 and WBZ45 Family Power Subsystem Figure 7-3. Module Schematics with VDD and Optional Bulk Capacitors Main Supply (1.9V to 3.6V) 10 F 0.1 F VDD VDD VDDA 10 F GND PADDLE GND 7.6 Power-Up Sequence The characteristics of power-up sequence are as follows:
The VDD/AVDD domains must rise at the same time On power-up, PIC32CX-BZ2 always start up on the MLDO mode After power-up in MLDO, the software can initiate the switch to Buck mode 7.6.1 Starting of Voltage Regulators The characteristics of power-up voltage regulators are as follows:
On power-up, the internal regulator starts in MLDO mode After MLDO boots up, the CLDO gets initialized Now the code execution can start The RF system is maintained in sleep-mode during the power-up time 7.6.2 Starting-up of Crystals The characteristics of power-up crystals are as follows:
The power-up of the SOC happens with the internal oscillators. After the power-up, the user software can request to switch on the SOSC and the XOSC crystals. 7.6.3 BOR and POR The Brown-out Reset (BOR) monitors the VDD supply voltage. On detection of a brown-out condition, the BOR re-arms the POR. In this device, the min BOR trip point is the voltage below which the IO is deemed to be un-trusted;
thus, it generates a reset. There are three BOR in PIC32CX-BZ2 and WBZ45:
BOR3.3 to monitor VDD BOR1.2 to monitor VDDCORE ZPBOR monitors VDD during the deep sleep and extreme deep sleep mode if enabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 77 PIC32CX-BZ2 and WBZ45 Family Product Memory Mapping Overview 8. Figure 8-1. Product Mapping Product Memory Mapping Overview System Peripheral Bridge-A Peripheral Bridge-B Peripheral Bridge-C Peripheral Bus-PIC 0x41000000 0x41002000 0x41004000 0x41006000 0x41008000 0x4100A000 0x41010000 0x41050000 0x41020000 0x41FFFFFF DSU CMCC DMAC EVSY RECC Reserved WBT Reserved (ZBT) Reserved 0x40000000 0x40000400 0x40000800 0x40000C00 0x40001000 0x40001400 0x40001800 0x40001C00 0x40002000 0x40002400 0x40002800 0x40002C00 0x40003000 0x40FFFFFF PAC FREM EIC SERCOM-0 SERCOM-1 TC-0 TC-1 TC-2 TC-3 TCC-0 TCC-1 TCC-2 Reserved 0x42000000 0x42000400 0x42000800 0x42000C00 0x42001000 0x42001400 0x42001800 0x42001C00 0x42002000 0x42002400 0x42002800 0x42002C00 0x42003000 0x42003400 0x42010000 0x42011000 0x42012000 0x42FFFFFF QSPI AES Reserved SERCOM-2 SERCOM-3 Reserved CCL AC Reserved HMTX TRNG ICM PUKC Reserved RTCC DSCN Reserved 0x44000000 0x44000500 0x44000600 0x44000800 0x44000A00 0x44000C00 0x44000E00 0x44001000 0x44001400 0x44001A00 0x44001E00 0x44002200 0x44002300 0x44002400 0x44010000 0x44012000 0x44012400 0x44012800 0x44013E00 0x44014000 0x44016000 0x4401FFFF Device Config Registers WDT FC PFW CRU BOR_CMP DMT PPS ADCCON ADCCFG ADCOUT PORT A PORT B Reserved Reserved ICD PCHE Reserved PMU Backup RAM Reserved 0x00000000 0x00005000 0x00006000 0x00007000 0x00040000 0x00045000 0x00047000 0x00048000 0x01000000 0x01100000 0x02000000 0x02012000 0x03000000 0x03001000 0x04000000 0x05000000 0x20000000 0x20020000 0x40000000 0x41000000 0x42000000 0x43000000 0x44000000 0x44020000 0xE0000000 0xFFFF3FFF Boot Flash (Alias) Device Config/Boot
(Alias) OTP Page (Alias) Unimplemented Unimplemented Unimplemented Unimplemented Unimplemented Flash Unimplemented PUKCC Unimplemented CM4CCTCM Unimplemented QSPI Unimplemented System RAM Unimplemented PB-A PB-B PB-C Unimplemented PB-(PIC) Unimplemented CM4F System Registers Notes:
1. 2. 3. Access attempts to any unimplemented memory location generates a bus error. The PUKCC space is fixed as non-cacheable and bufferable. The QSPI space cacheable and bufferable attribute is controlled using CFGCON1.QSCHE_EN. d r a d n a t S n o l s a r e h p i r e P s u B l a r e h p i r e P t s a F n o s u B l a r e h p i r e P l s a r e h p i r e P 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 78 PIC32CX-BZ2 and WBZ45 Family Product Memory Mapping Overview Table 8-1. Device Configuration Map Register Name Reset value from NVR memory?
Writable in User Mode?
Corresponding Write Lock Bit(s) Purpose System Configuration CFGCON0(L) 0x4400_0000 CFGCON1(L) 0x4400_0010 CFGCON2(L) 0x4400_0020 CFGCON3 0x4400_0030 CFGCON4(L) 0x4400_0040 CFGPGQOS 0x4400_0050 CFGPCLKGEN1 0x4400_0060 CFGPCLKGEN2 0x4400_0070 CFGPCLKGEN3 0x4400_0080 ID2 0x4400_0090 USER_ID(L) 0x4400_00A0 SYSKEY PMD1 PMD2 PMD3 0x4400_00B0 0x4400_00C0 0x4400_00D0 0x4400_00E0 X X X X X X Boot Configuration BCFG0 0x4400_0200 X Notes:
X X X X X X X X X X X X X X CFGLOCK[1:0]
CFGLOCK[1:0]
CFGLOCK[1:0]
CFGLOCK[1:0]
CFGLOCK[1:0]
CFGCON0.PGLOCK CFGLOCK[1:0]
CFGLOCK[1:0]
CFGLOCK[1:0]
N/A- Read Only CFGLOCK[1:0]
Sequence Misc. System Configuration Misc. System Configuration Misc. System Configuration Misc. System Configuration Misc. System Configuration Bus Matrix Permission Groups Peripheral Clock Gen Reg-1 Peripheral Clock Gen Reg-2 Peripheral Clock Gen Reg-3 32-bit Device ID 16-bit User ID System Lock feature CFGCON0.PMDLOCK Peripheral Module Disable CFGCON0.PMDLOCK Peripheral Module Disable CFGCON0.PMDLOCK Peripheral Module Disable None Pre-boot user configuration 1. Registers marked with (L) are loadable from Flash, and they can be controlled by software after the boot with 2. the correct unlock sequence. ID Register is a JTAB ID register, maintained for legacy reasons. The actual external-facing ID register is DSU.DID register. See DID register in the Device Service Unit (DSU) from Related Links. Table 8-2. CM4 System Components Register Offset Map Peripheral ABRV. Description TA Clock Size (Bytes) Virtual Address Physical Address Start End Start End CM4 System Components accessible via CM4 PPB Bus
(Only DAP and CM4 can access the registers) Base Address 0xE000_0000 Base Address 0xE000_0000 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 79 PIC32CX-BZ2 and WBZ45 Family Product Memory Mapping Overview
...........continued Peripheral ABRV. Description TA Clock Size (Bytes) Virtual Address Physical Address Start End Start End ITM DWT FPB Inst. TM Data WT Flash PB SYS_CLK SYS_CLK SYS_CLK 4 KB 4 KB 4 KB 0000_0000 0000_0FFF 0000_0000 0000_0FFF 0000_1000 0000_1FFF 0000_1000 0000_1FFF 0000_2000 0000_2FFF 0000_2000 0000_2FFF RSVD Reserved 4 KB*n 0000_3000 0000_DFFF 0000_3000 0000_DFFF SCS Sys. CS SYS_CLK 4 KB 0000_E000 0000_EFFF 0000_E000 0000_EFFF RSVD Reserved 4 KB*n 0000_F000 0003_FFFF 0000_F000 0003_FFFF TPIU ETM ETB Trace PIU ETM ETB SYS_CLK SYS_CLK SYS_CLK 4 KB 4 KB 4 KB 0004_0000 0004_0FFF 0004_0000 0004_0FFF 0004_1000 0004_1FFF 0004_1000 0004_1FFF 0004_2000 0004_2FFF 0004_2000 0004_2FFF RSVD Reserved 4 KB*n 0004_3000 000F_EFFF 0004_3000 000F_EFFF CROM CSight ROM SYS_CLK 4 KB 000F_F000 000F_FFFF 000F_F000 000F_FFFF RSVD Reserved 4 KB*n 0010_0000 FFFF_FFFF 0010_0000 FFFF_FFFF Notes:
All system and debug components carry a unique ID accessible via its own register space. The DAP derives the base address of the components from CROM entry values. 1. 2. 3. Component Base address = CROM Base address + CROM Entry value. 4. Core sight ROM entries are not provided in this document. 5. Refer to CM4F documentation for details on each component register space (developer.arm.com/
documentation/ddi0439/b/System-Control/Register-summary). Related Links 12.13.8. DID 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 80 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) 9. Prefetch Cache (PCHE) 9.1 Introduction The Prefetch Cache is a performance-enhancing module included in the PIC32CX-BZ2 devices, along with the L1 cache (Cortex M Cache Controller CMCC) to the Cortex M4F CPU. 9.2 Features The Prefetch module increases the system performance for most of the applications. The Prefetch module includes the following features:
Fully associative lines for:
Four lines for CPU instructions cache Two lines for CPU data cache Two lines for peripheral data cache 16-byte cache lines and 128-bits parallel memory fetch Configurable predictive prefetch for CPU instructions cache Error detection and correction (ECC) 9.3 Overview When running the Prefetch module at high-clock rates, insert the Wait states into Program Flash Memory (PFM) read transactions to meet the access time of the PFM. The user can hide the Wait states to the core by prefetching and storing the instructions in a temporary holding area that the CPU can access quickly. Although, the data path to the CPU is 32 bits wide, the data path to the PFM is 128 bits wide. This wide data path provides the same bandwidth to the CPU as a 32-bit path running at four times the frequency. The Prefetch module holds a subset of PFM in temporary holding spaces known as lines. Each line contains a tag and data field. Normally, the lines hold a copy of what is currently in memory to make instructions or data available to the CPU without the Wait states. The CPU or a peripheral may request the data located in the PFM. If the requested data is not currently stored in the Prefetch module line, a read is performed to the PFM at the correct address, and the data is supplied to the Prefetch module and to the CPU or peripheral. If the requested data is stored in the Prefetch module and is valid, the data is supplied to the CPU or peripheral without Wait states. The following figure shows a block diagram of the Prefetch module. Logically, the Prefetch module fits between the System Bus module and the PFM. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 81 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) Figure 9-1. Prefetch Cache Block Diagram U P C
s u B m e t s y S Bus Control Prefetch Buffer Line Control Tag Data U P C
s u B m e t s y S Program Flash Memory (PFM) 9.3.1 Line Organization The Prefetch module consists of two arrays, data and tag, each of which hold four lines. A data array consists of program instructions, program data or peripheral data. Address matches are based on the physical address, not the virtual address. Each line in the tag array contains the following information:
Tag Physical address of the data held in the data line Valid bit Each line in the data array, contains 16 bytes of data. Depending on the line, the data can be CPU instructions, CPU data or peripheral data. The following figures illustrate the organization of a line. Figure 9-2. Tag Line LTAG[28:4]
LValid 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 82 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) Figure 9-3. Data Line 31 31 31 31 WORD 3 WORD 2 WORD 1 WORD 0 0 0 0 0 9.4 Prefetch Behavior The Prefetch module complements an L1 CPU (CMCC) cache rather than replacing it. A four 128-bit (16-byte) lines hold instructions, two 128-bit (16-byte) lines hold CPU data and two 128-bit (16-byte) lines hold peripheral data from the PFM. The Prefetch module uses the Wait state's value from the PFMWS[3:0] bits (CHECON[3:0]) and Address Wait state ADRWS bit (CHECON[8]) to determine how long it must wait for Flash access when it reads instructions or data from the PFM. If the instructions or data already reside in the Prefetch module line, the Prefetch module returns the instruction or data in zero Wait states. For CPU instructions, if predictive prefetch is enabled and the code is 100% linear, the Prefetch module will provide instructions back to the CPU with the Wait states only on the first instruction of the Prefetch module line. If the CPU accesses uncacheable addresses, it bypasses the cache. During the bypass, the prefetch module accesses the PFM for every instruction, incurring an address setup time defined by ADRWS and a Flash access time as defined by PFMWS bits. Therefore, the total Flash wait states is a sum of ADRWS and PFMWS. The Bypass mode is also forced for a cache if its associated I/D/A CHEEN bit (CHECON) is zero. To allow caching for I and/or D caches, set the I and/or D *CHEEN bit to one. To enable a cache, set the ACHEEN bit to one. 9.5 Configurations The CHECON register controls the general configurations available for accelerating the instruction and data accesses to the Flash memory system. The Prefetch module implements the following general options:
The PFMWS[3:0] bits (CHECON[3:0]) control the number of system clock cycles required to access the PFM. The total Flash Wait states is a sum of ADRWS and PFMWS. The PREFEN[1:0] bits (CHECON[5:4]) control the predictive and prefetched instruction, which allows the cache controller to fetch the next 16-byte aligned set of instructions. The PFMSECEN bit (CHECON[7]) controls the Prefetch module that generates an interrupt event on a specific count of single bit errors corrected by the Flash Error Correction Code (ECC). The ADRWS bit (CHECON[8]) controls the number of system clock cycles required for address setup to PFM. The CHEPERF bit (CHECON[12]) controls the gathering statistics of the CPU instruction cache. The ICHECOH bit (CHECON[16]) controls the auto invalidate for the CPU instruction cache. The DCHECOH bit (CHECON[17]) controls the auto invalidate for the CPU data cache. The ACHECOH bit (CHECON[18]) controls the auto invalidate for the peripheral data cache. The ICHEINV bit (CHECON[20]) controls the manual invalidate for the CPU instruction cache. The DCHEINV bit (CHECON[21]) controls the manual invalidate for the CPU data cache. The ACHEINV bit (CHECON[22]) controls the manual invalidate for the peripheral data cache. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 83 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) The ICHEEN bit (CHECON[24]) controls the CPU instruction cache enable. The DCHEEN bit (CHECON[25]) controls the CPU data cache enable. The ACHEEN bit (CHECON[26]) controls the peripheral data cache enable. 9.6 Predictive Prefetch Behavior When the user configures the module for predictive prefetch, the module predicts the next line address, fetches the instruction and, then, stores it in the prefetch buffer. If the requested instruction is not in a Prefetch module line and the read address matches the predicted address, the content of the prefetch buffer is loaded in the Prefetch module line while simultaneously returning the critical word to the read initiator. On enabling the predictive prefetch, the prefetch function starts predicting based on the first address read to the PFM. When the user places the first line in the Prefetch module, the module increments the address to the next 16-byte aligned address and starts a PFM access. The predictive prefetches, like all PFM read accesses, are never aborted. If a new address request does not match the predicted address, a new PFM access occurs after the current access finishes. The PREFEN [1:0] bits
(CHECON[5:4]) can start a predictive prefetch. This allows the cache controller to speculatively fetch the next 16-byte aligned set of instructions. The predictive prefetch feature is available only for CPU instruction but not for CPU data and peripheral. If the selected system clock speed is sufficiently low enough to access the Flash at zero Wait states, the predictive prefetch is detrimental and may be disabled. 9.7 Coherency Support When a PFM programming event occurs flash programming initiated by the Flash controller, the Prefetch module invalidates all lines and the contents of the prefetch buffer. If a transaction is in progress, the invalidation occurs after completion. When programming or erasing a Flash page, a read of that Flash page will cause the transaction to stall until the erase or program event completes. The Prefetch module provides two methods for coherency control:
Auto Invalidate via I/D/A CHECOH Manual Invalidate via I/D/A CHEINV The user can choose to auto invalidate the each/any cache on a PFM programming event by setting *CHECOH =
1. This is the safest option. However, the user has the option to never auto invalidate each/any cache by setting
*CHECOH = 0. In addition to using *CHECOH, *CHEINV can be used as an alternate invalidate method to invalidate each/any cache manually. If using *CHEINV to manually invalidate each/any cache due to a PFM programming event, stop all instruction/data fetches from the desired Flash, set *CHEINV, wait for it to clear and, then, start the programming sequence. When using *CHEINV to invalidate each/any cache for reasons other than programming, it can be set at any time but only takes effect after any pending transactions complete. 9.8 Effects of Reset 9.8.1 On Reset Upon a device Reset, the following occurs:
All lines are invalidated All tag bits are cleared 9.8.2 After Reset The module operates as per the values in the CHECON register. See the CHECON register from Related Links. Related Links 9.12.1. CHECON 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 84 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) 9.9 Error Conditions The Prefetch module handles and reports information about two error types: ECC Double-bit Error Detected (DED) and ECC Single-bit Error Corrected (SEC). The ECC Error detection logic is enabled and disabled using the configuration bits, ECCCTL[1:0] (CFGCON0/DEVCFG0[29:28]). The ECC logic increases the read access delay from the PFM. Depending on the frequency of the system clock, the Wait states may be different between ECC-enabled and ECC-disabled. Note:ECC errors are captured for predictive prefetch reads of the PFM. However, those errors are not reported until, and unless, that data is used by the system. 9.9.1 ECC Double-bit Error Detected (DED) A read from the Flash memory that results in a PFM ECC DED causes the Prefetch module to return a bus exception error to the initiator. If that initiator is the CPU, it recognizes the bus exception error, prevents the instruction from executing, or read data from loading, and generates an exception using the bus exception error vector. When an ECC DED error occurs, the PFMDED bit (CHESTAT[27]) is set. The exception handling code can, then, check this bit to determine whether the exception was caused by a PFM ECC DED event. This bit must be cleared in software by the exception handler. Note:CPU instructions or data prefetched from the PFM will always be loaded into the Prefetch module, even if a DED error is generated. The Prefetch module line containing the DED data will be tagged as valid until the line is replaced. 9.9.2 ECC Single Error Corrected (SEC) A PFM ECC SEC event is not a critical error and, as such, is reported through an interrupt. The user has the option to enable or disable this interrupt through the PFMSECEN bit (CHECON[7]). The data in the Prefetch module is correct, and no further ECC events are generated for addresses that hit the data line as long as that data is in the Prefetch module. Each read that returns from the PFM with an ECC SEC status causes the PFMSECCNT[7:0] bits (CHESTAT[7:0]) to decrement by one. If PFMSECCNT[7:0] is zero and a PFM ECC SEC event occurs, the PFMSEC bit (CHESTAT[26]) is set and an interrupt is generated. Therefore, the PFMSECCNT[7:0] bits must be set to the number of PFM ECC SEC events desired for an interrupt minus 1. For example, to generate an interrupt after five PFM ECC SEC events, PFMSECCNT[7:0] must be set to four (00000100). The Prefetch module does not reload the PFMSECCNT[7:0] bits when it reaches zero. Software must write the desired count each time it services the PFMSEC interrupt. Software can generate an ECC SEC interrupt by setting the PFMSECEN bit, then setting the PFMSEC bit. If the PFMSEC bit is already set when PFMSECEN is set, the Prefetch module will also generate an ECC SEC interrupt. The ECC SEC interrupt persists as long as the PFMSECEN and PFMSEC bits remain set. See PCACHE Interrupt in the Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 9.10 Operation in Power-saving Modes 9.10.1 Sleep Mode When the device enters the Sleep mode, the Prefetch module is disabled and placed into a low-power state where no clocking occurs in the module. 9.10.2 Idle Mode When the device enters the Idle mode, iCache, Prefetch and dCache clocks are internally gated-off, the aCache
(peripheral data) clock remains functional for peripheral accesses and the CPU stops executing code. Any outstanding prefetch completes before the Prefetch module stops its clock through automatic clock gating. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 85 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) 9.10.3 Debug Mode The behavior of the Prefetch module is unaltered in the Debug mode. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 86 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) 9.11 Register Summary (PCHE) Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CHECON 0x04
... 0x0F Reserved 0x10 CHESTAT 0x14
... 0x1F Reserved 0x20 CHEHIT 0x24
... 0x2F Reserved 0x30 CHEMIS 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 PFMSECEN PREFEN[1:0]
PFMWS[3:0]
ACHEINV DCHEINV ICHEINV ACHECOH DCHECOH ICHECOH CHEPERF ADRWS ACHEEN DCHEEN ICHEEN PFMSECCNT[7:0]
PFMDED PFMSEC CHEHIT[7:0]
CHEHIT[15:8]
CHEHIT[23:16]
CHEHIT[31:24]
CHEMIS[7:0]
CHEMIS[15:8]
CHEMIS[23:16]
CHEMIS[31:24]
9.12 Register Description The CHECON and CHESTAT registers in the Register Summary table have corresponding CLR, SET and INV registers at its virtual address, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET and INV Registers from Related Links. The following are the description of the legends:
R = Readable bit W = Writable bit S = Settable bit C = Clearable bit HC = Hardware Cleared HS = Hardware Set Related Links 6.1.9. CLR, SET and INV Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 87 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) 9.12.1 CHECON - Prefetch Module Control Register Name:
Offset:
Reset:
Property:
CHECON 0x00 0x0700010F
Bit 31 30 29 28 27 Access Reset Bit 23 Access Reset 22 ACHEINV R/S/HC 0 21 DCHEINV R/S/HC 0 Bit 15 14 13 Access Reset 20 ICHEINV R/S/HC 0 12 CHEPERF R/W 0 Bit 7 6 5 4 PFMSECEN Access Reset R/W 0 PREFEN[1:0]
R/W 0 R/W 0 3 R/W 1 Bit 26 ACHEENPeripheral Data Cache Enable bit Value 1 0 Description Caching is enabled Caching is disabled (and all lines invalidated) Bit 25 DCHEENData Cache Enable bit Value 1 0 Description Caching is enabled Caching is disabled (and all lines invalidated) Bit 24 ICHEENInstruction Data Cache Enable bit Value 1 0 Description Caching is enabled Caching is disabled (and all lines invalidated) 26 ACHEEN R/W 1 25 DCHEEN R/W 1 24 ICHEEN R/W 1 19 18 ACHECOH R/W 0 17 DCHECOH R/W 0 11 10 9 1 2 PFMWS[3:0]
R/W 1 R/W 1 16 ICHECOH R/W 0 8 ADRWS R/W 1 0 R/W 1 Bit 22 ACHEINVManual Invalidate Control for Peripheral Data Cache Note:The hardware auto clears this bit when cache invalidate completes. Bits may clear at different times. Value 1 0 Description Force invalidate cache/invalidate busy Cache invalidation follows ACHECOH/invalid complete Bit 21 DCHEINVManual Invalidate Control for Data Cache Note:The hardware auto clears this bit when cache invalidate completes. Bits may clear at different times. Value 1 0 Description Force invalidate cache/invalidate busy Cache invalidation follows DCHECOH/invalid complete 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 88 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) Bit 20 ICHEINVManual Invalidate Control for Instruction Cache Notes:
1. 2. The Predictive Prefetch Buffer (PFB) is included with iCache invalidate. The hardware auto clears this bit when cache invalidate completes. Bits may clear at different times. Value 1 0 Description Force invalidate cache/invalidate busy Cache invalidation follows ICHECOH/invalid complete Bit 18 ACHECOHAuto Cache Coherency Control for Peripheral Data Cache Note:ACHECOH must be stable before initiation of programming to ensure correct invalidation of data. Value 1 0 Description Auto invalidate cache on a programming event No auto invalidated cache on a programming event Bit 17 DCHECOHAuto Cache Coherency Control for Data Cache Note:DCHECOH must be stable before initiation of programming to ensure correct invalidation of data. Value 1 0 Description Auto invalidate cache on a programming event No auto invalidated cache on a programming event Bit 16 ICHECOHAuto Cache Coherency Control for Instruction Cache Note:ICHECOH must be stable before initiation of programming to ensure correct invalidation of data. Value 1 0 Description Auto invalidate cache on a programming event No auto invalidated cache on a programming event Bit 12 CHEPERFCache Performance Counters Enable Note:Performance counters are reset on 0 to 1 transition of this bit. Value 1 0 Description Performance counters is enabled Performance counters is disabled Bit 8 ADRWSAddress Wait State Enable Total Flash Wait states are ADRWS + PFMWS. Value 1 0 Description Add 1 address Wait state - allowing for higher clock frequencies Add 0 address Wait states - allowing for higher performance at lower clock frequencies Bit 7 PFMSECENFlash Single-bit Error Corrected (SEC) Interrupt Enable bit Value 1 0 Description Generate an interrupt when PFMSEC is set Do not generate an interrupt when PFMSEC is set Bits 5:4 PREFEN[1:0]Instruction Predictive Prefetch Enable Value 01 00 Description Instruction predictive prefetch enabled for cacheable regions only Instruction predictive prefetch disabled Note:Other values are unavailable. Bits 3:0 PFMWS[3:0]PFM Access Time Defined in Terms of SYSCLK Wait States bits Total Flash Wait states are ADRWS + PFMWS. Value 1111 Description Fifteen Wait states 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 89 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) Description Fourteen Wait states One Wait state Zero Wait state Value 1110
... 0001 0000 Notes:
1. 2. This is not the Wait state seen by the CPU. For the Wait states to SYSCLK relationship, see Electrical Characteristics from Related Links. Related Links 43. Electrical Characteristics 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 90 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) 9.12.2 CHESTAT - Prefetch Module Status Register Name:
Offset:
Reset:
Property:
CHESTAT 0x10 0x00000000
Bit 31 30 29 28 Access Reset 27 PFMDED HS, R/C 0 26 PFMSEC HS, R/W 0 25 24 Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 3 4 PFMSECCNT[7:0]
2 9 1 8 0 Access HS, HC, R/W HS, HC, R/W HS, HC, R/W HS, HC, R/W HS, HC, R/W HS, HC, R/W HS, HC, R/W HS, HC, R/W Reset 0 0 0 0 0 0 0 0 Bit 27 PFMDEDFlash Double-bit Error Detected (DED) Status bit This bit is set in hardware and can only be cleared (i.e., set to 0) in software. Value 1 0 Description A DED error has occurred A DED error has not occurred Bit 26 PFMSECFlash Single-bit Error Corrected (SEC) Status bit Note:The error event is reported to the CPU via using the PCACHE interrupt event (See Nested Vector Interrupt Controller (NVIC) from Related Links). Value 1 0 Description A SEC error occurred when PFMSECCNT[7:0] was equal to zero A SEC error has not occurred Bits 7:0 PFMSECCNT[7:0]Flash SEC Count bits Decrements by 1 its count value each time an SEC error occurs. Holds at zero. When an SEC error occurs when PFMSECCNT[7:0] is zero, the PFMSEC status bit is set. If PFMSECEN is also set, a Prefetch module interrupt event is generated. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 91 9.12.3 CHEHIT Prefetch Module Hit Statistics Register PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) Name:
Offset:
Reset:
Property:
CHEHIT 0x20 0x00000000
Bit 31 Access Reset R/HC 0 Bit 23 Access Reset R/HC 0 Bit 15 Access Reset R/HC 0 Bit 7 Access Reset R/HC 0 30 R/HC 0 22 R/HC 0 14 R/HC 0 6 R/HC 0 29 R/HC 0 21 R/HC 0 13 R/HC 0 5 R/HC 0 28 27 CHEHIT[31:24]
R/HC 0 20 R/HC 0 19 CHEHIT[23:16]
R/HC 0 12 R/HC 0 11 CHEHIT[15:8]
R/HC 0 4 R/HC 0 3 CHEHIT[7:0]
R/HC 0 R/HC 0 26 R/HC 0 18 R/HC 0 10 R/HC 0 2 R/HC 0 25 R/HC 0 17 R/HC 0 9 R/HC 0 1 R/HC 0 24 R/HC 0 16 R/HC 0 8 R/HC 0 0 R/HC 0 Bits 31:0 CHEHIT[31:0]Instruction Cache Hit Count bits When CHECON.CHEPERF = 1, CHEHIT increments once per iCache or Predictive Prefetch Buffer (PFB) hit. Note:CHEHIT is Reset on 0 to 1 transition of CHECON.CHEPERF. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 92 PIC32CX-BZ2 and WBZ45 Family Prefetch Cache (PCHE) 9.12.4 CHEMIS Prefetch Module Miss Statistics Register Name:
Offset:
Reset:
Property:
CHEMIS 0x30 0x00000000
Bit 31 Access Reset R/HC 0 Bit 23 Access Reset R/HC 0 Bit 15 Access Reset R/HC 0 Bit 7 Access Reset R/HC 0 30 R/HC 0 22 R/HC 0 14 R/HC 0 6 R/HC 0 29 R/HC 0 21 R/HC 0 13 R/HC 0 5 R/HC 0 28 27 CHEMIS[31:24]
R/HC 0 20 R/HC 0 19 CHEMIS[23:16]
R/HC 0 12 R/HC 0 11 CHEMIS[15:8]
R/HC 0 4 R/HC 0 3 CHEMIS[7:0]
R/HC 0 R/HC 0 26 R/HC 0 18 R/HC 0 10 R/HC 0 2 R/HC 0 25 R/HC 0 17 R/HC 0 9 R/HC 0 1 R/HC 0 24 R/HC 0 16 R/HC 0 8 R/HC 0 0 R/HC 0 Bits 31:0 CHEMIS[31:0]Instruction Cache Miss Count bits When CHECON.CHEPERF = 1, CHEMIS increments once per iCache or Predictive Prefetch Buffer (PFB) miss. Note:CHEMIS is Reset on 0 to 1 transition of CHECON.CHEPERF. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 93 PIC32CX-BZ2 and WBZ45 Family Processor and Architecture 10. Processor and Architecture 10.1 Cortex M4 Processor The ARMCortex-M4 processor is a high performance 32-bit processor designed for the microcontroller market. It offers the following significant benefits to developers:
Outstanding processing performance combined with fast interrupt handling Enhanced system debug with extensive breakpoint and trace capabilities Efficient processor core, system, and memories Ultra low-power consumption with integrated sleep modes Platform security robustness, with integrated memory protection unit (MPU). The implemented ARM Cortex-M4 is revision r0p1 For additional information, refer to http://www.arm.com The Cortex-M4 processor is built on a high-performance processor core with a 3-stage pipeline Harvard architecture, making it ideal for demanding embedded applications. The processor delivers exceptional power efficiency through an efficient instruction set and extensively optimized design, providing high-end processing hardware including IEEE 754-compliant single-precision floating-point computation, a range of single-cycle and SIMD multiplication and multiply-with-accumulate capabilities, saturating arithmetic, and dedicated hardware division. To facilitate the design of cost-sensitive devices, the Cortex-M4 processor implements tightly-coupled system components that reduce processor area while significantly improving interrupt handling and system debug capabilities. The Cortex-M4 processor implements a version of the Thumb instruction set based on Thumb-2 technology, ensuring high code density and reduced program memory requirements. The Cortex-M4 instruction set provides the exceptional performance expected of a modern 32-bit architecture, with the high code density of 8-bit and 16-bit microcontrollers. The Cortex-M4 processor closely integrates a configurable Nested Vector Interrupt Controller (NVIC), to deliver industry-leading interrupt performance. The NVIC includes a Non-Maskable interrupt (NMI), and provides up to 8 interrupt priority levels. The tight integration of the processor core and NVIC provides fast execution of Interrupt Service Routines (ISRs), dramatically reducing interrupt latency. This is achieved through the hardware stacking of registers, and the ability to suspend load-multiple and store-multiple operations. Interrupt handlers do not require wrapping in assembler code, removing any code overhead from the ISRs. A tail-chain optimization also significantly reduces the overhead when switching from one ISR to another. To optimize low-power designs, the NVIC integrates with the sleep modes, that include a deep sleep function that enables the entire device to be rapidly powered down while still retaining program state. 10.1.1 System Level Interface The Cortex-M4 processor provides multiple interfaces using AMBA technology to provide high-speed, low-latency memory accesses. It supports unaligned data accesses and implements atomic bit manipulation that enables faster peripheral controls, system spinlocks, and thread-safe Boolean data handling. The Cortex-M4 processor has a Memory Protection Unit (MPU) that provides fine grain memory control, enabling applications to utilize multiple privilege levels, separating and protecting code, data, and stack on a task-by-task basis. Such requirements are becoming critical in many embedded applications such as automotive. 10.1.2 Integrated Configurable Debug The Cortex-M4 processor implements a complete hardware debug solution. This provides high system visibility of the processor and memory through a 2-pin Serial Wire Debug (SWD) port that is ideal for microcontrollers and other small package devices. For system trace the processor integrates an Instrumentation Trace Macrocell (ITM) alongside data watchpoints and a profiling unit. The Embedded Trace Macrocell (ETM) delivers unrivaled instruction trace capture in an area far smaller than traditional trace units, enabling many low cost MCUs to implement full instruction trace for the first time. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 94 PIC32CX-BZ2 and WBZ45 Family Processor and Architecture To enable simple and cost-effective profiling of the system events these generate, a stream of software-generated messages, data trace, and profiling information is exported over three different ways:
Output off chip using the TPIU, through a single pin, called Serial Wire Viewer (SWV). Limited to ITM system trace Output off chip using the TPIU, through a 4-bit pin interface. Bandwidth is limited Internally stored in RAM, using the CoreSight ETB. Bandwidth is then optimal but capacity is limited The Flash Patch and Breakpoint Unit (FPB) provides up to 8 hardware breakpoint comparators that debuggers can use. The comparators in the FPB also provide remap functions of up to 8 words in the program code in the Code memory region. This enables applications stored on a non-erasable, ROM-based microcontroller to be patched if a small programmable memory, for example Flash, is available in the device. During initialization, the application in ROM detects, from the programmable memory, whether a patch is required. If a patch is required, the application programs the FPB to remap a number of addresses. When those addresses are accessed, the accesses are redirected to a remap table specified in the FPB configuration, which means the program in the non-modifiable ROM can be patched. 10.1.3 Cortex-M4 Processor Features and Configuration IEEE 754-compliant single-precision Floating Point Unit (FPU) Integrated sleep modes for low power consumption Thumb instruction set combines high code density with 32-bit performance Fast code execution permits slower processor clock or increases Sleep mode time Hardware division and fast digital-signal-processing orientated multiply accumulate Saturating arithmetic for signal processing Deterministic, high-performance interrupt handling for time-critical applications Memory Protection Unit (MPU) for safety-critical applications Extensive debug and trace capabilities: Serial Wire Debug and Serial Wire Trace reduce the number of pins required for debugging, tracing and code profiling. Features Interrupts Cortex-M4 Options 1 to 240 Number of priority bits 3 to 8 Data endianness Little-endian or big-endian SysTick Timer calibration value MPU Present or Not present PIC32CX-BZ2 Configuration 40 3 = eight levels of priority Little-endian 0x80000000 Present Debug support level 0 = No debug. No DAP, breakpoints, watchpoints, Flash patch or halting debug 3 = Full debug plus DWT data matching 1 = Minimum debug. Two breakpoints, one watchpoint, no Flash patch 2 = Full debug minus DWT data matching 3 = Full debug plus DWT data matching Trace support level 0 = No trace. No ETM, ITM or DWT triggers and counters 1 = Standard trace. ITM and DWT triggers and counters, but no ETM 2 = Full trace. Standard trace plus ETM 3 = Full trace plus HTM port 2 = Full trace. Standard trace plus ETM JTAG Present or Not present Not present 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 95 PIC32CX-BZ2 and WBZ45 Family Processor and Architecture
...........continued Features Cortex-M4 Options PIC32CX-BZ2 Configuration Bit Banding Present or Not present FPU Present or Not present Not present Present 10.1.4 Cortex-M4 Core Peripherals Nested Vectored Interrupt Controller System Control Block System Timer The Nested Vector Interrupt Controller (NVIC) is an embedded interrupt controller that supports low latency interrupt processing. The System Control Block (SCB) is the programmers model interface to the processor. It provides system implementation information and system control, including configuration, control and reporting of system exceptions. Refer to the Cortex-M4 Technical Reference Manual for more details (http://www.arm.com). The system timer, SysTick, is a 24-bit countdown timer. Use this as a Real-Time Operating System (RTOS) tick timer or as a simple counter. The SysTick timer runs on the processor clock and it does not decrement when the processor is halted for debugging. Refer to the Cortex-M4 Technical Reference Manual for more details (http://www.arm.com). Memory Protection Unit The Memory Protection Unit (MPU) improves system reliability by defining the memory attributes for different memory regions. It provides up to eight different regions and an optional predefined background region. Refer to the Cortex-M4 Technical Reference Manual for more details (http://www.arm.com). Floating-Point Unit The Floating Point Unit (FPU) provides IEEE 754-compliant operations on single-precision, 32-
bit, floating-point values. Refer to the Cortex-M4 Technical Reference Manual for more details
(http://www.arm.com). 10.1.5 Cortex-M4 Address Map Address 0xE000E008-0xE000E00F Core Peripheral System control block 0xE000E010-0xE000E01F System timer 0xE000E100-0xE000E4EF Nested Vectored Interrupt Controller 0xE000ED00-0xE000ED3F 0xE000ED90-0xE000ED93 System control block MPU Type Register 0xE000ED94-0xE000EDB8 Memory Protection Unit 0xE000EF00-0xE000EF03 Nested Vectored Interrupt Controller 0xE000EF30-0xE000EF44 Floating Point Unit 10.2 Nested Vector Interrupt Controller (NVIC) 10.2.1 Overview The Nested Vectored Interrupt Controller (NVIC) in the PIC32CX-BZ2 family devices supports 40 interrupts with eight different priority levels. For more details, refer to the Cortex-M4 Technical Reference Manual (www.arm.com). 10.2.2 Interrupt Line Mapping Each of the interrupt lines is connected to one peripheral instance, as shown in the table below. Each peripheral can have one or more interrupt flags, located in the peripherals Interrupt Flag Status and Clear (INTFLAG) register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 96 PIC32CX-BZ2 and WBZ45 Family Processor and Architecture An interrupt flag is set when the interrupt condition occurs. Each interrupt in the peripheral can be individually enabled by writing a '1' to the corresponding bit in the peripherals Interrupt Enable Set (INTENSET) register, and disabled by writing '1' to the corresponding bit in the peripherals Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated from the peripheral when the interrupt flag is set and the corresponding interrupt is enabled. Depending on their criticality, the interrupt requests for one peripheral are either ORed together on system level, generating one interrupt or directly connected to an NVIC interrupt lines. This is described in the table below. An interrupt request will set the corresponding interrupt pending bit in the NVIC interrupt pending registers
(SETPEND/CLRPEND bits in ISPR/ICPR). For the NVIC to activate the interrupt, it must be enabled in the NVIC interrupt enable register (SETENA/CLRENA bits in ISER/ICER). The NVIC interrupt priority registers IPR0-IPR7 provide a priority field for each interrupt. Module EIC NMI External Interrupt Control RTCC Real-Time Counter and Calendar EIC External Interrupt Controller FREQM Frequency Meter Flash Subsystem Source NMI CMP A 0 CMP A 1 CMP A 2 CMP A 3 OVF A PER A 0 PER A 1 PER A 2 PER A 3 PER A 4 PER A 5 PER A 6 PER A 7 TAMPER A EXTINT 0 EXTINT 1 EXTINT 2 EXTINT 3 DONE Flash Controller PFW PCACHE PORT-A PORT-B PortA Input Change Interrupt PortB Input Change Interrupt Line NMI 0 1 2 3 4 5 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 97 PIC32CX-BZ2 and WBZ45 Family Processor and Architecture
...........continued Module DMAC Direct Memory Access Controller EVSYS Event System Interface PAC Peripheral Access Controller RAM ECC SERCOM0 Serial Communication Interface 0(1) Order: USART, I2CM, I2CS, SPI SERCOM1 Serial Communication Interface 1(1) Order: USART, I2CM, I2CS, SPI SERCOM2 Serial Communication Interface 2(1) Order: USART, I2CM, I2CS, SPI Source SUSP 0..3 TCMPL 0..3 TERR 0..3 SUSP 4..15 TCMPL 4..15 TERR 4..15 EVD 0..3 OVR 0..3 EVD 4..11 OVR 4..11 ERR SINGLEE-0 DualE-1 0 1 2 3 4 5 7 0 1 2 3 4 5 7 0 1 2 3 4 5 7 Line 6 7 8 9 10 11 12 13 14 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 98
...........continued Module SERCOM3 Serial Communication Interface 3(1) Order: USART, I2CM, I2CS, SPI TCC0 Timer Counter Control 0 PIC32CX-BZ2 and WBZ45 Family Processor and Architecture Line 15 16 Source 0 1 2 3 4 5 7 CNT A DFS A ERR A FAULTA A FAULTB A FAULT0 A FAULT1 A OVF TRG UFS A MC 0 MC 1 MC 2 MC 3 MC 4 MC 5 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 99
...........continued Module TCC1 Timer Counter Control 1 TCC2 Timer Counter Control 2 TC0 Basic Timer Counter 0 PIC32CX-BZ2 and WBZ45 Family Processor and Architecture Source CNT A DFS A ERR A FAULTA A FAULTB A FAULT0 A FAULT1 A OVF TRG UFS A MC 0 MC 1 MC 2 MC 3 MC 4 MC 5 CNT A DFS A ERR A FAULTA A FAULTB A FAULT0 A FAULT1 A OVF TRG UFS A MC 0 MC 1 ERR A MC 0 MC 1 OVF Line 17 18 19 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 100
...........continued Module TC1 Basic Timer Counter 1 TC2 Basic Timer Counter 2 TC3 Basic Timer Counter 3 ADCTRL AC Analog Comparators AES Advanced Encryption Standard TRNG True Random Generator ICM Integrity Check Monitor QSPI Quad SPI interface Wireless Radio PIC32CX-BZ2 and WBZ45 Family Processor and Architecture Source ERR A MC 0 MC 1 OVF ERR A MC 0 MC 1 OVF ERR A MC 0 MC 1 OVF ADC_GIRQ ADC_DIRQ0, ADC_DIRQ1 ADC_AIRQ0, ADC_AIRQ1 ADC_FLT ADC_EOS ADC_BGVR_RDY COMP 0 COMP 1 WIN 0 ENCCMP GFMCMP IS0 ICM QSPI ZB_INT0 BT_INT0 BT_INT1 ARBITER CLKI_WAKEUP_NMI BT_LC BT_RC Line 20 21 22 23 34 35 36 24 25 26 27 29 30 31 32 33 37 38 39 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 101 PIC32CX-BZ2 and WBZ45 Family Processor and Architecture Note:
1. The integer number specified in the source refers to the respective bit position in the INTFLAG register of the respective peripheral. 10.3 High-Speed Bus System 10.3.1 Features High-Speed Bus Matrix has the following features:
Symmetric crossbar bus switch implementation Allows concurrent accesses from different Hosts to different Clients 32-bit data bus Operation at a one-to-one clock frequency with the bus Hosts 10.3.2 Configuration Figure 10-1. Host-Client Relations High-Speed Bus Matrix Table 10-1. High Speed Bus Matrix Host High-Speed Bus Matrix Host Host ID CM4CPU - Cortex M4 Processor CM4CC - Cortex-M Cache Controller DMA RD - DMA-Read DMA-WR - DMA-Write 1 2 3 4 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 102 PIC32CX-BZ2 and WBZ45 Family Processor and Architecture
...........continued High-Speed Bus Matrix Host Host ID DSU/ICD (private test mode only) - Device Service Unit/In-Chip Debugger ICM - Integrity Check Monitor ADCM - ADC Controller Module 5 6 7 Table 10-2. High-Speed Bus Matrix Client High-Speed Bus Matrix Client Client ID SRAM1 - SRAM Port 1 SRAM2 - SRAM Port 2 SRAM3 - SRAM Port 3 SRAM4 - SRAM Port 4 PCHE - Pre-fetch Cache of CM4CC PCHE - Pre-fetch Cache of Peripherals PB-B-A - Peripheral Bridge A PB-B-B - Peripheral Bridge B PB-B-C - Peripheral Bridge C PB-PIC - Peripheral Bus PIC QSPI - Quad SPI Interface PUKCC - Public Key Cryptography Controller 1 2 3 4 5 6 7 8 9 10 11 12 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 103 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11. Cortex M Cache Controller (CMCC) 11.1 Overview The Cortex M Cache Controller provides an L1 cache to the Cortex M CPU. The CMCC sits transparently between the CPU and the cache leading to improved performance. The CMCC interfaces with the CPU through the AHB and is connected to the APB bus interface for its configuration. 11.2 Features Physically addressed and physically tagged L1 data and instruction cache set to 4 KB L1 cache line size set to 16 Bytes L1 cache integrates 32-bit bus host interface Unified 4-Way set associative cache architecture Lock-Down feature, which allows cached to be locked per way Write through cache operations, read allocate Configurable as data and instruction Tightly Coupled Memory (TCM) Round Robin victim selection policy Event Monitoring, with one programmable 32-bit counter Cache Interface includes cache maintenance operations registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 104 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.3 Block Diagram Figure 11-1. CMCC Block Diagram CM4F Cortex M Interface METADATA RAM RAM Interface DATA RAM TAG RAM Memory Interface High-Speed Bus Matrix Cache Controller Registers Interface APB Interface 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 105 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) Figure 11-2. CMCC Organization 11.4 Signal Description Not applicable. 11.5 Product Dependencies Not applicable. 11.5.1 I/O Lines Not applicable. 11.5.2 Power Management The CMCC will continue to function as long as the CPU is not sleeping and the CMCC is enabled. 11.5.3 Clocks Not applicable. 11.5.4 DMA Not applicable. 11.5.5 Interrupts Not applicable. 11.5.6 Events Not applicable. 11.5.7 Debug Operation When the CPU is halted in debug mode, the CMCC is halted. Any read access by the debugger in cached zones are not cached. 11.5.8 Register Access Protection Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 106 WAY 0WAY 1WAY 2WAY 3Base Address + 0x00000000Base Address + 0x00000400Base Address + 0x00000800Base Address + 0x00000C00Line 0Line 1Line 2Line 3Line 4......Line 634 Bytes4 Bytes4 Bytes4 BytesLine n PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.5.9 Analog Connections Not applicable. 11.6 Functional Description 11.6.1 Principle of Operation 11.6.2 Initialization and Normal Operation On reset, the cache controller data entries are all invalidated, and the cache is disabled. The cache is transparent to processor operations. The cache controller is activated through the use of its configuration registers. The configuration interface is memory mapped in the APB bus. Use the following sequence to enable the cache controller:
Verify that the CMCC is disabled, reading the value of the SR.CSTS. Enable the CMCC by writing '1' in CTRL.CEN. The MODULE is disabled by writing a '0' in CTRL.CEN. 11.6.3 Change Cache Size It is possible to change the cache size by writing to the Cache Size Configured By Software bits in the Cache Configuration register (CFG.CSIZESW). Use the following sequence to change the cache size:
Disable the CMCC controller by writing a zero to the Cache Controller Enable bit in the Cache Control register
(CTRL.CEN=0). Check the Cache Controller Status bit in the Cache Status register to verify that the CMCC is successfully disabled (SR.CSTS=0). Change CFG.CSIZESW to its new value. Enable the CMCC by writing CTRL.CEN=1. 11.6.4 Data Cache Disable The Instructions alone can be cached by disabling the Data cache, as described in the following steps:
1. Disable the cache controller by writing a 0 to CTRL.CEN. 2. Check SR.CSTS to verify whether the CMCC is successfully disabled. 3. Write CFG.DCDIS = 1. 4. Enable the CMCC by writing CTRL.CEN = 1. 11.6.5 Instruction Cache Disable The Data alone can be cached by disabling the Instruction cache, as described in the following steps:
1. Disable the cache controller by writing CTRL.CEN = 0. 2. Check SR.CSTS to verify that the CMCC is successfully disabled. 3. Write CFG.ICDIS = 1. 4. Enable the CMCC by writing CTRL.CEN = 1. 11.6.6 Cache Load and Lock It is possible to lock a specific way for code optimization by writing the Lock Way register (LCKWAY.LCKWAY). The locked way will not be updated by the CMCC as part of cache operations. The load and lock mechanism can be implemented to use cache memory in a deterministic way. Follow these steps to load and lock a way:
1. Disable cache controller by clearing the CTRL.CEN bit. 2. Invalidate the desired WAY line by line. This will reset the round robin algorithm of the invalidated line, that will become eligible for the next load operation. 3. Disable the Instruction cache, but keep the Data cache enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 107 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 4. 5. Enable the cache by setting the CTRL.CEN bit. Place the respective piece of code and/or data to the corresponding WAY due to simple LOAD operations. Loading the piece of code and/or data will force the cache to refill the previous invalidated line in the right way. No need to load all the bytes of the line, only the first byte. The cache will automatically refill the complete line. Lock the specific WAY by setting LCKWAY.LCKWAY[3:0]. 6. 7. Re-enable the instruction cache. The locked WAY is now loaded and ready to operate. The remaining WAYS can be used as I-cache or D-cache as required. 11.6.7 Tightly Coupled Memory Users can use a part of the cache as Tightly Coupled Memory (TCM). The cache size is determined by the Cache Size Configuration by Software bits in the Cache Configuration register (CFG.CSIZESW). The relation between cache and TCM is as given below:
TCM size = maximum Cache size configured Cache size. The TCM start address can be obtained from the product memory mapping. The cache memory starts first from the address followed by the TCM memory. Size of the Way is fixed and the number of ways varies according to the available size for the cache memory. See 8. Product Memory Mapping Overview. Table 11-1. TCM Sizes Max. Cache Configured Cache TCM Size 4 KB 4 KB 4 KB 4 KB 4 KB 1 KB 2 KB 0 KB 0 KB 3 KB 2 KB 4 KB The TCM is also accessible in its maximum size when the CMCC is disabled. The TCM does not need to be locked in order to operate. Note:Writing into the cache DATA RAM region through the CPU can overwrite the valid cache lines. This can result in data corruption when the cache controller is accessing the data for cache transactions. Access the DATA RAM region only after configuring it as TCM. Related Links 8. Product Memory Mapping Overview 11.6.8 Cache Maintenance 11.6.8.1 Cache Invalidate by Line Operation When an invalidate by line command is issued, the CMCC resets the valid bit information of the decoded cache line. As the line is no longer valid, the replacement counter points to that line. Disable the cache controller by writing a zero to the Cache Controller Enable bit in the Cache Control register
(CTRL.CEN). Check SR.CSTS to verify that the CMCC is successfully disabled. Perform an invalidate by line by writing the set {index,way} in the Cache Maintenance 1 register
(MAINT1.INDEX, MAINT1.WAY). Enable the CMCC by writing a '1' to CTRL.CEN. 11.6.8.2 Cache Invalidate All Operation Use the following sequence to invalidate all cache entries. Disable the cache controller by writing a zero to the Cache Enable bit in the Cache Control register
(CTRL.CEN). Check SR.CSTS to verify that the CMCC is successfully disabled. Perform a full invalidate operation by writing a '1' to the Cache Controller Invalidate All bit in the Cache Maintenance 0 register (MAINT0.INVALL). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 108 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) Enable the CMCC by writing a '1' to CTRL.CEN. 11.6.9 Cache Performance Monitoring The Cortex M cache controller includes a programmable monitor/32-bit counter. The monitor can be configured to count the number of clock cycles, the number of data hit or the number of instruction hit. It is important to know that the Cortex-M4 processor prefetches instructions ahead of execution. It performs only 32-bit read access on the Instruction Bus, which means:
One arm instruction is fetched per bus access Two thumb instructions are fetched per bus access As a consequence, two thumb instructions (e.g., NOP) need one bus access, which results in the HIT counter incrementing by 1. Use the following sequence to activate the counter:
Configure the monitor counter by writing the MCFG.MODE. CYCLE_COUNT is used to increment the counter along with the program counter, to count the number of cycles. IHIT_COUNT is the instruction Hit counter, which increments the counter when there is a hit for the instruction in the cache. DHIT_COUNT is the data Hit counter which increments the counter when there is a hit for the data in the cache. Enable the counter by writing a '1' to the Cache Controller Monitor Enable bit in the Cache Monitor Enable register (MEN.MENABLE). If required, reset the counter by writing a '1' to the Cache Controller Software Reset bit in the Cache Monitor Control register (MCTRL.SWRST). Check the value of the monitor counter by reading the MSR.EVENT_CNT bit field. 11.7 DEBUG Mode In Debug mode, TAG and METADATA RAM blocks content is read/written through the AHB bus interface if the CMCC is disabled. When the CMCC is enabled, the TAG and METADATA RAM blocks are non readable. Debug access has the same R/W properties as the CPU access for the DATA RAM block. The TAG, METADATA and DATA RAM blocks' R/W properties are summarized in RAM Properties. See RAM Properties from the Related Links. Use the following sequence to perform read access with the Debugger to the three RAM blocks:
Disable the cache controller by writing a zero to the Cache Controller Enable bit in the Cache Control register
(CTRL.CEN). Check the Cache Controller Status bit in the Cache Status register (SR.CSTS) to verify that the CMCC is successfully disabled. Perform a read or write access through Debugger:
@ CMCC_AHB_ADDR for DATA RAM,
@ CMCC_AHB_ADDR_TAG for TAG RAM,
@ CMCC_AHB_ADDR_MTDATA for METADATA RAM. If a write access has been performed in the TAG, METADATA, or DATA RAM in the cache section, an invalid operation must be performed before re-enabling the CMCC. Related Links 11.8. RAM Properties 11.8 RAM Properties The following table shows the different access properties of the three RAM blocks, according the different modes described in the previous chapters. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 109 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) Table 11-2. Access to RAM Access Condition DATA RAM TAG RAM METADATARAM CPU access when CMCC DISABLED R/W no R/W - hardfault no R/W - hardfault CPU access when CMCC ENABLED CACHE section configured: R/W(1) TCM section configured: R/W no R/W - hardfault no R/W - hardfault Debugger access when CMCC DISABLED R/W R/W R/W Debugger access when CMCC ENABLED CACHE section configured: R/W(1) TCM section configured: R/W no R/W no R/W Note:
1. A write operation in this zone can corrupt the coherency of the cache. An invalidate operation may be needed. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 110 11.9 Register Summary Offset Name Bit Pos. 7 6 5 LCKDOWN WAYNUM[1:0]
PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 4 RRP CLSIZE[2:0]
3 2 1 LRUP RANDP GCLK 0 AP CSIZE[2:0]
CSIZESW[2:0]
DCDIS ICDIS LCKWAY[3:0]
CEN CSTS INVALL INDEX[7:4]
MODE[1:0]
MENABLE SWRST INDEX[3:0]
WAY[3:0]
EVENT_CNT[7:0]
EVENT_CNT[15:8]
EVENT_CNT[23:16]
EVENT_CNT[31:24]
0x00 TYPE 0x04 CFG 0x08 CTRL 0x0C SR 0x10 LCKWAY 0x14
... 0x1F Reserved 0x20 MAINT0 0x24 MAINT1 0x28 MCFG 0x2C MEN 0x30 MCTRL 0x34 MSR 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 11.10 Register Description 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 111 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.1 Cache Type Name:
Offset:
Reset:
Property: R TYPE 0x00 0x000012D2 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 Access Reset Bit Access Reset 7 LCKDOWN R 1 6 R 1 WAYNUM[1:0]
Bits 13:11 CLSIZE[2:0]Cache Line Size R 0 5 R 0 12 CLSIZE[2:0]
R 1 4 RRP R 1 11 R 0 3 LRUP R 0 10 R 0 2 RANDP R 0 9 CSIZE[2:0]
R 1 1 GCLK R 1 8 R 0 0 AP R 0 This field configures the Cache Line Size. Value 0x2 0x3-0x7 Name CLSIZE_16B Description Cache Line Size is 16 bytes Reserved Bits 10:8 CSIZE[2:0]Cache Size This bit field configures the cache size. Value 0x0 0x1 0x2 0x3-0x7 Name CSIZE_1KB CSIZE_2KB CSIZE_4KB Description Cache Size is 1 KB Cache Size is 2 KB Cache Size is 4 KB Reserved Bit 7 LCKDOWNLock Down Supported Writing a 0 to this bit disables the Lock Down feature. Writing a 1 to this bit enables the Lock Down feature. Bits 6:5 WAYNUM[1:0]Number of Way This bit field configures the mapping of the cache. Value 0x0 0x1 0x2 0x3 Name DMAPPED ARCH2WAY ARCH4WAY ARCH8WAY Description Direct Mapped Cache 2-WAY set associative 4-WAY set associative 8-WAY set associative Bit 4 RRPRound Robin Policy Supported Writing a 0 to this bit disables Round Robin Policy. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 112 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) Writing a 1 to this bit enables Round Robin Policy. Bit 3 LRUPLeast Recently Used Policy Supported Writing a 0 to this bit disables the Least Recently Used Policy Supported. Writing a 1 to this bit enables the Least Recently Used Policy Supported. Bit 2 RANDPRandom Selection Policy Supported Writing a 0 to this bit disables the Random Selection Policy Supported. Writing a 1 to this bit enables the Random Selection Policy Supported. Bit 1 GCLKDynamic Clock Gating Writing a 0 to this bit disables the Dynamic Clock Gating feature. Writing a 1 to this bit enables the Dynamic Clock Gating feature. Bit 0 APAccess Port Access Allowed Writing a 0 to this bit disables the Access Port Access Allowed. Writing a 1 to this bit enables the Access Port Access Allowed. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 113 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.2 Cache Configuration Name:
Offset:
Reset:
Property: R/W CFG 0x04 0x00000020 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 Access Reset Bit 7 Access Reset 6 R/W 0 5 CSIZESW[2:0]
R/W 1 4 R/W 0 3 2 DCDIS R/W 0 1 ICDIS R/W 0 8 0 Bits 6:4 CSIZESW[2:0]Cache Size Configured by Software This field configures the cache size. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Name CONF_CSIZE_1KB CONF_CSIZE_2KB CONF_CSIZE_4KB CONF_CSIZE_8KB CONF_CSIZE_16KB CONF_CSIZE_32KB CONF_CSIZE_64KB Description The Cache Size is configured to 1KB The Cache Size is configured to 2KB The Cache Size is configured to 4KB The Cache Size is configured to 8KB The Cache Size is configured to 16KB The Cache Size is configured to 32KB The Cache Size is configured to 64KB Reserved Bit 2 DCDISData Cache Disable Writing a 0 to this bit enables data caching. Writing a 1 to this bit disables data caching. Bit 1 ICDISInstruction Cache Disable Writing a 0 to this bit enables instruction caching. Writing a 1 to this bit disables instruction caching. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 114 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.3 Cache Control Name:
Offset:
Reset:
Property: Write-only CTRL 0x08 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 0 CENCache Controller Enable Writing a '0' to this bit disables the CMCC. Writing a '1' to this bit enables the CMCC. 9 1 8 0 CEN W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 115 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.4 Cache Status Name:
Offset:
Reset:
Property: Read-only SR 0x0C 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 0 CSTSCache Controller Status Writing a 0 to this bit disables the CMCC. Writing a 1 to this bit enables the CMCC. 9 1 8 0 CSTS R 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 116 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.5 Cache Lock per Way Name:
Offset:
Reset:
Property: Read/Write LCKWAY 0x10 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 Access Reset Bits 3:0 LCKWAY[3:0]Lockdown Way Register This field selects which way is locked. 3 R/W 0 9 1 8 0 2 LCKWAY[3:0]
R/W 0 R/W 0 R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 117 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.6 Cache Maintenance 0 Name:
Offset:
Reset:
Property: Write-only MAINT0 0x20 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 0 INVALLCache Controller Invalidate All Writing a '0' to this bit has no effect. Writing a '1' to this bit invalidates all cache entries. 9 1 8 0 INVALL W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 118 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.7 Cache Maintenance 1 Name:
Offset:
Reset:
Property: Write-only MAINT1 0x24 0x00000000 31 W 0 23 Bit Access Reset Bit Access Reset WAY[3:0]
30 W 0 22 29 W 0 21 28 W 0 20 27 26 25 24 19 18 17 16 Bit 15 14 13 12 Access Reset Bit Access Reset 7 W 0 INDEX[3:0]
6 W 0 5 W 0 4 W 0 11 W 0 3 INDEX[7:4]
10 W 0 2 9 W 0 1 8 W 0 0 Bits 31:28 WAY[3:0]Invalidate Way Value 0x0 0x1 0x2 0x3 0x4-0xF Name WAY0 WAY1 WAY2 WAY3 Description Way 0 is selection for index invalidation Way 1 is selection for index invalidation Way 2 is selection for index invalidation Way 3 is selection for index invalidation Reserved Bits 11:4 INDEX[7:0]Invalidate Index This field selects the index value for invalidation 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 119 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.8 Cache Monitor Configuration Name:
Offset:
Reset:
Property: Read/Write MCFG 0x28 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 MODE[1:0]
R/W 0 R/W 0 Bits 1:0 MODE[1:0]Cache Controller Monitor Counter Mode This field selects the type of data monitored. Value 0x0 0x1 0x2 0x3 Name CYCLE_COUNT IHIT_COUNT DHIT_COUNT Description Cycle counter Instruction hit counter Data hit counter Reserved 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 120 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.9 Cache Monitor Enable Name:
Offset:
Reset:
Property: Read/Write MEN 0x2C 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 0 MENABLECache Controller Monitor Enable Writing a 0 to this bit disables the monitor counter. Writing a 1 to this bit enables the monitor counter. 9 1 8 0 MENABLE R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 121 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.10 Cache Monitor Control Name:
Offset:
Reset:
Property: Write-only MCTRL 0x30 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 0 SWRSTCache Controller Software Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets the event counter register. 9 1 8 0 SWRST W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 122 PIC32CX-BZ2 and WBZ45 Family Cortex M Cache Controller (CMCC) 11.10.11 Cache Monitor Status Name:
Offset:
Reset:
Property: Read-only MSR 0x34 0x00000000 Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 R 0 23 R 0 15 R 0 7 R 0 30 R 0 22 R 0 14 R 0 6 R 0 29 R 0 21 R 0 13 R 0 5 R 0 28 27 EVENT_CNT[31:24]
R R 0 0 20 19 EVENT_CNT[23:16]
R R 0 0 11 12 EVENT_CNT[15:8]
R R 0 0 4 3 EVENT_CNT[7:0]
R R 0 0 26 R 0 18 R 0 10 R 0 2 R 0 25 R 0 17 R 0 9 R 0 1 R 0 24 R 0 16 R 0 8 R 0 0 R 0 Bits 31:0 EVENT_CNT[31:0]Monitor Event Counter This field indicates the Monitor Event Counter value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 123 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12. Device Service Unit (DSU) 12.1 Overview The Device Service Unit (DSU) provides a means of detecting debugger probes. It enables the ARM Debug Access Port (DAP) to have control over multiplexed debug pads and CPU Reset. The DSU also provides system-level services to debug adapters in an ARM debug system. It implements a CoreSight Debug ROM that provides device identification as well as identification of other debug components within the system. Hence, it complies with the ARM Peripheral Identification specification. The DSU also provides system services to applications that need memory testing, as required for IEC60730 Class B compliance, for example. The DSU can be accessed simultaneously by a debugger and the CPU, as it is connected on the High-Speed Bus Matrix. For security reasons, some of the DSU features will be limited or unavailable when the device is protected by the Code Protect bit. 12.2 Features CPU Reset Extension Debugger Probe Detection (Cold- and Hot-Plugging) Chip-Erase Command and Status 32-Bit Cyclic Redundancy Check (CRC32) of any Memory Accessible Through the Bus Matrix ARM CoreSight Compliant Device Identification Two Debug Communications Channels Debug Access Port Security Filter 12.3 Block Diagram Figure 12-1. DSU Block Diagram GPIO 12.4 Signal Description The DSU uses three signals to function. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 124 DSUSWCLKCORESIGHT ROMDAP SECURITY FILTERCRC-32MBISTCHIP ERASERESETcpu_reset_extensionCPUDAPSWDIOFLASHDBGMHIGH-SPEED BUS MATRIXMSdebugger_presentDEBUGGER PROBEINTERFACEAHB-APCONTROLLER PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) Signal Name RESET SWCLK SWDIO Type Digital Input Digital Input Digital I/O Description External Reset pin SW clock pin SW bidirectional data pin 12.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 12.5.1 I/O Lines The SWCLK pin is by default assigned to the DSU module to allow debugger probe detection and to stretch the CPU Reset phase (see Debugger Probe Detection from Related Links). The Hot-Plugging feature depends on the GPIO configuration. If the SWCLK pin function is changed in the port, the Hot-Plugging feature is not disabled. Hot-Plugging is disabled with the CFGCON0.HPLUGDIS bit, which is enabled by default. Therefore to use the SWCLK pin for GPIO functions, it must be disabled by setting CFGCON0.HPLUGDIS = 1. Related Links 12.6.3. Debugger Probe Detection 12.5.2 Power Management The DSU will continue to operate in any sleep mode where the selected source clock is running. 12.5.3 DMA The DMA request lines are connected to the DMA Controller (DMAC). To use DMA requests with this peripheral, the DMAC must be configured first (see Direct Memory Access Controller from Related Links). Related Links 22. Direct Memory Access Controller (DMAC) 12.5.4 Interrupts Not applicable. 12.5.5 Events Not applicable. 12.5.6 Register Access Protection Registers with write access can be optionally write-protected by the Peripheral Access Controller (PAC), except for the following:
Debug Communication Channel 0 register (DCC0) Debug Communication Channel 1 register (DCC1) Note:Optional write protection is indicated by the "PAC Write Protection" property in the register description. Write protection does not apply for accesses through an external debugger. 12.5.7 Analog Connections Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 125 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.6 Debug Operation 12.6.1 Principle of Operation The DSU provides basic services to allow on-chip debug using the ARM Debug Access Port and the ARM processor debug resources:
CPU Reset extension Debugger probe detection For more details on the ARM debug components, refer to the ARM Debug Interface v5 Architecture Specification. 12.6.2 CPU Reset Extension CPU Reset extension refers to the extension of the Reset phase of the CPU core after the external Reset is released. This ensures that the CPU is not executing code at start-up while a debugger connects to the system. The debugger is detected on a RESET release event when SWCLK is low. At start-up, SWCLK is internally pulled up to avoid false detection of a debugger if the SWCLK pin is left unconnected. When the CPU is held in the Reset extension phase, the CPU Reset extension bit of the Status A register (STATUSA.CRSTEXT) is set. To release the CPU, write a '1' to STATUSA.CRSTEXT. STATUSA.CRSTEXT will, then, be set to '0'. Writing a '0' to STATUSA.CRSTEXT has no effect. For security reasons, it is not possible to release the CPU Reset extension when the device is protected by the Code Protect bit. Trying to do so sets the Protection Error bit (PERR) of the Status A register (STATUSA.PERR). Figure 12-2. Typical CPU Reset Extension Set and Clear Timing Diagram SWCLK RESET pin DSU CRSTEXT Clear CPU reset extension CPU_STATE reset running 12.6.3 Debugger Probe Detection 12.6.3.1 Cold Plugging Cold-Plugging is the detection of a debugger when the system is in Reset. Cold-Plugging is detected when the CPU Reset extension is requested, as described above. 12.6.3.2 Hot Plugging Hot-Plugging is the detection of a debugger probe when the system is not in Reset. Hot-Plugging is not possible under Reset because the detector is reset when POR or RESET are asserted. Hot-Plugging is active when a SWCLK falling edge is detected. The SWCLK pad is multiplexed with other functions and the user must ensure that its default function is assigned to the debug system. If the SWCLK pin function is changed in the port, the Hot-Plugging feature is not disabled. Hot-Plugging is disabled with the CFGCON0.HPLUGDIS bit, which is enabled by default. Therefore, to use the SWCLK pin for GPIO functions, it must be Disabled by setting CFGCON0.HPLUGDIS=1. Availability of the Hot-Plugging feature can be read from the Hot-Plugging Enable bit of the Status B register (STATUSB.HPE). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 126 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) Figure 12-3. Hot-Plugging Detection Timing Diagram SWCLK RESET pin CPU_STATE reset running Hot-Plugging The presence of a debugger probe is detected when either Hot-Plugging or Cold-Plugging is detected. Once detected, the Debugger Present bit of the Status B register (STATUSB.DBGPRES) is set. For security reasons, Hot-Plugging is not available when the device is protected by the Code Protect bit. This detection requires that pads are correctly powered. Thus, at cold start-up, this detection cannot be done until POR is released. If the device is protected, Cold-Plugging is the only way to detect a debugger probe, and so the external Reset timing must be longer than the POR timing. If external Reset is deasserted before POR release, the user must retry the procedure above until it gets connected to the device. 12.7 Chip Erase Chip erase consists of removing all sensitive information stored in the chip and clearing the Code Protect bit. Therefore, all volatile memories and the Flash memory (including the EEPROM emulation area) will be erased. The Flash auxiliary rows, including the user row, will not be erased. When the device is protected, the debugger must first reset the device in order to be detected. This ensures that internal registers are reset after the Protected state is removed. The chip erase operation is triggered by writing a
'1' to the chip erase bit in the Control register (CTRL.CE). This command will be discarded if the DSU is protected by the Peripheral Access Controller (PAC). Once issued, the module clears volatile memories prior to erasing the Flash array. To ensure that the chip erase operation is completed, check the Done bit of the Status A register
(STATUSA.DONE). The chip erase operation depends on clocks and power management features that can be altered by the CPU. For that reason, it is recommended to issue a chip erase after a Cold-Plugging procedure to ensure that the device is in a known and Safe state. The recommended sequence is as follows:
1. 2. Issue the Cold-Plugging procedure (see Cold Plugging from Related Links). The device then:
a. Detects the debugger probe. b. Holds the CPU in Reset. Issue the chip erase command by writing a '1' to CTRL.CE. The device then:
a. Clears the system volatile memories. b. c. Erases the whole Flash array (excluding OTP). Erases the Code Protect bit protection. 3. Check for completion by polling STATUSA.DONE (read as '1' when completed). 4. Reset the device to let the Flash Controller update the fuses. Related Links 12.6.3.1. Cold Plugging 12.8 Programming Programming the Flash or RAM memories is only possible when the device is not protected by the Code Protect bit. The programming procedure is as follows:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 127 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 1. 2. 3. 4. 5. 6. 7. 8. At power-up, RESET is driven low by a debugger. The on-chip regulator holds the system in a POR state until the input supply is above the POR threshold (see Power-on Reset (POR) from Related Links for the characteristics). The system continues to be held in this Static state until the internally regulated supplies have reached a safe Operating state. The PM starts, clocks are switched to the slow clock (Core Clock, System Clock, Flash Clock and any Bus Clocks that do not have clock gate control). Internal Resets are maintained due to the external Reset. The debugger maintains a low level on SWCLK. RESET is released, resulting in a debugger Cold-Plugging procedure. The debugger generates a clock signal on the SWCLK pin, the Debug Access Port (DAP) receives a clock. The CPU remains in Reset due to the Cold-Plugging procedure; meanwhile, the rest of the system is released. A chip erase is issued to ensure that the Flash is fully erased prior to programming. Programming is available through the AHB-AP. Refer to the PIC32CX-BZ2 Programming Specification for more details. After the operation is completed, the chip can be restarted either by asserting RESET or toggling power. Make sure that the SWCLK pin is high when releasing RESET to prevent extending the CPU Reset. Related Links 13.18.4.2. Power-on Reset (POR) 12.9 Intellectual Property Protection Intellectual property protection consists of restricting access to internal memories from external tools when the device is protected, and this is accomplished by setting the Code Protect bit. This Protected state can be removed by issuing a chip erase (see Chip Erase from Related Links). When the device is protected, read/write accesses using the AHB-AP are limited to the DSU address range and DSU commands are restricted. When issuing a chip erase, sensitive information is erased from volatile memory and Flash. The DSU implements a security filter that monitors the AHB transactions inside the DAP. If the device is protected, then AHB-AP read/write accesses outside the DSU external address range are discarded, causing an error response that sets the ARM AHB-AP sticky error bits (For more details, refer to the ARM Debug Interface v5 Architecture Specification on www.arm.com). The DSU is intended to be accessed either:
Internally from the CPU, without any limitation, even when the device is protected Externally from a debug adapter, with some restrictions when the device is protected For security reasons, DSU features have limitations when used from a debug adapter. To differentiate external accesses from internal ones, the first 0x100 bytes of the DSU register map has been mirrored at offset 0x100:
The first 0x100 bytes form the internal address range The next 0x100 bytes form the external address range When the device is protected, the DAP can only issue MEM-AP accesses in the DSU range 0x0100-0x2000. The DSU Operating registers are located in the 0x0000-0x00FF area and remapped in 0x0100-0x01FF to differentiate accesses coming from a debugger and the CPU. If the device is protected and an access is issued in the region 0x0100-0x01FF, it is subject to security restrictions. For more information, refer to the following table. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 128 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) Figure 12-4. APB Memory Mapping 0x0000 0x00FF 0x0100 0x01FF 0x1000 0x1FFF DSU Operating registers Internal address range
(cannot be accessed from debug tools when the device is protected by the Code Protect bit) Mirrored DSU Operating registers Empty External address range
(can be accessed from debug tools with some restrictions) DSU CoreSight ROM Some features not activated by APB transactions are not available when the device is protected:
Table 12-1. Feature Availability Under Protection Features CPU Reset Extension Clear CPU Reset Extension Debugger Cold-Plugging Debugger Hot-Plugging Related Links 12.7. Chip Erase Availability When the Device is Protected Yes No Yes No 12.10 Device Identification Device identification relies on the ARM CoreSight component identification scheme, which allows the chip to be identified as a SAM device implementing a DSU. The DSU contains identification registers to differentiate the device. 12.10.1 CoreSight Identification A system-level ARM CoreSight ROM table is present in the device to identify the vendor and the chip identification method. Its address is provided in the MEM-AP BASE register inside the ARM Debug Access Port. The CoreSight ROM implements a 64-bit conceptual ID composed as follows from the PID0 to PID7 CoreSight ROM Table registers:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 129 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) Figure 12-5. Conceptual 64-bit Peripheral ID Table 12-2. Conceptual 64-Bit Peripheral ID Bit Descriptions Field Size Description JEP-106 CC code 4 Microchip continuation code: 0x0 JEP-106 ID code 4KB count RevAnd CUSMOD PARTNUM REVISION 7 4 4 4 12 4 Microchip device ID: 0x1F Indicates that the CoreSight component is a ROM: 0x0 Not used; read as 0 Not used; read as 0 Contains 0xCD0 to indicate that DSU is present DSU revision (starts at 0x0 and increments by 1 at both major and minor revisions). Identifies DSU identification method variants. If 0x0, this indicates that device identification can be completed by reading the Device Identification register (DID) For more details, refer to the ARM Debug Interface Version 5 Architecture Specification. Location PID4 PID1+PID2 PID4 PID3 PID3 PID0+PID1 PID2 12.10.2 Chip Identification Method The DSU DID register identifies the device as shown in the following table:
Table 12-3. DSU DID Encoding Field Revision Family Series Die DEVSEL Size 4 bits 5 bits 6 bits 8 bits 8 bits Value 0x0 0b00000 0b00000 0x9B Flash Fuses Comments Immutable Field (0x0=Rev-
A0) Family[4:0]
Series[5:0]
Immutable Field = Mask ID
[7:0]
Determines variants of product {VSEL[7:0]} [0x8F|
0x0F|0x0B]
12.11 Functional Description 12.11.1 Principle of Operation The DSU provides memory services, such as CRC32 that require almost the same interface. Hence, the Address, Length and Data registers (ADDR, LENGTH, DATA) are shared. These shared registers must be configured first;
then a command can be issued by writing the Control register. When a command is ongoing, other commands are 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 130 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) discarded until the current operation is completed. Hence, the user must wait for the STATUSA.DONE bit to be set prior to issuing another one. 12.11.2 Basic Operation 12.11.2.1 Initialization The module is enabled by enabling its clocks, see Clock and Reset Unit (CRU) from Related Links. The DSU registers can be PAC write-protected, see Peripheral Access Controller (PAC) from Related Links. Related Links 13. Clock and Reset Unit (CRU) 26. Peripheral Access Controller (PAC) 12.11.2.2 Operation From a Debug Adapter Debug adapters must access the DSU registers in the external address range 0x100 0x2000. If the device is protected by the Code Protect bit, accessing the first 0x100 bytes causes the system to return an error. See Intellectual Property Protection from Related Links. Related Links 12.9. Intellectual Property Protection 12.11.2.3 Operation From the CPU There are no restrictions when accessing DSU registers from the CPU. However, the user must access DSU registers in the internal address range (0x00x100) to avoid external security restrictions. See Intellectual Property Protection from Related Links. Related Links 12.9. Intellectual Property Protection 12.11.3 32-bit Cyclic Redundancy Check CRC32 The DSU unit provides support for calculating a cyclic redundancy check (CRC32) value for a memory area
(including Flash and AHB RAM). When the CRC32 command is issued from:
The internal range, the CRC32 can be operated at any memory location The external range, the CRC32 operation is restricted; DATA, ADDR, and LENGTH values are forced (see below) Table 12-4. AMOD Bit Descriptions when Operating CRC32 AMOD[1:0] Short name External range restrictions 0 1 ARRAY CRC32 is restricted to the full Flash array area (EEPROM Emulation area not included) DATA forced to 0xFFFFFFFF before calculation (no seed) EEPROM CRC32 of the whole EEPROM Emulation area DATA forced to 0xFFFFFFFF before calculation (no seed) 2-3 Reserved
The algorithm employed is the industry standard CRC32 algorithm using the generator polynomial 0xEDB88320
(reversed representation). 12.11.3.1 Starting CRC32 Calculation CRC32 calculation for a memory range is started after writing the start address into the Address register (ADDR) and the size of the memory range into the Length register (LENGTH). Both must be word-aligned. The initial value used for the CRC32 calculation must be written to the Data register (DATA). This value will usually be 0xFFFFFFFF, but can be, for example, the result of a previous CRC32 calculation if generating a common CRC32 of separate memory blocks. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 131 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) Once completed, the calculated CRC32 value can be read out of the Data register. The read value must be complemented to match standard CRC32 implementations or kept noninverted if used as starting point for subsequent CRC32 calculations. The actual test is started by writing a '1' in the 32-bit Cyclic Redundancy Check bit of the Control register
(CTRL.CRC). A running CRC32 operation can be canceled by resetting the module (writing '1' to CTRL.SWRST). 12.11.3.2 Interpreting the Results The user must monitor the Status A register. When the operation is completed, STATUSA.DONE is set. Then the Bus Error bit of the Status A register (STATUSA.BERR) must be read to ensure that no bus error occurred. 12.11.4 Debug Communication Channels The Debug Communication Channels (DCCO and DCC1) consist of a pair of registers with associated handshake logic, accessible by both CPU and debugger even if the device is protected by the Code Protect bit. The registers can be used to exchange data between the CPU and the debugger, during run time as well as in Debug mode. This enables the user to build a custom debug protocol using only these registers. The DCC0 and DCC1 registers are accessible when the Protected state is active. When the device is protected, however, it is not possible to connect a debugger while the CPU is running (STATUSA.CRSTEXT is not writable and the CPU is held under Reset). Two Debug Communication Channel status bits in the Status B registers (STATUS.DCCDx) indicate whether a new value has been written in DCC0 or DCC1. These bits, DCC0D and DCC1D, are located in the STATUSB registers. They are automatically set on write and cleared on read. Note:The DCC0 and DCC1 registers are shared with the on-board memory testing logic (MBIST). Accordingly, DCC0 and DCC1 must not be used while performing MBIST operations. 12.11.5 System Services Availability when Accessed Externally and Device is Protected External access: Access performed in the DSU address offset 0x200-0x1FFF range. Internal access: Access performed in the DSU address offset 0x000-0x100 range. Table 12-5. Available Features when Operated From The External Address Range and Device is Protected Features Availability From The External Address Range and Device is Protected Chip erase command and status Yes CRC32 Yes, only full array or full EEPROM CoreSight Compliant Device identification Debug communication channels Yes Yes STATUSA.CRSTEXT clearing No (STATUSA.PERR is set when attempting to do so) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 132 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.12 DSU Register Summary Bit Pos. 7 6 5 4 CE PERR HPE 3 2 1 0 FAIL DCCD1 BERR DCCD0 CRSTEXT DBGPRES SWRST DONE PROT CELCK Offset 0x00 0x01 0x02 0x03 Name CTRL STATUSA STATUSB Reserved 0x04 ADDR 0x08 LENGTH 0x0C DATA 0x10 DCC0 0x14 DCC1 0x18 DID 0x1C
... 0x0FFF Reserved 0x1000 ENTRY0 0x1004 ENTRY1 0x1008 END 0x100C
... 0x1FCB Reserved 0x1FCC MEMTYPE 0x1FD0 PID4 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 ADDR[5:0]
AMOD[1:0]
LENGTH[5:0]
ADDR[13:6]
ADDR[21:14]
ADDR[29:22]
LENGTH[13:6]
LENGTH[21:14]
LENGTH[29:22]
DATA[7:0]
DATA[15:8]
DATA[23:16]
DATA[31:24]
DATA[7:0]
DATA[15:8]
DATA[23:16]
DATA[31:24]
DATA[7:0]
DATA[15:8]
DATA[23:16]
DATA[31:24]
DEVSEL[7:0]
DIE[7:0]
FAMILY[0]
REVISION[3:0]
SERIES[5:0]
FAMILY[4:1]
ADDOFF[3:0]
ADDOFF[3:0]
ADDOFF[11:4]
ADDOFF[19:12]
ADDOFF[11:4]
ADDOFF[19:12]
END[7:0]
END[15:8]
END[23:16]
END[31:24]
FMT EPRES FMT EPRES SMEMP FKBC[3:0]
JEPCC[3:0]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 133 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU)
...........continued Offset 0x1FD4
... 0x1FDF Name Bit Pos. 7 6 5 4 3 2 1 0 Reserved 0x1FE0 PID0 0x1FE4 PID1 0x1FE8 PID2 0x1FEC PID3 0x1FF0 CID0 0x1FF4 CID1 0x1FF8 CID2 0x1FFC CID3 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 PARTNBL[7:0]
JEPIDCL[3:0]
PARTNBH[3:0]
REVISION[3:0]
JEPU JEPIDCH[2:0]
REVAND[3:0]
CUSMOD[3:0]
PREAMBLEB0[7:0]
CCLASS[3:0]
PREAMBLE[3:0]
PREAMBLEB2[7:0]
PREAMBLEB3[7:0]
12.13 Register Description Registers can be 8, 16, or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the "PAC Write-Protection" property in each individual register description. See Register Access Protection from Related Links. Related Links 12.5.6. Register Access Protection 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 134 12.13.1 Control Name:
Offset:
Reset:
Property: PAC Write-Protection CTRL 0x0000 0x00 Bit 7 6 5 Access Reset Bit 4 CEChip-Erase PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 4 CE W 0 3 2 1 0 SWRST W 0 Writing a 0 to this bit has no effect. Writing a 1 to this bit starts the Chip-Erase operation. Bit 0 SWRSTSoftware Reset Writing a 0 to this bit has no effect. Writing a 1 to this bit resets the module. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 135 12.13.2 Status A STATUSA Name:
0x0001 Offset:
Reset:
0x00 Property: PAC Write Protection Bit 7 6 5 Access Reset Bit 4 PERRProtection Error PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 4 PERR R/W 0 3 FAIL R/W 0 2 BERR R/W 0 1 CRSTEXT R/W 0 0 DONE R/W 0 Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Protection Error bit. This bit is set when a command that is not allowed in Protected state is issued. Bit 3 FAILFailure Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Failure bit. This bit is set when a DSU operation failure is detected. Bit 2 BERRBus Error Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Bus Error bit. This bit is set when a bus error is detected. Bit 1 CRSTEXTCPU Reset Phase Extension Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the CPU Reset Phase Extension bit. This bit is set when a debug adapter Cold-Plugging is detected, which extends the CPU Reset phase. Bit 0 DONEDone Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Done bit. This bit is set when a DSU operation is completed. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 136 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.3 Status B Name:
Offset:
Reset:
Property: PAC Write-Protection STATUSB 0x0002 0x0x Bit 7 6 Access Reset 5 CELCK R 0 4 HPE R 0 3 DCCD1 R 0 2 DCCD0 R 0 1 DBGPRES R x 0 PROT R x Bit 5 CELCKChip Erase Locked Writing a 0 to this bit has no effect. Writing a 1 to this bit has no effect. This bit is set when Chip Erase is locked. This bit is cleared when Chip Erase is unlocked. Bit 4 HPEHot-Plugging Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit has no effect. This bit is set when Hot-Plugging is enabled. This bit is cleared when Hot-Plugging is disabled. This is the case when the SWCLK function is changed. Only a power-reset or a external reset can set it again. Bits 2, 3 DCCDDebug Communication Channel x Dirty Writing a 0 to this bit has no effect. Writing a 1 to this bit has no effect. This bit is set when DCC is written. This bit is cleared when DCC is read. Bit 1 DBGPRESDebugger Present Writing a 0 to this bit has no effect. Writing a 1 to this bit has no effect. This bit is set when a debugger probe is detected. This bit is never cleared. Bit 0 PROTProtected Writing a 0 to this bit has no effect. Writing a 1 to this bit has no effect. This bit is set at power-up when the device is protected. This bit is never cleared. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 137 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.4 Address Name:
Offset:
Reset:
Property: PAC Write Protection ADDR 0x04 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 ADDR[29:22]
R/W 0 20 R/W 0 19 ADDR[21:14]
ADDR[13:6]
R/W 0 12 R/W 0 4 R/W 0 ADDR[5:0]
R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 AMOD[1:0]
24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:2 ADDR[29:0]Address Initial word start address needed for memory operations. Bits 1:0 AMOD[1:0]Access Mode The functionality of these bits is dependent on the operation mode. Bit description when operating CRC32 (see 32-bit Cyclic Redundancy Check (CRC32) from Related Links). Related Links 12.11.3. 32-bit Cyclic Redundancy Check CRC32 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 138 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.5 Length Name:
Offset:
Reset:
Property: PAC Write Protection LENGTH 0x0008 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 28 27 LENGTH[29:22]
R/W 0 20 R/W 0 19 LENGTH[21:14]
R/W 0 12 R/W 0 11 LENGTH[13:6]
R/W 0 4 LENGTH[5:0]
R/W 0 R/W 0 R/W 0 3 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 24 R/W 0 16 R/W 0 8 R/W 0 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 Bits 31:2 LENGTH[29:0]Length Length in words needed for memory operations. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 139 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 28 27 DATA[31:24]
R/W 0 20 R/W 0 19 DATA[23:16]
R/W 0 12 R/W 0 4 R/W 0 DATA[15:8]
DATA[7:0]
R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 12.13.6 Data Name:
Offset:
Reset:
Property: PAC Write Protection DATA 0x000C 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 Bits 31:0 DATA[31:0]Data Memory operation initial value or result value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 140 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.7 Debug Communication Channel x Name:
Offset:
Reset:
Property:
DCC 0x10 + n*0x04 [n=0..1]
0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 Bits 31:0 DATA[31:0]Data Data register. 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 DATA[31:24]
R/W 0 20 R/W 0 19 DATA[23:16]
R/W 0 12 R/W 0 4 R/W 0 DATA[15:8]
DATA[7:0]
R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 141 12.13.8 Device Identification DID Name:
Offset:
0x0018 Property: PAC Write Protection Bit Access Reset Bit Access Reset 31 R p 23 FAMILY[0]
R f Bit 15 Access Reset Bit Access Reset R d 7 R x 30 29 REVISION[3:0]
R p 22 14 R d 6 R x R p 21 R s 13 R d 5 R x PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 28 R p 20 R s 12 R d 4 R x DIE[7:0]
DEVSEL[7:0]
27 R f 19 R s 11 R d 3 R x SERIES[5:0]
26 R f 18 R s 10 R d 2 R x FAMILY[4:1]
25 R f 17 R s 9 R d 1 R x 24 R f 16 R s 8 R d 0 R x Bits 31:28 REVISION[3:0]Processor The value of this field identifies the die revision number. 0x0=rev.A0. Bits 27:23 FAMILY[4:0]Product Family The value of this field corresponds to the product family part of the ordering code. For this device, the value of this field is 0x0. Bits 21:16 SERIES[5:0]Product Series The value of this field corresponds to the product series part of the ordering code. For this device, the value of this field is 0x01, corresponding to a product with the Cortex-M0+ processor with DMA and USB features. Bits 15:8 DIE[7:0]Die Number Identifies the die family. Bits 7:0 DEVSEL[7:0]Device Selection This bit field identifies a device within a product family and product series. The value corresponds to the Flash memory density, pin count and device variant parts of the ordering code. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 142 12.13.9 CoreSight ROM Table Entry x Name:
Offset:
Reset:
Property: PAC Write-Protection ENTRY 0x1000 + n*0x04 [n=0..1]
0xxxxxx00x 31 R x 23 R x 15 R x 7 Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 30 R x 22 R x 14 R x 6 29 R x 21 R x 13 R x 5 ADDOFF[3:0]
PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 26 R x 18 R x 10 25 R x 17 R x 9 24 R x 16 R x 8 28 27 ADDOFF[19:12]
R R x x 20 19 ADDOFF[11:4]
R x 11 R x 12 R x 4 3 2 1 FMT R 1 0 EPRES R x Bits 31:12 ADDOFF[19:0]Address Offset The base address of the component, relative to the base address of this ROM table. Bit 1 FMTFormat Always reads as '1', indicating a 32-bit ROM table. Bit 0 EPRESEntry Present This bit indicates whether an entry is present at this location in the ROM table. This bit is set at power-up if the device is not protected indicating that the entry is not present. This bit is cleared at power-up if the device is not protected indicating that the entry is present. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 143 12.13.10 CoreSight ROM Table End Name:
Offset:
Reset:
Property:
END 0x1008 0x00000000
Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 R 0 23 R 0 15 R 0 7 R 0 30 R 0 22 R 0 14 R 0 6 R 0 29 R 0 21 R 0 13 R 0 5 R 0 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) END[31:24]
END[23:16]
END[15:8]
END[7:0]
28 R 0 20 R 0 12 R 0 4 R 0 27 R 0 19 R 0 11 R 0 3 R 0 26 R 0 18 R 0 10 R 0 2 R 0 25 R 0 17 R 0 9 R 0 1 R 0 24 R 0 16 R 0 8 R 0 0 R 0 Bits 31:0 END[31:0]End Marker Indicates the end of the CoreSight ROM table entries. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 144 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.11 CoreSight ROM Table Memory Type Name:
Offset:
Reset:
Property:
MEMTYPE 0x1FCC 0x0000000X
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 0 SMEMPSystem Memory Present 9 1 8 0 SMEMP R x This bit indicates whether system memory is present on the bus that connects to the ROM table. This bit is set at power-up if the device is not protected, indicating that the system memory is accessible from a debug adapter. This bit is cleared at power-up if the device is protected, indicating that the system memory is not accessible from a debug adapter. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 145 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.12 Peripheral Identification 4 Name:
Offset:
Reset:
Property:
PID4 0x1FD0 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit Access Reset 7 R 0 6 R 0 FKBC[3:0]
5 R 0 4 R 0 3 R 0 JEPCC[3:0]
2 R 0 9 1 R 0 8 0 R 0 Bits 7:4 FKBC[3:0]4KB Count These bits will always return zero when read, indicating that this debug component occupies one 4KB block. Bits 3:0 JEPCC[3:0]JEP-106 Continuation Code These bits will always return zero when read. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 146 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.13 Peripheral Identification 0 Name:
Offset:
Reset:
Property:
PID0 0x1FE0 0x000000D0
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit Access Reset 7 R 0 6 R 0 5 R 0 PARTNBL[7:0]
4 R 0 3 R 0 2 R 0 9 1 R 0 8 0 R 0 Bits 7:0 PARTNBL[7:0]Part Number Low These bits will always return 0xD0 when read, indicating that this device implements a DSU module instance. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 147 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.14 Peripheral Identification 1 Name:
Offset:
Reset:
Property:
PID1 0x1FE4 0x000000FC
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit Access Reset 7 R 1 JEPIDCL[3:0]
6 R 1 5 R 1 4 R 1 3 R 1 9 1 2 PARTNBH[3:0]
R 1 R 0 8 0 R 0 Bits 7:4 JEPIDCL[3:0]Low Part of the JEP-106 Identity Code These bits will always return 0xF when read (JEP-106 identity code is 0x1F). Bits 3:0 PARTNBH[3:0]Part Number High These bits will always return 0xC when read, indicating that this device implements a DSU module instance. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 148 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.15 Peripheral Identification 2 Name:
Offset:
Reset:
Property:
PID2 0x1FE8 0x00000009
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 Access Reset Bit Access Reset 7 R 0 6 5 REVISION[3:0]
R 0 R 0 4 R 0 3 JEPU R 1 2 R 0 1 JEPIDCH[2:0]
R 0 8 0 R 1 Bits 7:4 REVISION[3:0]Revision Number Revision of the peripheral. Starts at 0x0 and increments by one at both major and minor revisions. Bit 3 JEPUJEP-106 Identity Code is Used This bit will always return one when read, indicating that JEP-106 code is used. Bits 2:0 JEPIDCH[2:0]JEP-106 Identity Code High These bits will always return 0x1 when read, (JEP-106 identity code is 0x1F). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 149 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.16 Peripheral Identification 3 Name:
Offset:
Reset:
Property:
PID3 0x1FEC 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit Access Reset 7 R 0 REVAND[3:0]
6 R 0 5 R 0 4 R 0 3 R 0 CUSMOD[3:0]
2 R 0 9 1 R 0 8 0 R 0 Bits 7:4 REVAND[3:0]Revision Number These bits will always return 0x0 when read. Bits 3:0 CUSMOD[3:0]ARM CUSMOD These bits will always return 0x0 when read. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 150 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.17 Component Identification 0 Name:
Offset:
Reset:
Property:
CID0 0x1FF0 0x0000000D
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit Access Reset 7 R 0 6 R 0 5 R 0 4 3 PREAMBLEB0[7:0]
R R 1 0 2 R 1 9 1 R 0 8 0 R 1 Bits 7:0 PREAMBLEB0[7:0]Preamble Byte 0 These bits will always return 0x0000000D when read. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 151 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.18 Component Identification 1 Name:
Offset:
Reset:
Property:
CID1 0x1FF4 0x00000010
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 Access Reset Bit Access Reset 7 R 0 CCLASS[3:0]
6 R 0 5 R 0 4 R 1 3 R 0 2 1 PREAMBLE[3:0]
R R 0 0 8 0 R 0 Bits 7:4 CCLASS[3:0]Component Class These bits will always return 0x1 when read indicating that this ARM CoreSight component is ROM table (For more details, refer to the ARM Debug Interface v5 Architecture Specification at http://www.arm.com). Bits 3:0 PREAMBLE[3:0]Preamble These bits will always return 0x0 when read. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 152 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.19 Component Identification 2 Name:
Offset:
Reset:
Property:
CID2 0x1FF8 0x00000005
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit Access Reset 7 R 0 6 R 0 5 R 0 4 3 PREAMBLEB2[7:0]
R R 0 0 2 R 1 9 1 R 0 8 0 R 1 Bits 7:0 PREAMBLEB2[7:0]Preamble Byte 2 These bits will always return 0x00000005 when read. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 153 PIC32CX-BZ2 and WBZ45 Family Device Service Unit (DSU) 12.13.20 Component Identification 3 Name:
Offset:
Reset:
Property:
CID3 0x1FFC 0x000000B1
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit Access Reset 7 R 1 6 R 0 5 R 1 4 3 PREAMBLEB3[7:0]
R R 0 1 2 R 0 9 1 R 0 8 0 R 1 Bits 7:0 PREAMBLEB3[7:0]Preamble Byte 3 These bits will always return 0x000000B1 when read. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 154 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13. Clock and Reset Unit (CRU) 13.1 Overview The PIC32CX-BZ2 Clock System provides both clocking and reset functions. This chapter describes the clocking functionality and summarizes the clock distribution and terminology in the PIC32CX-BZ2 device. For more details on configuration, see the respective peripherals descriptions. Clock control is handled by the CRU to provide system clocks and interface peripheral clocks. The CRU controls switching and synchronization of clock sources. For details on the Reset functionality, see Resets from Related Links. Related Links 13.18. Resets 13.2 Features The Clock and Reset Unit has the following features:
Supports the following as system clock sources:
16 MHz Primary Crystal Oscillator (POSC) 8 MHz Fast RC Oscillator (FRC) 32 kHz Low Power RC Oscillator (LPRC) 32.768 kHz Secondary Crystal Oscillator (SOSC) 96 MHz System PLL (RFPLL) Provides control registers for all PLLs Provides for glitch-free clock switching between various clock sources Post dividers on processor clock generator to slow down system clock for power save A fail safe clock monitor that detects clock failure and provides automatic switching to the FRC Provides control registers for user interface of clocks and resets Provides configuration bits for oscillator selection and calibration of on-chip oscillators Provides control registers to generate a reference clock output Provide resets for the system Provides NMI interrupts for the system Multiple PB clock dividers One system clock, SYS_CLK, from which almost all clocks used throughout the system are derived Three peripheral clocks, created by independent integer dividers of the SYS_CLK:
PB1_CLK: PB-PIC and PB-Bridge-A bus PB2_CLK: PB-Bridge-B and PB-Bridge-C PB3_CLK: DS/XDS bus clock Six reference output clocks (REFO1 REFO6) with the following clock sources:
System clock (SYS_CLK) PB1 bus clock (PB1_CLK) 16 MHz Primary Crystal Oscillator (POSC) 8 MHz Fast RC Oscillator (FRC) 32 kHz Low Power RC Oscillator (LPRC) 32.768 kHz Secondary Crystal Oscillator (SOSC) 96 MHz System PLL (RFPLL) 64 MHz System PLL (RFPLL PGM MHz) REFI pin Sleep control, supporting Req/Ack signaling with the bus matrix to determine that no transactions are in flight when initiating sleep 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 155 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) JTAG TCK clock control 13.3 Block Diagram The CRU, along with the PMD, provides gated clock output for all peripheral buses. The following figure illustrates the CRU block diagram. Figure 13-1. Clock and Reset Unit Block Diagram Configuration PB BUS UPB BUS BIF SFR Decode/CTRL FRC Calibration FRC Oscillator ADC cp_clk AD-CP spll_clk2 rf_96mhz_clk XTAL_IN z H M 6 1 ZBT RF 16 MHz XTL OSC XTAL_OUT rf_ref_clk_16 posc_clk RFPLL Wrapper frc_clk i i r e d v D M G P xPLLCON PBx_DIV REFOCON REFOTRIM OSCCON OSCTRIM frc_clk I V D _ C R F spll_clk1 posc_clk (16 MHz) VDD-AON LPRC Oscilator SOSC_CTRL z H k 2 3 SOSCI SOSCO SOSC REFI
0
3
C S O C N O C C S O
. Fail Safe Clock Monitor
(FSCM) LP Modes Event Switch Master Clock Switch
(MCS)
[ ]0
[ ]1
[ ]2
[ ]4
[ ]3 lprc_clk sosc_clk cru_fscm_event
1
3
k c _ b p l l k c _ s y s Clock Source Generator
(CLKGEN)
1
6
n e _ k c _ o f e r l l
1
6
k c _ o f e r sys_clk spll_clk1 posc_clk (16 MHz) lprc_clk sosc_clk spll_clk3 (RFPLL 96-MHz) pb1_clk
[ ]0
[ ]1
[ ]2
[ ]4
[ ]3
[ ]5
[ ]6
[ ]7
[ ]8 Reference Clock Generator
(REFO[6:0]) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 156 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Figure 13-2. RFPLL Wrapper posc_clk frc_clk rf_96mhz_clk PGM-DIV
(4'b) CLKGATE spll_clk2 SPLLPOSTDIV2 SPLL1_CLK_REQ PGM-DIV
(8'b) CLKGATE spll_clk1 RFPLL Wrapper SPLLPOSTDIV1 SPLL1_CLK_REQ Figure 13-3. Peripheral Clock Generation Peripheral Channel refo_clk[1]
refo_clk[2]
refo_clk[3]
refo_clk[4]
refo_clk[5]
refo_clk[6]
32KHz_LPCLK gclk_<peripheral>
gclk_<peripheral>
CLKGATE gclk_<peripheral>
X U M H C P PCHx.CLKEN PCHx.GENSEL[2:0]
The CRU Master Clock Switch selects the input clock, which needs to be fed to the CLKGEN Synchronous Clock Generator. The CLKGEN generates and controls the synchronous clocks on the system. This includes the CPU, bus clocks (APB and AHB) and the synchronous (to the CPU) user interfaces of the peripherals. It contains prescalers for the CPU and bus clocks. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 157 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.4 System and Peripheral Clock Generation (CLKGEN) This sub-module generates the system clocks needed for the device from a single source clock. In addition, this module also shuts down these clocks during the Sleep mode. There are two types of clocks generated by this block called core clocks and peripheral clocks. The system clock
(SYS_CLK) is typically used by the CPU. It supports components, such as memory subsystems, and fast peripherals. The peripheral bus clocks (pb_clk) are used to clock slow peripheral devices attached to the pb_bus. The pb_clk[n]
outputs are based on the SYS_CLK frequency with a fixed divisor. The divisor is determined by the value of the PBxDIV registers. The system and peripheral clocks are stopped when in the Sleep mode. The clocks are restarted by disabling the sleep enable. 13.4.1 Sleep Mode The Sleep mode is entered when DSCON[DSEN] is clear and the OSCCON[SLPEN] bit is set and the CPU executes a WFI instruction. This causes the device clocks to be held low (0). 13.4.2 Sleep Mode Entry Entry into the Sleep mode from any other mode does not require a clock switch. This is due to the fact that once in the Sleep mode, no clocks are needed. Note:If software writes to the CRU SFRs before going into the Sleep mode, it is recommended a read be done of the SFRs to Flash the write before executing the WAIT instruction that initiates the Sleep mode. 13.4.3 Sleep Mode Exit Unless the Two-Speed Start-up is enabled, there are no clock-switching events when exiting the Sleep mode. With Two-Speed Start-up disabled, the Sleep mode is effectively extended until the selected clock is ready. Once the clock is ready, the device enters the RUN mode. If Two-Speed Start-up is enabled, the device will come out of Sleep running with the FRC as the clock source and perform an automatic clock switch to the selected clock source. If Two-Speed Start-up is enabled, the RUN mode is entered immediately using the Two-Speed Start-up clock source. A clock switch to the selected clock source occurs once the source is ready. Note:Two-Speed Start-up is not permanently enabled and is software programmable. 13.4.4 Sleep Mode with Delayed Exit In some of the low power Sleep modes, some of the on-chip voltage regulators may be turned off in the system. If this is the case, the Sleep mode cannot be exited immediately on a wake-up event. The wake from Sleep will be delayed until the system is ready to have clocks turned on again. 13.5 Idle Mode The Idle mode is entered when the OSCCON[SLPEN] bit is low and the CPU executes a WFI instruction. Only the CPUs internal clock is stopped in this mode. Note:When exiting from the Sleep mode, the CRU will transition the system to the Idle mode before transitioning to the Run mode. This transition to the Idle mode is used to support the Dream mode and always occurs regardless of the CRU transitioning to the Dream mode or Run mode. Therefore, when exiting the Sleep mode, both the RCON bits
[SLEEP] and [IDLE] will be set. 13.6 Dream Mode When the DRMEN bit in the OSCCON register is set, it allows the DMA controller to switch between the Idle mode and the Sleep mode. When the OSCCON.SLPEN bit is set and the OSCCON.DRMEN bit is set, the CRU monitors the DMAC to make sure all transfers are complete before going into the Sleep mode. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 158 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) If OSCCON.SLPEN = 1, OSCCON.DRMEN = 1, and peripheral clock requests are active, the CRU goes into the Idle mode until all peripheral clock requests are non-active; at which time the CRU goes into the Sleep mode. If OSCCON.SLPEN is not set, the DRMEN bit has no affect as the DMA clocks are still running in the Idle mode. If the CRU recognizes a wake/interrupt event whose priority will wake the DMA but not the CPU, the CRU transitions to the Idle mode. Therefore, the DMA can perform the needed operations and, when the DMA is finished, the CRU will go back to the Sleep mode. During this time, the CPU is still asleep. If the wake event is such that the CPU must handle the event, the whole system will exit the Sleep mode and transition back to the Run mode. 13.7 FRCDIV The FRC can be divided and used as a system clock. The user controls the divider setting using the OSCCON.FRCDIV[2:0] register bits. The divisor is configured for eight divider selections: /1, /2, /4, /8, /16, /32, /64, /
256. 13.8 RFPLL Wrapper The RFPLL wrapper generates two clocks:
spll_clk1 (PGM MHz) Clock frequencies = 96 MHz/(1-255) and 64 MHz frequency choices and optional clock disable option Clock ready indication spll_clk2 (PGM MHz) Clock frequencies = 96 MHz/(1-15) and optional clock disable option Clock ready indication Clocks are produced only when there is a request generated by the user; for clk1, it is CRU and for clk2, it is ADC charge-pump. Along with the clocks, individual clock ready is also generated, which indicates that clocks are ready for consumption. 13.9 Start-up Considerations The presence of hardware NVR fuses on the PIC32CX-BZ2 device allows the system configuration fuses to be ready upon exiting Reset. The following start-up conditions exist:
On any device Reset, no start-up time is required to transfer configuration values from the NVR memory into the configuration holding registers. Once the device is active, the user may change the primary system clock source from FRC to SPLL by using the OSCCON register. 13.10 Fail-Safe Clock Monitor The Clock System includes a Fail-safe Clock Monitor (FSCM). The FSCM monitors the SYS_CLK for continuous operation. If it detects that the SYS_CLK failed, it switches the SYS_CLK over to the FRC oscillator and triggers an NMI. The FRC is an untuned 8 MHz oscillator that drives the SYS_CLK during an FSCM event. When the NMI is executed, software can restart the main oscillator or shut down the system. In the Sleep mode, both the SYS_CLK and the FSCM halt, preventing FSCM detection. 13.11 Fast RC Oscillator The on-chip 8 MHz Fast RC Oscillator (FRC) is intended to be a fast, with precise frequency, internal RC oscillator. The FRC supports calibration to 0.25% accuracy pre-package. However, package-induced stress lowers the accuracy. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 159 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) The FRC oscillator is accurate to provide the clock frequency necessary to maintain baud rate tolerance for serial data transmissions. FRC is enabled with conditions in 13.11.1. Enabling the FRC; otherwise, it is not enabled. Power-on Reset sets NOSC[3:0] = 0000; therefore, it is always ON when powered-up. The oscillator module provides a 6-bit wide user tuning adjustment capability using the OSCTRM.TUN[5:0] bits. 13.11.1 Enabling the FRC The FRC oscillator is powered when OSCCON.NOSC[3:0] = 4b0000 or a Fail-safe clock monitor is enabled and a clock fail is detected, forcing a switch to FRC. It is also enabled whenever it gets requested by: ADC requesting for FRC, Configuring an SPLL2 source as FRC, PMU Controller requesting for FRC, Flash Controller requesting for FRC, Configuring LPCLK (32 KHz) source to FRC. 13.11.2 Frequency Tuning in User Mode In addition to the factory calibration, the base frequency can be tuned in the user's application. This frequency tuning capability allows the user to deviate from the factory calibrated frequency. The user can tune the frequency by writing to the OSCTRM register. The tuning range of the FRC oscillator is 1.5% of nominal in 3.75 kHz steps. 13.12 Secondary Oscillator The Secondary Oscillator (SOSC) is a low-power 32.768 kHz crystal oscillator that provides accurate time keeping. The Secondary Oscillator has the following features:
32.768 kHz operation Provides system clock output Provided to CRU or LPCLKGEN on request Can be disabled to reduce power Ultra-low power driver No calibration is required 13.13 Low Power RC Oscillator (LPRC) The Low Power Internal RC Oscillator (LPRC) operates at a nominal frequency of 32.768 kHz. Note:The LPRC is not a 50% duty cycle clock; however, it maintains an average frequency over a number of base clocks. The LPRC can be used as both a source for the system clock and a reference for Backup core modules. These modules include the Deep Sleep Watchdog (DSWDT), clock monitor circuits and other modules that require a 32 kHz reference clock. 13.14 Reference Clock Generator The Reference Clock Generator provides the Generic Clocks (GCLK_<Periperhal>) for system peripherals via Peripheral Channels. There are a total of 24 Peripheral Channels with the mapping as shown in following table. Table 13-1. Peripheral Clock Generation Peripheral Clock Pchannel Index GCLK_EIC, GCLK_CCL GCLK_FREQM_MSR GCLK_FREQM_REF GCLK_SERCOM0_CORE, GCLK_SERCOM1_CORE GCLK_SERCOM2_CORE, GCLK_SERCOM3_CORE 0 1 2 3 4 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 160 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU)
...........continued Peripheral Clock Pchannel Index GCLK_TC0 GCLK_TC1 GCLK_TC2, GCLK_TC3 GCLK_EVSYS_CH_0 GCLK_EVSYS_CH_1 GCLK_EVSYS_CH_2 GCLK_EVSYS_CH_3 GCLK_EVSYS_CH_4 GCLK_EVSYS_CH_5 GCLK_EVSYS_CH_6 GCLK_EVSYS_CH_7 GCLK_EVSYS_CH_8 GCLK_EVSYS_CH_9 GCLK_EVSYS_CH_10 GCLK_EVSYS_CH_11 GCLK_TCC0 GCLK_TCC1, GCLK_TCC2 GCLK_AC GCLK_CM4_TRACE 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 The mapping for the source of the clocks for both the CLKGEN generator and Reference clock generator are shown in following table. Table 13-2. CRU Clock Mapping clock_in[x]
MCS/COSC Mapping REFO/ROSEL Mapping FSCM Clock Source Clock to Switch to on a FSCM Fail 0 - FRC 1 - SPLL_CLK1 2 - POSC (16 MHz) 3- SOSC 4 - LPRC 0000 0001 0010 0011 0100 5 - SPLL_CLK3 (RFPLL, 96 MHz) 6 - PB1_CLK 7 - SYS_CLK 8 - REFI Pin 0000 0001 0010 0011 0100 0101 0110 0111 1000 X X 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 161 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.15 CRU Configuration Registers The BASE address of the CRU registers is 0x4400_0A00. The Register Summary table shows the mapping of the registers in memory as well as the details of the bit fields in each register. Each register has an associated SET/CLR/INV function register with the suffix appended to the register name, for example: <reg>SET, <reg>CLR,
<reg>INV. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 162 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.16 Register Summary Offset Name Bit Pos. 7 6 5 0x00 OSCCON 0x04 OSCTRM 0x08 SPLLCON 0x0C RCON 0x10 RSWRST 0x14 RNMICON 0x18
... 0x1B Reserved 0x1C REFO1CON 0x20 REFO1TRIM 0x24 REFO2CON 0x28 REFO2TRIM 0x2C REFO3CON 0x30 REFO3TRIM 0x34 REFO4CON 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 CLKLOCK DRMEN 2SPDSLP COSC[3:0]
4 SLPEN 3 CF 2 1 0 SOSCEN OSWEN NOSC[3:0]
TUN[5:0]
FRCDIV[2:0]
SPLLRST SPLLFLOCK SPLLPWDN SPLL1POSTDIV1[7:0]
SPLL_BYP[1:0]
EXTR SWR DMTO WDTO SLEEP SPLL2POSTDIV2[3:0]
IDLE DPSLP BOR CMR POR VBAT POR_IO POR_CORE BCFGERR BCFGFAIL NVMLTA NVMEOL SWRST SWNMI EXT PLVD CF DMTO WDTS WDTR NMICNT[7:0]
NMICNT[15:8]
ON FRZ SIDL OE RSLP RODIV7 RODIV6 RODIV5 RODIV4 RODIV3 RODIV2 RODIV14 RODIV13 RODIV12 RODIV11 RODIV10 DIVSW_EN RODIV1 RODIV9 ACTIVE RODIV0 RODIV8 ROSEL3 ROSEL2 ROSEL1 ROSEL0 ROTRIM0 ROTRIM8 ROTRIM7 ROTRIM6 ROTRIM5 ROTRIM4 ROTRIM3 ROTRIM2 ROTRIM1 ON FRZ SIDL OE RSLP RODIV7 RODIV6 RODIV5 RODIV4 RODIV3 RODIV2 RODIV14 RODIV13 RODIV12 RODIV11 RODIV10 DIVSW_EN RODIV1 RODIV9 ACTIVE RODIV0 RODIV8 ROSEL3 ROSEL2 ROSEL1 ROSEL0 ROTRIM0 ROTRIM8 ROTRIM7 ROTRIM6 ROTRIM5 ROTRIM4 ROTRIM3 ROTRIM2 ROTRIM1 ON FRZ SIDL OE RSLP RODIV7 RODIV6 RODIV5 RODIV4 RODIV3 RODIV2 RODIV14 RODIV13 RODIV12 RODIV11 RODIV10 DIVSW_EN RODIV1 RODIV9 ACTIVE RODIV0 RODIV8 ROSEL3 ROSEL2 ROSEL1 ROSEL0 ROTRIM0 ROTRIM8 ROTRIM7 ROTRIM6 ROTRIM5 ON FRZ SIDL OE ROTRIM4 ROSEL3 RSLP ROTRIM3 ROSEL2 RODIV7 RODIV6 RODIV5 RODIV4 RODIV3 RODIV2 RODIV14 RODIV13 RODIV12 RODIV11 RODIV10 ROTRIM2 ROSEL1 DIVSW_EN RODIV1 RODIV9 ROTRIM1 ROSEL0 ACTIVE RODIV0 RODIV8 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 163 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x38 REFO4TRIM 0x3C REFO5CON 0x40 REFO5TRIM 0x44 REFO6CON 0x48 REFO6TRIM 0x4C PB1DIV 0x50 PB2DIV 0x54 PB3DIV 0x58 SLEWCON 0x5C CLKSTAT 0x60
... 0x63 Reserved 0x64 CLK_DIAG 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 ROTRIM0 ROTRIM8 ROTRIM7 ROTRIM6 ROTRIM5 ROTRIM4 ROTRIM3 ROTRIM2 ROTRIM1 ON FRZ SIDL OE RSLP RODIV7 RODIV6 RODIV5 RODIV4 RODIV3 RODIV2 RODIV14 RODIV13 RODIV12 RODIV11 RODIV10 DIVSW_EN RODIV1 RODIV9 ACTIVE RODIV0 RODIV8 ROSEL3 ROSEL2 ROSEL1 ROSEL0 ROTRIM0 ROTRIM8 ROTRIM7 ROTRIM6 ROTRIM5 ROTRIM4 ROTRIM3 ROTRIM2 ROTRIM1 ON FRZ SIDL OE RSLP RODIV7 RODIV6 RODIV5 RODIV4 RODIV3 RODIV2 RODIV14 RODIV13 RODIV12 RODIV11 RODIV10 DIVSW_EN RODIV1 RODIV9 ACTIVE RODIV0 RODIV8 ROSEL3 ROSEL2 ROSEL1 ROSEL0 ROTRIM0 ROTRIM8 ROTRIM7 ROTRIM6 ROTRIM5 ROTRIM4 ROTRIM3 ROTRIM2 ROTRIM1 PB1DIVON PB1DIVON PB1DIVON PB1DIV[6:0]
PB1DIVRDY PB1DIV[6:0]
PB1DIVRDY PB1DIV[6:0]
PB1DIVRDY SPLL3RDY LPRCRDY SOSCRDY POSCRDY SPLL1RDY FRCRDY SLW_UP SLW_DN SLW_BUSY SLW_DIV[2:0]
SYS_DIV[3:0]
SLW_DELAY[3:0]
SPLL3_STOP SPLL2_STOP SPLL1_STOP LPRC_STOP FRC_STOP SOSC_STOP POSC_STOP NMICTR7 NMICTR6 NMICTR5 NMICTR4 NMICTR3 NMICTR2 NMICTR1 NMICTR0 NMICTR15 NMICTR14 NMICTR13 NMICTR12 NMICTR11 NMICTR10 NMICTR9 NMICTR8 13.17 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description. Some registers are synchronized when read and/or written. Synchronization is denoted by the Write-Synchronized or the Read-Synchronized property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 164 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable protection is denoted by the Enable-Protected property in each individual register description. Note:All registers in this table have corresponding CLR, SET and INV registers at its virtual address, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET, and INV Registers from Related Links. Related Links 6.1.9. CLR, SET and INV Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 165 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.17.1 CRU Oscillator Control Name:
Offset:
Reset:
OSCCON 0x00 0x00000000 Note:The system unlock sequence must be done before this register can be written. Bit 31 30 29 28 27 26 25 FRCDIV[2:0]
R/W/L 0 24 R/W/L 0 R/W/L 0 20 19 18 17 16 12 R 0 4 SLPEN R/W/L 0 11 10 9 8 NOSC[3:0]
R/W/L 0 2 R/W/L 0 3 CF R/W/HS/L 0 R/W/L 0 R/W/L 0 1 SOSCEN R/W/L 1 0 OSWEN R/W/HC/L 1 Access Reset Bit Access Reset 23 DRMEN R/W/L 0 Bit 15 Access Reset Bit R 0 7 CLKLOCK Access Reset R/W/L 0 22 14 R 0 6 21 2SPDSLP R/W/L 1 COSC[3:0]
13 R 0 5 Bits 26:24 FRCDIV[2:0]Fast RC Clock Divider bits Value 000 001 010 011 100 101 110 111 Description FRC Divide by 1 (default value) FRC Divide by 2 FRC Divide by 4 FRC Divide by 8 FRC Divide by 16 FRC Divide by 32 FRC Divide by 64 FRC Divide by 256 Bit 23 DRMENEnable the Dream Mode bit Value 1 0 Description When the cpu has executed WFI instruction and SLPEN = 1, peripheral clock requests are NOT active causes to enter the Sleep mode DMA transfer has no effect Bit 21 2SPDSLP2-Speed Start-up enabled in the Sleep mode bit Note:Default Reset Value is specified by cfg_two_speed_startup_en input. Value 1 0 Description When the device exits the Sleep Mode, the SYS_CLK will be from FRC until the selected clock is ready When the device exits the Sleep Mode, the SYS_CLK will be from the selected clock 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 166 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Bits 15:12 COSC[3:0]Current Oscillator Selection bits (Read-only) Notes:
The default value on Reset is 4b0000, which ensures that a virgin die has frc_clk running for ICDJTAG or EJTAG to program the NVR. Loaded with NOSC[3:0] at the completion of a successful clock switch. Set to FRC value (0000) when FSCM detects a failure and switches clock to FRC. Value 0000 0001 0010 0011 0100 0101-111 1 Description Fast RC Oscillator (FRC) divided by OSCCON.FRCDIV System PLL Clock-1 (SPLL1 Module) (input clock and divider set by SPLLCON) Primary Oscillator (POSC) Secondary Oscillator (SOSC) Low Power RC Oscillator (LPRC) Reserved for future use Bits 11:8 NOSC[3:0]New Oscillator Selection bits Note:Default value on Reset is 4b0000, which ensures that a virgin die has frc_clk running for ICDJTAG or EJTAG to program the NVR. Value 0000 0001 0010 0011 0100 0101-111 1 Description Fast RC Oscillator (FRC) divided by OSCCON.FRCDIV System PLL Clock-1 (SPLL1 Module) (input clock and divider set by SPLLCON) Primary Oscillator (POSC) Secondary Oscillator (SOSC) Low Power RC Oscillator (LPRC) Reserved for future use Bit 7 CLKLOCKClock Lock Enabled bit Notes:
Once set, this bit can only be cleared via a Device Reset. When active, this bit prevents writes to the following registers: NOSC[3:0] and OSWEN. Value 1 Description All clock and PLL configuration registers are locked. 0 These include OSCCON, OSCTRIM, SPLLCON, UPLLCON, PBxDIV Clock and PLL selection registers are not locked, configurations may be modified. Bit 4 SLPENEnable the Sleep Mode bit Value 1 0 Description When a WAIT Instruction is executed device will enter SLEEP Mode When a WAIT instruction is executed device will enter IDLE Mode Bit 3 CFClock Fail Detect bit (Read/writable/Clearable by application) Notes:
Writing a 1 to this bit will cause a clock switching sequence to be initiated by the clock switch state machine Resets when a valid clock switching sequence is initiated by the clock switch state machine This bit is set when clock fail event is detected Value 1 0 Description FSCM has detected clock failure FSCM has not detected clock failure Bit 1 SOSCEN32 kHz Secondary (LP) Oscillator Enable bit Description Enable Secondary Oscillator Value 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 167 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Value 0 Description Disable Secondary Oscillator Bit 0 OSWENOscillator Switch Enable bit Notes:
A Write of value 0 has no effect. Cleared by hardware after a successful clock switch Cleared by hardware after a redundant clock switch (NOSC = COSC) Cleared by hardware after FSCM switches the oscillator to Fail-Safe Clock Source (FRC) Value 1 0 Description Request oscillator switch to selection specified by NOSC[3:0] bits Oscillator switch is complete 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 168 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.17.2 CRU Oscillator Trimming Name:
Offset:
Reset:
OSCTRM 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 9 1 8 0 Access Reset R/W/L 0 R/W/L 0 TUN[5:0]
R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 Bits 5:0 TUN[5:0]Internal Fast RC (FRC) Oscillator Tuning bits This bit field specifies the user-tuning capability for the internal fast RC oscillator. Note:The system unlock sequence must be done before this register can be written. Value 011111 011110
... 000001 000000 111111 111110
... 100001 100000 Description Maximum Frequency Center Frequency, oscillator is running at calibrated frequency Minimum Frequency 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 169 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.17.3 SPLL (RFPLL/Wrapper) Control Name:
Offset:
Reset:
SPLLCON 0x08 0x00000000 Note:The system unlock sequence must be done before these registers can be written. Bit 31 30 29 28 27 26 25 24 SPLL_BYP[1:0]
Access Reset R/W/L 1 R/W/L 1 Bit 23 22 21 20 19 18 17 16 Access Reset R/W/L 0 SPLL2POSTDIV2[3:0]
R/W/L R/W/L 0 0 R/W/L 1 Bit 15 14 13 12 11 10 9 8 Access Reset R/W/L 0 R/W/L 0 R/W/L 0 SPLL1POSTDIV1[7:0]
R/W/L R/W/L 0 0 Bit 7 6 Access Reset 5 SPLLRST R/W/L 1 4 SPLLFLOCK R/W/L 0 3 SPLLPWDN R/W/L 1 R/W/L 0 R/W/L 0 R/W/L 0 2 1 0 Bits 31:30 SPLL_BYP[1:0]SPLL Bypass; when this bit is set, the input clock REF bypasses PLL to PLLOUTx. Notes:
Dictates clock source for ADC CP (Analog-to-Digital Converter Charge Pump) (SPLL2) Clock generation only Clock source must be preselected and kept ready before the need of ADC CP arrives. Failure to do so will result in the loss of clock for one or two cycles when ADC CP is enabled. Value 00 x1 10 Description RFPLL Clock is the clock source for ADC CP clock generation. FRC is used as clock source for ADC CP clock generation. POSC is used as clock source for ADC CP clock generation. Bits 19:16 SPLL2POSTDIV2[3:0]ADC-CP Post Divide Value Value 1 SPLLPOST DIV2 15 0 Description Divide-by SPLLPOSTDIV2 No Clock; Clock disabled Bits 15:8 SPLL1POSTDIV1[7:0]First Post Divide Value Description Divide-by SPLLPOSTDIV Value 2 SPLLPOST DIV 255 0 1 Divide-by 1 Divide-by 1.5 Bit 5 SPLLRSTSystem PLL Reset 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 170 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Value 1 0 Description Assert the Reset to the SPLL De-assert the Reset to the SPLL Bit 4 SPLLFLOCKSystem PLL Force Lock Value 1 0 Description Force the SPLL lock signal to be asserted Do not force the SPLL lock signal to be asserted Bit 3 SPLLPWDNPLL Power Down Register bit Value 1 0 Description PLL is powered down PLL is active 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 171 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.17.4 Reference Oscillator x Control REFOxCON 0x1C + (x-1)*0x08 [x=1..6]
0x00000000 Name:
Offset:
Reset:
Notes:
REFOCON.ROSEL must not be written while the REFOCON.ACTIVE bit is 1 This will result in undefined behavior. REFOCON must not be written when REFOCON[ON] != REFOCON[ACTIVE] This will result in undefined behavior. This register can always be accessed regardless of the cfg_sys_unlock value. Bit 31 Access Reset Bit Access Reset Bit Access Reset 23 RODIV7 R/W 0 15 ON R/W 0 Bit 7 Access Reset 30 RODIV14 R/W 0 22 RODIV6 R/W 0 14 FRZ R/W 0 6 29 RODIV13 R/W 0 21 RODIV5 R/W 0 13 SIDL R/W 0 5 28 RODIV12 R/W 0 20 RODIV4 R/W 0 12 OE R/W 0 4 27 RODIV11 R/W 0 19 RODIV3 R/W 0 11 RSLP R/W 0 3 ROSEL3 R/W 0 26 RODIV10 R/W 0 18 RODIV2 R/W 0 10 25 RODIV9 R/W 0 17 RODIV1 R/W 0 24 RODIV8 R/W 0 16 RODIV0 R/W 0 9 DIVSW_EN HC/ R/W 0 8 ACTIVE HS/HC/ R 0 2 ROSEL2 R/W 0 1 ROSEL1 R/W 0 0 ROSEL0 R/W 0 Bits 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 RODIVReference Clock Divider bits Specifies 1/2 period of reference clock in the source clocks. Example: Period of refo_clk = [Reference source * 2] * RODIV Value Description 111111111111111 111111111111110
... .. .. 000000000000011 000000000000010 000000000000001 000000000000000 REFOx clock is Base clock frequency divided by 65,534 (32,767 *2) REFOx clock is Base clock frequency divided by 65,532 (32,766 * 2) REFOx clock is Base clock frequency divided by 6 (3*2) REFOx clock is Base clock frequency divided by 4 (2*2) REFOx clock is Base clock frequency divided by 2 (1*2) REFOx clock is same frequency as Base clock (no divider) Bit 15 ONOutput Enable bit Value 1 0 Description Reference Oscillator Module is enabled Reference Oscillator Module is disabled Bit 14 FRZFreeze in Debug mode bit Value 1 Description When the emulator is in the Debug mode, module freezes operation 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 172 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Value 0 Description When the emulator is in the Debug mode, module continues operation Bit 13 SIDLPeripheral Stop in Idle Mode bit Value 1 0 Description Discontinues module operation when device enters the Idle mode Continues module operation in the Idle mode Bit 12 OEReference Clock Output Enable bit Value 1 0 Description Reference clock is driven out on REFOx pin Reference clock is not driven out on REFOx pin Bit 11 RSLPReference Oscillator Run in Sleep bit Note:This bit is ignored when ROSEL[3:0] = (0000 or 0001). Value 1 0 Description Reference Oscillator output continues to run in the Sleep mode Reference Oscillator output is disabled in the Sleep mode Bit 9 DIVSW_ENClock RODIV/ROTRIM switch enabled Description Clock Divider Switching is currently in progress Clock Divider Switch has completed Value 1 0 Bit 8 ACTIVEReference Clock Request Status bit Value 1 0 Description Reference clock request is active (User must not update this REFOCON register) Reference clock request is not active (User can update this REFOCON register) Bits 0, 1, 2, 3 ROSELReference Clock Source Select bits Description Reserved Select one of various clock sources to be used as the reference clock. Value 1001-111 1 1000 0111 0110 0101 0100 0011 0010 0001 0000 REFI pin System clock (reference clock reflects any device clock switching) Peripheral clock (reference clock reflects any peripheral clock switching) System PLL (Clock-3) LPRC SOSC POSC System PLL (Clock-1) FRC 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 173 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.17.5 Reference Oscillator x Trim REFOxTRIM 0x20 + (x-1)*0x08 [x=1..6]
0x00000000 Name:
Offset:
Reset:
Notes:
REFOxTRIM must not be written when REFOxCON[ON] != REFOxCON[ACTIVE] This will result in undefined behavior. This register can always be accessed regardless of the cfg_sys_unlock value. Bit 31 ROTRIM8 Access Reset R/W 0 30 ROTRIM7 R/W 0 29 ROTRIM6 R/W 0 28 ROTRIM5 R/W 0 27 ROTRIM4 R/W 0 26 ROTRIM3 R/W 0 25 ROTRIM2 R/W 0 24 ROTRIM1 R/W 0 Bit 23 ROTRIM0 Access Reset R/W 0 22 21 20 19 18 17 16 Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 Bits 23, 24, 25, 26, 27, 28, 29, 30, 31 ROTRIMTrim bits Provides fractional additive to RODIV value for 1/2 period of REFOx clock Note:ROTRIM values greater than zero are only valid when RODIV values are greater than 0. Value 0000_0000_0 0000_0000_1 0000_0001_0
... .. 100000000
... .. 1111_1111_0 1111_1111_1 Description 0/512 (0.0) divisor added to RODIV value 1/512 (0.001953125) divisor added to RODIV value 2/512 (0.00390625) divisor added to RODIV value
... .. 256/512 (0.5000) divisor added to RODIV value
... .. 510/512 (0.99609375) divisor added to RODIV value 511/512 (0.998046875) divisor added to RODIV value 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 174 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.17.6 PBx Clock Divisor Control Name:
Offset:
Reset:
PBxDIV 0x4C + (x-1)*0x04 [x=1..3]
0x00000000 Note:The system unlock sequence must be done before this register can be written. PBx registers include PB1DIV, PB2DIV and PB3DIV. Ensure the PB3DIV[6:0] value is equal to 0x09 or greater if the user is not using Microchip-
provided boot code. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 PB1DIVON R 1 7 Access Reset Bit Access Reset 6 R/W 0 5 R/W 0 4 R/W 0 11 PB1DIVRDY R 1 3 PB1DIV[6:0]
R/W 0 10 2 R/W 0 9 1 8 0 R/W 0 R/W 1 Bit 15 PB1DIVONOutput Enable bit Value 1 0 Description PB1 Output clock is enabled PB1 Output clock is disabled Note:PB1DIV[PB1DIVON] bit cannot be written to a 0, as this clock is used by the system CLK_RST macro. Bit 11 PB1DIVRDYPB1 Peripheral Clock Divisor Ready Description Indicates the PB clock divisor logic is not switching divisors and the PB1DIV may be written. Indicates the PB clock divisor logic is currently switching values and the PB1DIV cannot be written. Value 1 0 Bits 6:0 PB1DIV[6:0]PB1 Peripheral Clock Divisor Control value Description Value 000_0000 Divide by 1 PB1 Clock same frequency as SYS_CLK 000_0001 Divide by 2 PB1 Clock is 1/2 of SYS_CLK 000_0010 Divide by 3 PB1 Clock is 1/3 of SYS_CLK 000_0011 Divide by 4 PB1 Clock is 1/4 of SYS_CLK
... .. 000_1111 Divide by 16 PB1 Clock is 1/16 of SYS_CLK 001_0000 Divide by 17 PB1 Clock is 1/17 of SYS_CLK
... .. 111_1110 Divide by 127 PB1 Clock is 1/127 of SYS_CLK 111_1111 Divide by 128 PB1 Clock is 1/128 of SYS_CLK
... .. .. .. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 175 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.17.7 Slew Rate Control for Clock Switching SLEWCON 0x58 0x00000000 Name:
Offset:
Reset:
Notes:
The system unlock sequence must be done before this register can be written. Updates to this register do not take effect until OSCCON[OSWEN] is set. Bit 31 30 29 28 Access Reset Bit 23 22 21 20 Access Reset Bit 15 14 13 12 Access Reset 27 R/W c 19 R/W c 11 Bit 7 6 5 4 3 Access Reset 26 25 SLW_DELAY[3:0]
R/W c 18 R/W c 17 SYS_DIV[3:0]
R/W c 10 R/W c R/W c 9 SLW_DIV[2:0]
R/W c 2 SLW_UP R/W c 1 SLW_DN R/W c 24 R/W c 16 R/W c 8 R/W c 0 SLW_BUSY R/W c Bits 27:24 SLW_DELAY[3:0]Number of clocks generated at each slew step for a clock switch Note:The reset value of this register field is defined by the input cfg_slewcon_sel[]. Value 0000 0001
... 1111 Description 1 clock will be generated at each slew step 2 clocks will be generated at each slew step
... 16 clocks will be generated at each slew step Bits 19:16 SYS_DIV[3:0]PBx Peripheral Clock Divisor Control value Value 0000 0001 0010
... 1111 Description Divide by 1 SYS_CLK_OUT same frequency as SYS_CLK source - Default Divide by 2 SYS_CLK_OUT is 1/2 of SYS_CLK source Divide by 3 SYS_CLK_OUT is 1/3 of SYS_CLK source
... Divide by 16 SYS_CLK_OUT is 1/16 of SYS_CLK source Bits 10:8 SLW_DIV[2:0]Divisor steps used when doing slewed clock switches Note:Each Divisor step lasts four clocks Value 000 001 010 011 100
... Description No divisor is used Divide by 2 (21), then no divisor Divide by 4 (22), then by 2, then no divisor Divide by 8 (23), then by 4, then by 2, then no divisor Divide by 16 (24), then by 8, then by 4, then by 2, then no divisor
... 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 176 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Value 111 Description Divide by 128 (27), then by 64, then by 32, then by 16, then by 8, then by 4, then by 2, then no divisor Bit 2 SLW_UPClock slew enable for switching up to faster clocks Value 0 1 Description Clock Slewing is disabled Clock Slewing is enabled on a clock switch OR exit from Sleep Bit 1 SLW_DNClock slew enable for switching down to slower clocks Value 0 1 Description Clock Slewing is disabled Clock Slewing is enabled on a clock switch Bit 0 SLW_BUSYClock Switch Slewing Active Status Bit Read-Only Value 0 1 Description Clock Switch has reached its final value Clock frequency is being actively Slewed 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 177 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.17.8 Clock Status Name:
Offset:
Reset:
CLKSTAT 0x5C 0x00000000 Note:The corresponding RDY bits are updated only after the clock switch request is initiated via OSCCON.NOSC[3:0]. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 Access Reset 5 6 SPLL3RDY R/HS/HC 0 4 LPRCRDY R/HS/HC 0 3 SOSCRDY R/HS/HC 0 2 POSCRDY R/HS/HC 0 1 SPLL1RDY R/HS/HC 0 0 FRCRDY R/HS/HC 0 Bit 6 SPLL3RDYSystem PLL (Clock-3) Ready Status value Description SPLL3 is stable and ready SPLL3 is not stable and not ready Value 1 0 Bit 4 LPRCRDYLPRC Ready Status value Value 1 0 Description LPRC is stable and ready LPRC is not stable and not ready Bit 3 SOSCRDYSOSC Ready Status value Value 1 0 Description SOSC is stable and ready SOSC is not stable and not ready Bit 2 POSCRDYPrimary Oscillator Ready Status value Value 1 0 Description POSC is stable and ready POSC is not stable and not ready Bit 1 SPLL1RDYSystem PLL (Clock-1) Ready Status value Description SPLL1 is stable and ready SPLL1 is not stable and not ready Value 1 0 Bit 0 FRCRDYFRC Ready Status value Value 1 Description FRC is stable and ready 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 178 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Value 0 Description FRC is not stable and not ready 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 179 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.17.9 User Clock Diagnostics Control Name:
Offset:
Reset:
CLK_DIAG 0x64 0x00000000 Note:The system unlock sequence must be done before this register can be written. Bit 31 NMICTR15 Access Reset R 0 30 NMICTR14 R 0 29 NMICTR13 R 0 28 NMICTR12 R 0 Bit Access Reset 23 NMICTR7 R 0 22 NMICTR6 R 0 21 NMICTR5 R 0 20 NMICTR4 R 0 27 NMICTR11 R 0 19 NMICTR3 R 0 26 NMICTR10 R 0 18 NMICTR2 R 0 25 NMICTR9 R 0 17 NMICTR1 R 0 24 NMICTR8 R 0 16 NMICTR0 R 0 Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 Access Reset SPLL3_STOP SPLL2_STOP SPLL1_STOP LPRC_STOP R/W 0 R/W 0 R/W 0 R/W 0 2 FRC_STOP R/W 0 9 1 8 0 SOSC_STOP POSC_STOP R/W 0 R/W 0 Bits 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 NMICTRInternal value of internal NMI Counter This field reflects the actual value of the internal NMI counter Bit 6 SPLL3_STOPSPLL Clock Stop Control value Note:Gating logic is outside of this macro Value 0 1 Description SPLL3 clock source runs as normal SPLL3 clock source is stopped Bit 5 SPLL2_STOPSPLL Clock Stop Control value Note:Gating logic is outside of this macro Value 0 1 Description SPLL2 clock source runs as normal SPLL2 clock source is stopped Bit 4 SPLL1_STOPSPLL Clock Stop Control value Note:Gating logic is outside of this macro Value 0 1 Description SPLL1 clock source runs as normal SPLL1 clock source is stopped Bit 3 LPRC_STOPLPRC Clock Stop Control value Note:Gating logic is outside of this macro Value 0 1 Description LPRC clock source runs as normal LPRC clock source is stopped 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 180 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Bit 2 FRC_STOPFRC Clock Stop Control value Note:Gating logic is outside of this macro Value 0 1 Description FRC clock source runs as normal FRC clock source is stopped Bit 1 SOSC_STOPSOSC Clock Stop Control value Note:Gating logic is outside of this macro Value 0 1 Description SOSC clock source runs as normal SOSC clock source is stopped Bit 0 POSC_STOPPOSC Clock Stop Control value Note:Gating logic is outside of this macro Value 0 1 Description POSC clock source runs as normal POSC clock source is stopped 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 181 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.18 Resets The Reset module combines all Reset sources and controls the device Master Reset signal, SYSRST. The device Reset sources are as follows:
Power-on Reset (Vdd, IO, or POR) Brown-out Reset (BOR/ZPBOR) Master Clear Reset (MCLR) Watchdog Timer Reset (NMI Counter) Dead Man Timer Reset (NMI Counter) Software Reset (SWR) Test mode Entry and Exit Configuration Mismatch Reset (CMR) JTAG Reset A simplified block diagram of the Reset module is shown in the following figure. Any active source of reset will make the system Reset signal active. Many registers associated with the CPU and peripherals are forced to a known Reset state. Figure 13-4. System Reset Block Diagram MCLR Sleep or Idle WDT Time-out DMT Time-out Voltage regulator enabled VDD VDD Rise Detect NMI Time-out Power-up Timer Brown-out Reset Configuration Mismatch Reset Software Reset 13.18.1 Control Registers Glitch Filter MCLR DMTR/WDTR POR BOR CMR SWR SYSRST Most types of device resets will set corresponding Status bits in the RCON register to indicate the type of Reset
(see RCON register from Related Links). The one exception is the Non-maskable Interrupt (NMI) time-out Reset. A Power-on Reset (POR) will clear all bits, except for the BOR and POR bits (RCON[1:0]), which are set. The user software may set or clear any of the bits at any time during code execution. The RCON bits serve only as Status bits. Setting a Reset status bit in software will not cause a system Reset to occur. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 182 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) The RCON register also has other bits associated with the Watchdog Timer (WDT) and device power-saving states. For more information on the function of these bits, see Using the RCON Status Bits from Related Links. The RSWRST control register has only one bit, SWRST. This bit is used to force a software Reset condition. A delay equal to the duration of the number of NMICNT system clocks begins as it is decremented to zero. During this interval, the program can clear the WDT or DMT flag bits, if desired, to avoid a Reset. If the active flag is not cleared, the device will be reset at the end of the interval. The NMICNT value can be set to zero for no delay and up to 255 SYSCLK cycles. The NMI interrupt can also be triggered by setting the SWNMI bit in software or if the CF bit is set by the FSCM, but these do not begin the countdown and do not automatically lead to a reset. The Resets module consists of the following Special Function Registers (SFRs):
RCON: Reset Control Register RSWRST: Software Reset Register RNMICON: Non-Maskable Interrupt (NMI) Control Register The base address of these registers is 0x4400_0A00. The offset for each register is shown in Reset Regsiter Map
(see Reset Register Map in the Reset Control Registers from Related Links). Multiply the address offset in the table by 4. The other three addresses represent the CLR/SET/INV bitwise registers. Related Links 13.18.2.1. RCON 13.18.3. Reset Control Registers 13.18.5.3. Using the RCON Status Bits 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 183 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.18.2 Reset Register Summary The following registers provide a brief summary of the Reset Control registers. Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00
... 0x0B Reserved 0x0C RCON 0x10 RSWRST 0x14 RNMICON 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 EXTR SWR DMTO WDTO SLEEP IDLE DPSLP BOR CMR POR VBAT POR_IO POR_CORE BCFGERR BCFGFAIL NVMLTA NVMEOL SWRST SWNMI EXT PLVD CF DMTO WDTS WDTR NMICNT[7:0]
NMICNT[15:8]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 184 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.18.2.1 Reset Control Register Name:
Offset:
Reset:
Property:
RCON 0xC 0x00000000
Bit Access Reset 31 POR_IO R/W/HS 0 30 POR_CORE R/W/HS 0 29 28 27 BCFGERR R/W/HS 0 26 BCFGFAIL R/W/HS 0 25 NVMLTA R/W/HS 0 Bit 23 22 21 20 19 18 17 Access Reset Bit 15 14 13 12 11 Access Reset Bit Access Reset 7 EXTR R/W/HS 0 6 SWR R/W/HS 0 5 DMTO R/W/HS 0 4 WDTO R/W/HS 0 3 SLEEP R/W/HS 0 10 DPSLP R/W/HS 0 2 IDLE R/W/HS 0 9 CMR R/W/HS 0 1 BOR R/W/HS 0 24 NVMEOL R/W/HS 0 16 VBAT R/W/HS 0 8 0 POR R/W/HS 0 Bit 31 POR_IOI/O Voltage POR Flag bit Set by hardware at detection of an I/O POR event. User software must clear this bit to view next detection. Note:User may write this bit to 1. Does not cause a POR_IO. Value 1 0 Description A Power-on Reset has occurred due to I/O voltage A Power-on Reset has not occurred due to I/O voltage Bit 30 POR_CORECore Voltage POR Flag bit Set by hardware at detection of a core POR event. User software must clear this bit to view the next detection. Note:User may write this bit to 1. Does not cause a POR_CORE. Value 1 0 Description A Power-on Reset has occurred due to I/O voltage A Power-on Reset has not occurred due to I/O voltage Bit 27 BCFGERRBCFG Error Flag bit A primary BCFG value had an error, but the secondary BCFG value was valid and used. Value 1 0 Description A BCFG error has occurred A BCFG error has not occurred Bit 26 BCFGFAILBCFG Failure Flag bit Both the Primary and Secondary BCFG values had an unrecoverable error. Default values are in effect. Value 1 0 Description A BCFG error has occurred A BCFG error has not occurred Bit 25 NVMLTANVM Life Time Alert Flag bit NVM Life Time Alert Due to charge leakage, the NVM is nearing EOL. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 185 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Value 1 0 Description A NVM LTA error has occurred A NVM LTA error has not occurred Bit 24 NVMEOLNVM End of Life Flag bit NVM End of Life may not be visible to user, because the part will not come out of Reset if the bit is asserted. Value 1 0 Description A NVM EOL failure has occurred A NVM EOL failure has not occurred Bit 16 VBATVBAT Mode Flag bit Description A POR exit from VBAT has occurred. A true POR must be established with the valid VBAT voltage level on the VBAT pin. A POR exit from VBAT has not occurred. Value 1 0 Bit 10 DPSLPDeep Sleep Mode Flag bit Set by hardware at time of entry into Deep Sleep mode. User software must clear this bit to view next detection. Value 1 0 Description Deep Sleep mode has occurred Deep Sleep mode has not occurred Bit 9 CMRConfiguration Mismatch Reset Flag bit Note:User may write this bit to 1. Does not cause a Mismatch Reset. Value 1 0 Description A CMR event has occurred A CMR event has not occurred Bit 7 EXTRExternal Reset (MCLR) Status bit Note:User may write this bit to 1. Does not cause a (MCLR). Value 1 0 Description A Master Clear (pin) Reset has occurred A Master Clear (pin) Reset not occurred Bit 6 SWRSoftware Reset Flag bit Note:User may write this bit to 1. Does not cause SWR. Value 1 0 Description A SWR has occurred A SWR not occurred Bit 5 DMTODeadman Timer Time-out Flag bit Note:User may write this bit to 1. Does not cause DMT Reset. Value 1 0 Description DMT Time-out has occurred and caused a Reset DMT Time-out has not occurred Bit 4 WDTOWatchdog Timer Time-out Flag bit Note:User may write this bit to 1. Does not cause WDT Reset. Value 1 0 Description WDT Time-out has occurred and caused a Reset WDT Time-out has not occurred Bit 3 SLEEPWake from Sleep Flag bit Note:User may write this bit to 1. Does not invoke Sleep mode. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 186 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Value 1 0 Description Device has been in Sleep mode Device has not been in Sleep mode Bit 2 IDLEWake from Idle Flag bit Note:User may write this bit to 1. Does not invoke Idle mode. Value 1 0 Description Device was in the Idle mode Device was not in the Idle mode Bit 1 BORBOR Flag bit Set by hardware at detection of a BOR event. User software must clear this bit to view next detection. Note:User may write this bit to 1. Does not cause a BOR. Value 1 0 Description A BOR has occurred A BOR has not occurred Bit 0 PORPOR Flag bit Set by hardware at detection of a POR event. User software must clear this bit to view next detection. Note:User may write this bit to 1. Does not cause a POR. Value 1 0 Description A Power-on Reset has occurred A Power-on Reset has not occurred 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 187 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.18.2.2 Software Reset Register Name:
Offset:
Reset:
Property:
RSWRST 0x10 0x00000000
Note:The system unlock sequence must be done before this register can be written. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 SWRST W/HC 0 Bit 0 SWRSTSoftware Reset Trigger bit 1 = Enable SWR event. A subsequent read of this register triggers the system Reset sequence. The system unlock sequence must be done before the bit can be written. This bit always reads a value of logic 0. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 188 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.18.2.3 NMI Control Register Name:
Offset:
Reset:
Property:
RNMICON 0x14 0x00000000
Note:The system unlock sequence must be done before this register can be written. Bit 31 30 29 28 27 26 Access Reset Bit Access Reset 23 SWNMI R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 22 21 20 19 EXT R/W 0 11 12 NMICNT[15:8]
R/W 0 4 R/W 0 3 NMICNT[7:0]
R/W 0 R/W 0 18 PLVD R/W 0 10 R/W 0 2 R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 25 DMTO R/W 0 17 CF R/W 0 9 R/W 0 1 R/W 0 24 WDTR R/W 0 16 WDTS R/W 0 8 R/W 0 0 R/W 0 Bit 25 DMTODeadman Timer Time-out Flag bit (This will cause a Reset when NMICNT expires.) Note:User may write this bit to 1. Causes a user-initiated DMT NMI event and NMICNT start. Value 1 0 Description DMT Time-out has occurred and caused a NMI DMT Time-out has not occurred Bit 24 WDTRWatchdog Timer Time-out in Run Flag bit Note:User may write this bit to 1. Causes a user-initiated WDT NMI event and NMICNT start. Value 1 0 Description WDT Time-out has occurred and caused an NMI (This may cause a Reset if NMICNT expires.) WDT Time-out has not occurred Bit 23 SWNMISoftware NMI Trigger bit Value 1 0 Description Writing a 1 to this bit will cause an NMI to be generated Writing a 0 to this bit will have no effect Bit 19 EXTExternal / Generic NMI Event bit Note:User may write this bit to 1. Causes a user-initiated EXT NMI event. Value 1 0 Description A general NMI event was detected and caused an NMI. Writing 0 to this bit will clear the NMI event A general NMI event was not detected Bit 18 PLVDProgrammable Low Voltage Detect Event bit Note:User may write this bit to 1. Causes a user-initiated PLVD NMI event. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 189 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Value 1 0 Description PLVD detected a low voltage condition and caused an NMI PLVD did not detect a low voltage condition Bit 17 CFClock Fail Detect bit (Read/Clear-able by application) Note:Writing a 1 to the CF bit will cause a user-initiated clock failure NMI event, but will not actually cause a clock switch. Value 1 0 Description FSCM detected clock failure and caused an NMI FSCM did not detect a clock failure Bit 16 WDTSWatch-Dog Timer Time-out in Sleep Flag bit Note:User may write this bit to 1. Causes a user-initiated WDT NMI event. Value 1 0 Description WDT Time-out has occurred during Sleep mode and caused a wake-up from sleep WDT Time-out has not occurred during Sleep mode Bits 15:0 NMICNT[15:0]NMI Reset counter value bit This bit field specifies the reload value used by the NMI Reset counter. 0000_0000_0000_0000 = No delay between NMI assertion and device Reset event 0000_0000_0000_0001 0000_0000_0000_0010
................. ................ ................ 1111_1111_1111_1110 1111_1111_1111_1111 = Number of SYSCLK cycles that Software has to clear the NMI event before a device Reset is performed. If the NMI event is cleared before the counter reached zero, then NO device Reset is asserted. Note:When a WDT NMI event occurs (when not in the Sleep mode), the NMICNT starts incrementing from the zero NMICNT value. When a DMT NMI event is triggered, the NMICNT starts decrementing. When NMICNT reaches zero, the device is Reset. This NMI reset counter is only applicable to these two specific NMI events. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 190 a n d i t s i s u b s d a r i e s i i 2 0 2 3 M c r o c h p T e c h n o o g y i l I n c
. D r a f t A d v a n c e I n f o r m a t i o n D a t a S h e e t A
p a g e 1 9 1 13.18.3 Reset Control Registers Table 13-3. Reset Register Map rotatethispage90 r e t s i g e R e g n a R t i B Bits 31/15 30/14 29/13 28/12 27/11 26/10 25/9 24/8 23/7 22/6 21/5 20/4 19/3 18/2 17/1 16/0 s t e s e R l l A 0XC RCON 31:16 POR_IO POR_CORE 15:0 0X10 RSWRST 31:16 15:0 0X14 RNMICON 31:16 15:0 NMICNT[15:0]
DMTO WDTR SWNMI BCFGERR BCFGFAIL NVMLTA NVMEOL VBAT 0000 DPSLP CMR EXTR SWR DMTO WDTO SLEEP IDLE BOR POR 0000 0000 SWRST 0000 EXT PLVD CF WDTS 0000 0000 l C o c k a n d R e s e t U n i t
C R U
) I
P C 3 2 C X B Z 2 a n d W B Z 4 5 F a m i l y PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.18.4 Modes of Operation 13.18.4.1 System Reset (SYSRST) The internal System Reset (SYSRST) can be generated from multiple Reset sources, such as:
Power-on Reset (POR) Brown-out Reset (BOR/ZPBOR) Master Clear Reset (MCLR) Watchdog Time-out Reset (WDTO) Deadman Timer Reset (DMTR) Software Reset (SWR) Configuration Mismatch Reset (CMR) Test Mode Entry and Exit Reset JTAG Reset A system Reset is active at the first POR and asserted until device configuration settings are loaded and the oscillator clock sources become stable. The system Reset is then de-asserted, allowing the CPU to start fetching code after eight system clock cycles (SYSCLK). On any device Reset, no start-up time is required to transfer configuration values from the NVR memory into the configuration-holding registers. Once the device is active, the user may change the primary system clock source from FRC to SPLL by using the OSCCON register. 13.18.4.2 Power-on Reset (POR) A power-on event generates an internal POR pulse when a VDD rise is detected above VPOR. The device supply voltage characteristics must meet the specified starting voltage and rise rate requirements to generate the POR pulse. In particular, VDD must fall below VPOR before a new POR is initiated. For more information on the VPOR and VDD rise-rate specifications, see Electrical Characteristics from Related Links. This device has an on-chip internal voltage regulator and its power-on delay is designated as TPU. For more information on the TPU specification, see Electrical Characteristics from Related Links. At this point, the POR event has expired but the device Reset is still asserted while the device configuration settings are loaded and the clock oscillator sources are configured. The clock monitoring circuitry waits for the oscillator source to become stable. The clock source of this device when exiting from Reset is always FRC (NOSC[3:0] bits
(OSCCON[11:8]). After these delays expire, the system Reset, SYSRST, is de-asserted. Before allowing the CPU to start code execution, eight system clock cycles are required before the synchronized Reset to the CPU core is de-asserted. The power-on event sets the BOR and POR status bits (RCON[1:0]). For more information on the values of the delay parameters, see Electrical Characteristics from Related Links. Note:When the device exits the Reset condition (begins normal operation), the device operating parameters
(voltage, frequency, temperature and so on) must be within their operating ranges; otherwise, the device will not function correctly. The user software must ensure that the delay between the time power is first applied and the time the system Reset is released is adequate to get all the operating parameters within the specification. Related Links 43. Electrical Characteristics 13.18.4.3 Master Clear Reset Whenever the master clear pin (MCLR) is driven low, the Reset event is synchronized with the system clock, SYSCLK, before asserting the system Reset, SYSRST, provided the input pulse on MCLR is longer than a certain minimum width, as specified in the Electrical Specifications. The MCLR pin provides a filter to minimize the effects of noise and to avoid unwanted Reset events. The status bit, EXTR (RCON[7]), is set to indicate the MCLR Reset. The MCLR pin can be configured to generate a POR event, rather than a normal SYSRST event. This is configured through the SMCLR bit (CFGCON1[14]). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 192 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) 13.18.4.4 Software Reset (SWR) This device does not provide a specific RESET instruction; however, a hardware Reset can be performed in software (software Reset) by executing a software Reset command sequence. The software Reset acts like a MCLR Reset. The software Reset sequence requires the system unlock sequence to be executed before the SWRST bit
(RSWRST[0]) can be written. A software Reset is performed as follows:
1. Write the system unlock sequence. 2. Set the SWRST bit (RSWRST[0]) = 1. 3. Read the RSWRST register. Setting the SWRST bit (RSWRST[0]) will arm the software Reset. The subsequent read of the RSWRST register triggers the software Reset, which must occur on the next clock cycle following the read operation. To ensure no other user code is executed before the Reset event occurs, it is recommended that four NOP instructions or a while(1) statement be placed after the READ instruction. The SWR Status bit (RCON[6]) is set to indicate the software Reset. 13.18.4.5 Watchdog Timer Reset (WDTR) A Watchdog Timer (WDT) Reset event is synchronized with the system clock (SYSCLK) before asserting the system Reset. Note:A WDT time-out during the Sleep or Idle mode will wake-up the processor and branch to the reset vector, but it does not Reset the processor. The only bits affected are WDTO and SLEEP or IDLE in the RCON register. See Clock and Reset Unit (CRU) from Related Links for more information on the WDT Reset. Related Links 13. Clock and Reset Unit (CRU) 13.18.4.6 Brown-out Reset (BOR) This device has a simple Brown-out Reset (BOR) capability. If the voltage supplied to the regulator is inadequate to maintain a regulated level, the regulator Reset circuitry will generate a BOR event, which is synchronized with the system clock, SYSCLK, before asserting the system Reset. This event is captured by the BOR flag bit (RCON[1]), see Electrical Characteristics from Related Links. Related Links 43. Electrical Characteristics 13.18.4.7 Configuration Mismatch Reset (CMR) To maintain the integrity of the stored configuration values, all device Configuration bits are loaded and implemented as a complementary set of bits. As the Configuration Words are being loaded, for each bit loaded as 1, a complementary value of 0 is stored into its corresponding background word location and vice versa. The bit pairs are compared every time the Configuration Words are loaded, including in Standby Sleep mode. During this comparison, if the Configuration bit values are not found opposite to each other, a configuration mismatch event is generated, which causes a device Reset. If a device Reset occurs as a result of a configuration mismatch, the CMR Status bit (RCON[9]) is set. 13.18.4.8 Deadman Timer Reset (DMTR) A Deadman Timer (DMT) Reset is generated when the DMT count has expired. The primary function of the DMT is to Reset the processor in the event of a software malfunction. The DMT is a free-running instruction fetch timer, which is clocked whenever an instruction fetch occurs until a count match occurs. Instructions are not fetched when the processor is in the Sleep mode. The DMT consists of a 32-bit counter with a time-out count match value as specified by the DMTCNT[4:0] bits in the CFGCON2 Configuration register. A DMT is typically used in mission critical and safety critical applications, where any single failure of the software functionality and sequencing must be detected. For more information on the DMT reset, see Deadman Timer (DMT) from Related Links. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 193 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU) Related Links 17. Deadman Timer (DMT) 13.18.4.9 Non-maskable Interrupt (NMI) Timer The NMI timer provides a delay between DMT or WDT events and a device Reset. Set the delay in System Clock counts from 0 to 255 in the NMICNT[15:0] bits (RNMICON[15:0]). If these bits are set to zero, there will be no delay between the DMTO or WDTO flag and a device Reset. If set to a non-zero value, the NMI interrupt has that number of system clocks to clear flags or save data for debugging purposes. If the corresponding NMI flag is not cleared in RNMICON before the counter reaches zero, then a device Reset will be issued. If the corresponding NMI flag in RNMICON is cleared before the counter reaches zero, then the counter is stopped, then reloaded with the NMICNT value again and waits for another NMI event to occur. A device Reset will not be asserted in this case and software can to return from this interrupt. The DMTO flag will be set if there is a DMT event. The device will be Reset after the NMI counter expires. The WDTO flag will be set if there is a WDT event. The device will be Reset after the NMI counter expires. The WDTS flag will be set if there is a WDT event during the Sleep mode. The WDTS flag will trigger the NMI interrupt but will not start the NMI counter nor cause a Reset. The CF bit (RNMICON[17]) may be set by the Fail-Safe Clock Monitor (FSCM) if a clock failure is detected. The CF flag will trigger the NMI interrupt but will not start the timer nor cause a Reset. The SWNMI bit (RNMICON[23]) can be set in software to cause an NMI interrupt but will not start the NMI counter nor cause a Reset. 13.18.4.10 Determining the Source of Device Reset After a device Reset, the RCON register can be examined to confirm the source of the Reset. All reset status bits in the RCON register must be cleared after reading them to ensure the RCON value will provide meaningful results after the next device Reset. 13.18.5 Effects of Various Resets The Reset value for the Reset Control register, RCON, will depend on the type of device Reset, as indicated in the following table. Table 13-4. Status Bits, Their Significance and the Initialization Condition for RCON Register(1) Condition Program Counter R T X E R W S O T D W O T M D
) 2
P E E L S
) 2
E L D I R M C R O B R O P Power-on Reset or MCLR set as POR Brown-out Reset MCLR Reset during the Run mode MCLR Reset during the Idle mode MCLR Reset during the Sleep mode Software Reset command Configuration Word Mismatch Reset WDT Time-out Reset during the Run mode WDT Time-out Reset during the Idle mode WDT Time-out Reset during the Sleep mode DMT Time-out Reset 0 0 1 1 1 u u u u u u 0 0 u u u 1 u u u u u 0 0 u u u u u 1 1 1 u 0 0 u u u u u u u u 1 0 0 u u 1 u u u u 1 u 0 0 u 1 u u u u 1 u u 0 0 u u u u 1 u u u u 1 1 u u u u u u u u u 1 u u u u u u u u u u 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 194 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU)
...........continued Condition Program Counter R T X E R W S O T D W O T M D Interrupt Exit from the Idle mode Vector Interrupt Exit from the Sleep mode u u u u u u u u
) 2
P E E L S u 1 R M C R O B R O P
) 2
E L D I 1 u u u u u u u 1. Legends:
u = unchanged 2. The SLEEP or IDLE states are entered when the correct sequence plus WAIT instruction is executed. 13.18.5.1 Special Function Register (SFR) Reset States Most of the SFRs associated with the CPU and peripherals are reset to a particular value at a device Reset. This also applies to a WDT/DMT NMI condition, which is treated as a full device Reset by the CPU and peripherals. The Reset value for the Reset Control register, RCON, is depending on the type of device Reset, see Status Bits, Their Significance and Initialization Condition for RCON Register table in Effects of Various Resets from Related Links. Related Links 13.18.5. Effects of Various Resets 13.18.5.2 Configuration Word Register Reset States All Reset conditions force the configuration settings to be reloaded. The POR and BOR reset all the Configuration Word registers before loading the configuration settings. For all other Reset conditions, the Configuration Word registers are not Reset prior to being reloaded. 13.18.5.3 Using the RCON Status Bits The user software can read the RCON register after any system Reset to determine the cause of the reset. The following table provides a summary of the Reset flag bit operation. Note:The status bits in the RCON register must be cleared after they are read, so that the next RCON register value after a device Reset will be meaningful. Table 13-5. Reset Flag Bit Operation Flag Bit Set by Cleared by POR (RCON[0]) BOR (RCON[1]) IDLE (RCON[2]) POR POR, BOR User Software User Software WAIT Instruction User Software, POR, BOR STANDBY SLEEP (RCON[3]) WAIT Instruction User Software, POR, BOR WDTO (RCON[4]) DMTO (RCON[5]) SWR (RCON[6]) EXTR (RCON[7]) CMR (RCON[9]) BCFGFAIL (RCON[26]) WDT timeout and NMI counter expires DMT Timeout and NMI counter expires User Software, POR, BOR User Software, POR, BOR Software Reset Command User Software, POR, BOR NMCLR Reset User Software, POR, BOR Configuration Mismatch Reset User Software, POR, BOR Non-recoverable error in Primary and Alternate configuration words User Software, POR, BOR 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 195 PIC32CX-BZ2 and WBZ45 Family Clock and Reset Unit (CRU)
...........continued Flag Bit Set by Cleared by BCFGERR (RCON[27]) Recoverable error in primary configuration words User Software, POR, BOR 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 196 PIC32CX-BZ2 and WBZ45 Family RAM Error Correction Code (RAMECC) 14. RAM Error Correction Code (RAMECC) 14.1 Overview For safety applications, the SAM D5x/E5x family can embed error correction codes (ECC) to detect and correct single bit errors or to enable dual error detection in SRAM. As discussed in Memories chapter, when the RAMECC is enabled, the top half of SRAM memory will be reserved to store error correction codes and will not be available for the application. ECC calculation is software selectable through the RAM ECCDIS bit in the NVM User Row. For additional information, refer to Table 9-2. 14.2 Features Single bit correction and dual bit detection. Error Interrupt. Operates in any Sleep mode. Interrupts generated by RAMECC can be used to wake up the device from sleep modes. 14.3 Block Diagram Figure 14-1. RAMECC Block Diagram Write data 32 ECC calculation 4x5 HADDR ERRADDR RAM Block 32 4x5 ECCDIS ECC logic 32 HRDATA ECCERR and ECCDUAL status 14.4 Signal Description Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 197 PIC32CX-BZ2 and WBZ45 Family RAM Error Correction Code (RAMECC) 14.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 14.5.1 I/O Lines Not applicable. 14.5.2 Power Management The RAMECC will continue to operate in any sleep mode where the selected source clock is running. The RAMECCs interrupts can be used to wake up the device from sleep modes. See Power Management Unit (PMU) from Related Links for details on the different sleep modes. Related Links 15. Power Management Unit (PMU) 14.5.3 DMA Not applicable. 14.5.4 Interrupts The interrupt request line is connected to the interrupt controller. Using the RAMECC interrupt(s) requires the interrupt controller to be configured first. 14.5.5 Events Not applicable. 14.5.6 Debug Operation When the CPU is halted in debug mode the RAMECC will correct and log ECC errors based on the table below. Table 14-1. ECC Debug Operation DBGCTRL.ECCELOG DBGCTRL.ECCDIS Description 0 1 X 0 0 1 ECC errors from debugger reads are corrected but not logged in INTFLAG. ECC errors from debugger reads are corrected and logged in INTFLAG. ECC errors from debugger reads are not corrected or logged in INTFLAG. If the RAMECC is configured in a way that requires it to be periodically serviced by the CPU through interrupts or similar, improper operation or data loss may result during debugging. 14.5.7 Register Access Protection All registers with write-access are optionally write-protected by the Peripheral Access Controller (PAC), except the following registers:
Interrupt Flag Status and Clear (INTFLAG) register Status (STATUS) register. Write-protection is denoted by the Write-Protected property in the register description. Write-protection does not apply to accesses through an external debugger (see Peripheral Access Controller (PAC) from Related Links). Related Links 26. Peripheral Access Controller (PAC) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 198 PIC32CX-BZ2 and WBZ45 Family RAM Error Correction Code (RAMECC) 14.5.8 Analog Connections Not applicable. 14.6 Functional Description 14.6.1 Principle of Operation Error Correcting Code (ECC) is implemented to detect and correct errors that may arise in the RAM arrays. The ECC logic is capable of double error detection and single error correction per 8-bit byte. Upon single bit error detection, the Single Bit Error interrupt flag is raised (INTFLAG.SINGLEE). If a dual error is detected, the Dual Error interrupt flag (INTFLAG.DUALE) is raised. When the first error is detected, the ERRADDR register is frozen with the failing address and remains frozen until INTFLAG.DUALE and INTFLAG.SINGLEE are cleared. If a dual bit error occurs while INTFLAG.SINGLEE is set, the ERRADDR register is updated with the dual bit error information and INTFLAG.DUALE is also set. The INTFLAG.SINGLEE and INTFLAG.DUALE bits are both cleared on ERRADDR read. The block diagram shows the ECC interface. When ECC is disabled (CTRLA.ECCDIS=1), the ECC field in RAM is left unchanged on writes. On reads, ECC errors are not corrected or flagged. Related Links 14.3. Block Diagram 14.6.2 Interrupts The RAMECC has the following interrupt sources:
Dual Bit Error (DUALE): Indicates that a dual bit error has been detected. Single Bit Error (SINGLEE): Indicates that a single bit error has been detected. Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a '1' to the corresponding bit in the Interrupt Enable Set
(INTENSET) register, and disabled by writing a '1' to the corresponding bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the ERRADDR register is read, the interrupt is disabled, or the RAMECC is reset. All interrupt requests from the peripheral are ORed together on system level to generate one combined interrupt request to the NVIC. The user must read the INTFLAG register to determine which interrupt condition is present. Note:Interrupts must be globally enabled for interrupt requests to be generated. Related Links 14.8.3. INTFLAG 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 199 PIC32CX-BZ2 and WBZ45 Family RAM Error Correction Code (RAMECC) 14.7 Register Summary - RAMECC Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 0x01 0x02 0x03 INTENCLR INTENSET INTFLAG STATUS 0x04 ERRADDR 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 0x08
... 0x0E 0x0F Reserved DBGCTRL 7:0 ERRADDR[7:0]
ERRADDR[15:8]
DUALE DUALE DUALE SINGLEE SINGLEE SINGLEE ECCDIS ERRADDR[16
ECCELOG ECCDIS 14.8 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description (see Register Access Protection from Related Links). Related Links 14.5.7. Register Access Protection 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 200 PIC32CX-BZ2 and WBZ45 Family RAM Error Correction Code (RAMECC) 14.8.1 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x00 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set (INTENSET) register. Bit 7 6 5 4 3 2 Access Reset 1 DUALE R/W 0 0 SINGLEE R/W 0 Bit 1 DUALEDual Bit Error Interrupt Enable Clear Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Dual Bit Error Interrupt Enable bit, which disables the Dual Bit Error interrupt. Value 0 1 Description The Dual Bit Error interrupt is disabled. The Dual Bit Error interrupt is enabled. Bit 0 SINGLEESingle Bit Error Interrupt Enable Clear Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Single Bit Error Interrupt Enable bit, which disables the Single Bit Error interrupt. Value 0 1 Description The Single Bit Error interrupt is disabled. The Single Bit Error interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 201 PIC32CX-BZ2 and WBZ45 Family RAM Error Correction Code (RAMECC) 14.8.2 Interrupt Enable Set Name:
Offset:
Reset:
Property: Write-Protected INTENSET 0x01 0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear (INTENCLR) register. Bit 7 6 5 4 3 2 Access Reset 1 DUALE R/W 0 0 SINGLEE R/W 0 Bit 1 DUALEDual Bit Error Interrupt Enable Set Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Dual Bit Error Interrupt Enable bit, which enables the Dual Bit Error interrupt. Value 0 1 Description The Dual Bit Error interrupt is disabled. The Dual Bit Error interrupt is enabled. Bit 0 SINGLEESingle Bit Error Interrupt Enable Set Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Single Bit Error Interrupt Enable bit, which disables the Single Bit Error interrupt. Value 0 1 Description The Single Bit Error interrupt is disabled. The Single Bit Error interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 202 PIC32CX-BZ2 and WBZ45 Family RAM Error Correction Code (RAMECC) 14.8.3 Interrupt Flag Status and Clear Name:
Offset:
Reset:
INTFLAG 0x02 0x00 Bit 7 6 5 4 3 2 Access Reset Bit 1 DUALEDual Bit ECC Error Interrupt This flag is set on the occurrence of a dual bit ECC error. Writing a '0' to this bit has no effect. Reading the ECCADDR register will clear the Dual Bit Error interrupt flag. Value 0 1 Description No dual bit errors have been received since the last clear. At least one dual bit error has occurred since the last clear. Bit 0 SINGLEESingle Bit ECC Error Interrupt This flag is set on the occurrence of a single bit ECC error. Writing a '0' to this bit has no effect. Reading the ECCADDR register will clear the Single Bit Error interrupt flag. Value 0 1 Description No errors have been received since the last clear. At least one single bit error has occurred since the last clear. 1 DUALE R/W 0 0 SINGLEE R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 203 PIC32CX-BZ2 and WBZ45 Family RAM Error Correction Code (RAMECC) 14.8.4 Status Name:
Offset:
Reset:
Property: Read-only STATUS 0x03 0x00 Bit 7 6 5 4 3 2 1 Access Reset Bit 0 ECCDISECC Disable 0 ECCDIS R 0 This bit is fuse updated at startup. When enabled, the calculated ECC is written to RAM along with data. ECC correction and detection is enabled for reads. Value 0 1 Description ECC detection and correction is enabled. ECC detection and correction is disabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 204 PIC32CX-BZ2 and WBZ45 Family RAM Error Correction Code (RAMECC) 14.8.5 Error Address Name:
Offset:
Reset:
Property: Read-only ERRADDR 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 ERRADDR[16]
R 0 Access Reset Bit 15 Access Reset Bit Access Reset R 0 7 R 0 14 R 0 6 R 0 13 R 0 5 R 0 11 12 ERRADDR[15:8]
R R 0 0 4 3 ERRADDR[7:0]
R 0 R 0 10 R 0 2 R 0 9 R 0 1 R 0 8 R 0 0 R 0 Bits 16:0 ERRADDR[16:0]ECC Error Address The RAM address offset from RAM start that caused an ECC error. If a single bit error is followed by a dual bit error, this register will be updated with the address of the dual bit error, otherwise it stalls on the first error occurrence. This register will read as zero unless INTFLAG.SINGLEE and/or INTFLAG.DUALE are 1. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 205 PIC32CX-BZ2 and WBZ45 Family RAM Error Correction Code (RAMECC) 14.8.6 Debug Control Name:
Offset:
Reset:
Property: PAC Write-Protection DBGCTRL 0x0F 0x00 Bit 7 6 5 4 3 2 Access Reset Bit 1 ECCELOGECC Error Log 1 ECCELOG R/W 0 0 ECCDIS R/W 0 When DBGCTRL.ECCDIS=0, This bit controls whether ECC errors are logged in the INTFLAG register. When DBGCTRL.ECCDIS=1, this bit has no meaning. Value 0 1 Description ECC errors for debugger reads are not logged. ECC errors for debugger reads are logged if DBGCTRL.ECCDIS=0. Bit 0 ECCDISECC Disable By default, ECC errors during debugger reads are corrected and logged based on DBGCTRL.ECCELOG. Setting this bit will disable ECC correction and logging. Value 0 1 Description ECC errors are are corrected for debugger reads and logged based on DBGCTRL.ECCELOG. ECC errors are masked for debugger reads. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 206 PIC32CX-BZ2 and WBZ45 Family Power Management Unit (PMU) 15. Power Management Unit (PMU) 15.1 Overview This chapter describes the Power Management Unit (PMU) in the PIC32CX-BZ2 wireless microcontroller with the various modes it provides. It is for information purposes only. Note:The PMU is a complex power controller that requires specific configuration and handling by the software for correct, safe operation of the SOC. The software SDK and operational stacks provided by Microchip handles the start-up and operation of the PMU. Therefore, Microchip highly recommends using this software framework for all application development on the device. 15.2 Power Modes To minimize power consumption, the PIC32CX-BZ2 incorporates a PMU that provides both DC-DC (Buck) and LDO power conversion. The input voltage range to the PMU is 1.9V to 3.6V VDD (main). On power-up, the PIC32CX-BZ2 operates in LDO mode; the software must enable the DC-DC Buck converter. See Electrical Characteristics from Related Links for detailed electrical information. The power modes and power management features provided by the PMU are shown in the following table. Table 15-1. Power Modes and Power Management Features Functions Device Power Modes Run Idle Dream1 Sleep(Standby) Deep Sleep(Backup) eXtreme Deep Sleep(Off) CPU On Clock Gated Clock Gated Clock Gated Peripherals Flash Core System Memory Radio DSWDT RTCC Backup RAM XTAL(16 MHz) SPLL ADC Analog Comp FRC LPRC Note:
On On On On On On On On On On On On On On On On On On On On On On On On On On On Demand Clock Gated On Demand Clock Gated On Demand Retention Mode On Demand Clock Gated On On On On Off Off Off Off Off On On On Demand Retention Mode Retention Mode On On Demand On Off On Demand On Demand On Demand On Demand On Off Off On Off Off Off Off Off On Off Off Off Off Off Off Off Off Off Off Off Off Off On 1. Dream (Sleep Walking) is not a mode by itself but is a companion mode to the Sleep mode. This mode cannot be entered directly through a software command. Current consumption can be reduced on peripherals/modules in "On" state by clock gating and/or disabling the module, see Module Enable/Disable Controls in the Register Description from Related Links. All transitions from 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 207 PIC32CX-BZ2 and WBZ45 Family Power Management Unit (PMU) the Run state to any of the low power states is simply initiated by WFI command from the CPU. However, prior to initiating the WFI command. The software performs the following actions:
Disabling all interrupts Setting up the DSCON[DSEN], OSCCON[SLPEN], OSCCON[DRMEN] and Wireless Subsystem Sleep mode Controls Set the Wireless Subsystem into the Low Power mode Enable the appropriate wake-up events Checking for any pending interrupts and, if present, abort deep sleep and service the interrupt If no pending interrupts, then issue a SLEEP/WAIT command from the CPU to get into the appropriate Low Power mode In the Run mode, the CPU is actively executing code. Run mode provides normal operation of the processor and all peripherals that are currently enabled. In the Idle mode, all active peripherals can be clocked, but the CPU core is clock gated off and no code is executed. In the Dream mode (or Sleep Walking mode), the CPU is clock gated but peripherals can be turned on on-demand by events related to those peripherals. No code is executed. In the Sleep and Deep Sleep modes, the backup RAM is in retention mode, while the CPU and most peripherals are clock gated off and no code is executed. In the eXtreme Deep Sleep mode, only the Low Power RC oscillator is enabled. Exiting Deep sleep/XDS is equivalent to Power-on Reset. The RCON register provides the status whether it is a normal power up or exiting from deep sleep/XDS. Note:All desired register/configuration inputs (for example, DSZPBOREN, DSWDTPS ) to be preserved must be set to expected values before setting DSCON.DSEN = 1; failure to do so would result in faulty configuration fault indications. The low power mode entry and exit commands and wake up resources are shown in the following table. Table 15-2. Low Power Mode Entry and Exit commands and Wake-up Resources Device Power Modes Entry Commands Run Idle Dream Sleep WFI Instruction + ~OSCCON[SLPEN]
OSCCON[DREAM] + Event + Sleep mode
~DSCON[DSEN]+OSCCON[SLPEN]+Wireless Sleep followed by WFI Wake-up Resources IRQ, Reset, Others(1) IRQ, Reset, Others IRQ, Reset, Others Deep Sleep DSCON[DSEN]+ {RTCC (Enabled) or DSWDT (Enabled)} +
Wireless Sleep followed by WFI INT0, RTCC, DSWDT(2), Reset eXtreme Deep Sleep DSCON[DSEN]+ {RTCC (Disabled) and DSWDT (Disabled)}
INT0, Reset
+ Wireless Sleep followed by WFI Notes:
1. Others = System Wake-up (Dream), WDT (Timeout Event), DMT (Timeout Event), PLVD Event, PMU Event, 2. External NMI/INT, DSU/ICD Debug Event, CPU Debug Event. To enable the Deep Sleep Mode Watchdog Timer(DSWDT) in deep sleep mode, Configuration Control Register 4(CFGCON4). DSWDT is a separate timer from the device's watchdog timer that is used in run mode. The device Watchdog Timer (WDT) does not have to be enabled for the DSWDT to function. Related Links 20.4.2. Register Description 43. Electrical Characteristics 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 208 PIC32CX-BZ2 and WBZ45 Family Watchdog Timer (WDT) 16. Watchdog Timer (WDT) 16.1 Overview The Watchdog Timer (WDT) can be used to detect system software malfunctions by resetting the device if the WDT is not cleared periodically in software. The user can configure the WDT in Windowed mode or non-Windowed mode. Various WDT time-out periods can be selected using the WDT postscaler. The WDT can also be used to wake the device from Sleep or Idle mode. 16.2 Features Configuration using Fuses (DEVCFG) or Software controlled Up to 32 Configurable Time-Out Periods Can wake the Device from Standby Sleep or Idle mode Independent Run and Standby Sleep mode Counters WDT may use alternate Clock source and Postscaler for Run mode Counter Independent 5-bit Postscalers for Run and Standby Sleep mode Counters Hardware and Software enabled Two Clock sources Windowed WDT Note:When the CPU is running on the same clock or clock frequency as the WDT, the lowest pre-scale values may not allow the CPU to have enough time to reset the WDT before it expires. 16.3 Applications The WDT is a free-running timer with a configurable postscaler. The counter is clocked with an external reference clock until the counter value exceeds the selected WDT period. If enabled, the WDT will continue to operate even if the main processor clock (for example, the crystal oscillator) fails. The WDT uses separate internal counters for use in Run mode and Sleep/Idle modes. One counter operates only in Run mode; the count value of this counter is frozen when the device is in Sleep or Idle modes. The second counter operates only in Sleep and Idle modes; it is reset when entering Sleep or Idle. This provides the following benefits:
A different WDT clock source can be used in Run mode(PB1_CLK or LPRC) vs. Sleep/Idle modes (LPRC only). A different post-scale value may be used in Run mode vs. Sleep/Idle modes. The Run mode WDT count is preserved while in Sleep or Idle modes, which makes it easier to manage the WDT while in windowed mode. The WDT can have two modes of operation, Windowed and non-Windowed. In Windowed mode, software can clear the WDT only when the counter is in its final window before a period match occurs. There are four window size options (25%, 37.5%, 50% and 75% of the total WDT period). This window is active when the timer counter is greater than a predetermined value for each option. The window size is determined by the WDTWINSZ configuration fuses
(see System Configuration Registers (CFG) from Related Links). Any attempts to clear the WDT when the window is not active would cause a device Reset. In non-Windowed configuration, software can clear the WDT any time before the period match occurs. Note:Windowed WDT operation is not applicable in Sleep or Idle modes. Related Links 18. System Configuration and Register Locking (CFG) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 209 PIC32CX-BZ2 and WBZ45 Family Watchdog Timer (WDT) 16.3.1 Enabling the WDT The WDT can be enabled through hardware or software control. The WDT is enabled if WDTEN=1 in the DEVCFG2 fuse register. If WDTEN=0, the WDT is disabled, and can be controlled using the ON bit (WDTCON[15]). 16.3.2 Selecting WDT Clock Source The Sleep Mode Counter always uses the 32 kHz LPRC clock source. The Run Mode Counter will use the clock source selected by the WDTRMCS bit in fuses Configuration Bits register DEVCFG2 to be either the 32 kHz LPRC clock or the PB1_CLK bus clock (sysclk). See WDTRMCS[1:0] bits in the CFGCON2(L) register from Related Links. Related Links 18.4.3. CFGCON2(L) 16.3.3 Clearing the Watch Dog Timer To clear the WDT, software must write to the WDTKEY register with the value 16h5743 before the timer expires. The upper two bytes of WDTCON must be written simultaneously, as a 16-bit write. Any other write with a different value or byte size will NOT clear the timer. 16.3.4 Selecting WDT Period The WDT can be configured for various time-out periods by controlling the WDT postscaler value. The settings are chosen using the WDTPSR[4:0] inputs for the Run Mode Counter and the WDTPSS[4:0] inputs for the Sleep Mode Counter. These values range from 1 to 2^20 and allow for time-out periods of from 1 ms to over 17 minutes when using the 21 kHz LPRC clock. 16.3.5 Events that Reset both WDT Counters The following events will reset both internal WDT counters:
A generic device reset Disabling the WDT via the ON bit 16.3.6 Events that Reset only the Run Mode Counter The following events reset the Run Mode Counter:
Any counter value greater than the selected WDT period Detecting a correct write value to WDTCON.WDTKEY within the correct time window 16.3.7 Events that Reset only the Sleep Mode Counter The following events reset the Sleep Mode Counter:
Entry into Sleep or Idle modes Any counter value greater than the selected WDT period 16.3.8 Run Mode WDT Event Once the WDT period is exceeded, or if a correct write value to the WDTCON.WDTKEY is executed in a Windowed mode when the window is not yet active, the WDT event is activated. The event remains active for one clock period. The WDT is reset after the count is exceeded and continues to run. 16.3.9 Sleep Mode WDT Event Once the WDT period is exceeded, the WDT event is activated. The event remains active for one clock period. The WDT is reset after the count is exceeded. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 210 PIC32CX-BZ2 and WBZ45 Family Watchdog Timer (WDT) 16.4 Block Diagram Figure 16-1. Watchdog Timer Block Diagram
26 SLPDIV[4:0](WDTCON[5:1]) WDTMCS[1:0](CFGCON2[11:10])
16.5 Configuration The WDT is configured using the following config register bits/fields:
Window size (CFGCON2.FWINSZ[1:0]) Windowing disable (CFGCON2.WINDIS) Post-scaler selection (CFGCON2.WDTPS[4:0]) Run Mode Counter clock source (CFGCON2.WDTRMCS[1:0]) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 211 PIC32CX-BZ2 and WBZ45 Family Watchdog Timer (WDT) 16.6 Register Summary - WDT Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 WDTCON 7:0 15:8 23:16 31:24 ON SLPDIV[4:0]
WDTWINEN RUNDIV[4:0]
WDTCLRKEY[7:0]
WDTCLRKEY[15:8]
16.7 Register Description Note:All registers in this table have corresponding CLR, SET and INV registers at its virtual address, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET, and INV Registers from Related Links. Following conventions are used in the register description:
-n = Value at POR R = Readable bit W = Writable bit
= Unimplemented bit, read as 0 1 = Bit is set 0 = Bit is cleared Reset values are shown in hexadecimal. x = Bit is unknown y = Values set from Configuration bits on POR Related Links 6.1.9. CLR, SET and INV Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 212 16.7.1 WDTCON - Watchdog Timer Control Register PIC32CX-BZ2 and WBZ45 Family Watchdog Timer (WDT) Name:
Offset:
Reset:
Property:
WDTCON 0x00 0x00
Bit Access Reset Bit Access Reset Bit Access Reset 31 W 0 23 W 0 15 ON R/W y 30 W 0 22 W 0 14 Bit 7 6 Access Reset 29 W 0 21 W 0 13 5 R y 28 27 WDTCLRKEY[15:8]
W W 0 0 20 19 WDTCLRKEY[7:0]
W W 0 0 26 W 0 18 W 0 12 R y 4 R y 11 R y 10 RUNDIV[4:0]
R y 3 SLPDIV[4:0]
R y 2 R y 25 W 0 17 W 0 9 R y 1 R y 24 W 0 16 W 0 8 R y 0 WDTWINEN R/W 0 Bits 31:16 WDTCLRKEY[15:0]Watchdog Timer Clear Key bits To clear the WDT to prevent a time-out, software must write the value 0x5743 to this location using a single 16-bit write. Anything other than a 16-bit write will not reset the WDT. You must use a 16-bit write for the WDTCLRKEY[15:0] bits. Bit 15 ONWatchdog Timer Enable bit Note:
1. This bit only has control when the WDTEN bit (DEVCFG2/CFGCON2[23]) = 0. Value 1 0 Description WDT is enabled WDT is disabled Bits 12:8 RUNDIV[4:0]Watchdog Timer Postscaler Run Counter Value bits On Reset, these bits are set to the values of the WDTPSR[4:0] Configuration bits in CFGCON2. Bits 5:1 SLPDIV[4:0]Watchdog Timer Postscaler Sleep Counter Value bits On Reset, these bits are set to the values of the WDTPSS[4:0] Configuration bits in CFGCON1. Bit 0 WDTWINENWatchdog Timer Window Enable bit Value 1 0 Description Enable windowed WDT Disable windowed WDT 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 213 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) 17. Deadman Timer (DMT) 17.1 Overview The Deadman Timer (DMT) module is designed to enable users to be able to monitor the health of their application software by requiring periodic timer interrupts within a user-specified timing window. The DMT module is a synchronous counter and when enabled, counts instruction fetches and causes a system reset if the DMT counter is not cleared within a set number of instructions. The DMT is typically connected to the system clock that drives the processor. The user specifies the timer time-out value and a mask value that specifies the range of the window, which is the range of counts that is not considered for the comparison event. 17.2 Features 32-bit configurable count-limit based on counting instructions fetched Hardware- or software-enabled control User-configurable time-out period or instruction count Two instruction sequence to clear timer 32-bit configurable window to clear timer 17.3 Block Diagram The following figure shows the block diagram of the Deadman Timer. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 214 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) Figure 17-1. Deadman Timer Block Diagram improper sequence flag ON Instruction Fetched Strobe System Reset Force DMT Event Counter Initialization Value PB1_CLK Clock 32-bit counter ON Proper Clear Sequence Flag ON System Reset 32 DMT Count Reset Load DMT event to NMI(3)
(COUNTER) = DMT Max Count(1)
(COUNTER) DMT Window Interval(2) Window Interval Open Notes:
1. 2. 3. The DMT Max Count is controlled by the DMTCNT[4:0] bits in the CFGCON2 register Maximum = 2^31. The DMT Window Interval is controlled by the DMTINTV[2:0] bits in the CFGCON2 register. For more details, see Resets from Related Links. Related Links 13.18. Resets 17.4 DMT Operation 17.4.1 Mode of Operation The primary function of the Deadman Timer (DMT) module is to reset the processor in the event of a software malfunction. The DMT module, which works on the system clock, is a free running instruction fetch timer, which is clocked whenever an instruction fetch occurs until a count match occurs. The instructions are not fetched when the processor is in the Standby Sleep mode. The DMT module consists of a 32-bit counter, the read-only DMTCNT register with a time-out count match value as specified by the 32-bit DMT count configuration fuse bits CFGCON2.DMTCNT[4:0]. Whenever the count match occurs, a DMT reset event will occur and the DMTEVENT bit in DMTSTAT register will be set. A DMT module is typically used in mission critical and safety critical applications, where any failure of the software functionality and sequencing must be detected. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 215 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) 17.4.2 Enabling and Disabling the DMT Module Because of the nature of the Deadman Timer, the PMD register bit is not provided to enable/disable the module. The DMT module can be enabled or disabled by the DMT enable (DMTEN) bit in the Configuration Control Register 2
(CFGCON2) fuse register or it can be enabled through software by writing to the Deadman Timer Control (DMTCON) register. Once the DMT is enabled, it may not be disabled without a device reset. If the DMTEN configuration bit in the CFGCON2 fuse register is set, the DMT is always enabled. The ON control bit
(DMTCON[15]) in DMTCON register will reflect this by reading a 1. In this mode, the ON bit (DMTCON[15]) cannot be cleared in software. To disable the DMT, the DMTEN configuration bit must be cleared in the CFGCON2 fuse register. When DMTEN is cleared to 0 in the CFGCON2, the DMT is disabled in hardware. Software can enable the DMT by setting the ON bit in the DMTCON register. However, for software control, the DMTEN configuration bit in the CFGCON2 fuse register must be set to 0. 17.4.3 DMT Count Windowed Interval The DMT module has the Windowed Operation mode. The DMT interval (DMTINV[2:0]) bits in the Configuration Control Register 2 (CFGCON2) fuse register sets the window interval value. The PSINTV[31:0] bits in DMT interval post status register (DMTPSINTV) allows the software to read the DMT window interval value. That means this register reads the value that is written to the DMT interval (DMTINV[2:0]) bits in the Configuration Control Register 2
(CFGCON2) fuse register. In the Windowed mode, software can clear the DMT only when the counter is in its final window before a count match occurs. That is, if the DMT counter value is greater than or equal to the value written to the window interval value, only then the DMT clear sequence can be executed in the DMT module. If the DMT is cleared before the allowed window, a DMT reset event is immediately generated. 17.4.4 DMT Count Selection The Deadman Timer count is set by the DMT count configuration (DMTCNT[4:0]) bits in the Configuration Control Register 2 (CFGCON2) fuse register. The current DMT count value can be obtained by reading the DMT count register DMTCNT. The PSCNT[31:0] bits in the DMT count post status register (DMTPSCNT) allows the software to read the maximum count selected for the DMT. The PSCNTx bit values are the values that are initially written to the DMTCNTx bits in the CFGCON2 fuse register. Whenever the DMT event occurs, the user can always compare to see whether the current counter value in the DMTCNT register is equal to the value of the DMTPSCNT register, which holds the maximum count value. Whenever the DMT current counter value in DMTCNT reaches the value of the DMTPSINTV register, the window interval opens permitting the user to execute the DMT clear sequence. The open window interval is indicated by the WINOPN bit in DMTSTAT register. The UPRCNT[15:0] bits in the DMT hold register (DMTHOLDREG) holds the value of the last read DMT upper count values whenever DMTCNT is last read. 17.4.5 DMT Operation in Power-Saving Modes As the DMT module is only incremented by instruction fetches, the count value will not change when the core is inactive. The DMT module remains inactive in the Standby Sleep and Idle modes. As soon as the device wakes-up from Standby Sleep or Idle, the DMT counter starts incrementing again for every instruction fetch. 17.4.6 Resetting the DMT The DMT can be reset in two ways: one way is after a system reset and another way is by writing an ordered sequence to the DMT pre-clear register (DMTPRECLR) and DMT clear register (DMTCLR) in a specific two-step sequence. Clearing the DMT counter value requires the following sequence of operations:
1. 2. The STEP1[7:0] bits in the DMTPRECLR register must be written as 01000000 (0x40). This action sets the enable for clearing state, which enables the DMT to be cleared by step 2. The STEP2[7:0] bits in the DMTCLR register must be written as 00001000 (0x08). This can only be done if preceded by step 1 and if the DMT is in the open window interval. Once these values are written, following are cleared to zero:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 216 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) DMTCNT counter DMTPRECLR register DMTCLR register DMTSTAT register If any value other than 0x40 is written to the STEP1x bits, the BAD1 bit in the DMTSTAT register will be set and it causes a DMT event to occur. Any value other than 0x08, written to the STEP2x bits, will cause the BAD2 bit to be set in the DMTSTAT register. Also, if step 2 is not preceded by step 1, or step 2 is not carried out in the open window interval, it causes the BAD2 flag to be set. Immediately, a DMT event will occur. In both these cases, the DMTEVENT bit in the DMTSTAT register will be set. Refer to the flowchart shown in the following figure. Figure 17-2. Flowchart for Clearing the DMT Start DMT Enable Insert Preclear Sequence Is Sequence Proper?
No BAD1 Flag Set DMT Event Yes Is Counter>=DMT Window Interval?
No Insert Clear Sequence BAD2 Flag Set DMT Event Yes Insert Clear Sequence Is Sequence Proper?
No BAD2 Flag Set DMT Event Yes DMT Reset Occurs Stop 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 217 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) 17.5 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 DMTCON 0x04
... 0x0F Reserved 0x10 DMTPRECLR 0x14
... 0x1F Reserved 0x20 DMTCLR 0x24
... 0x2F Reserved 0x30 DMTSTAT 0x34
... 0x3F Reserved 0x40 DMTCNT 0x44
... 0x4F Reserved 0x50 DMTHOLDREG 0x54
... 0x5F Reserved 0x60 DMTPSCNT 0x64
... 0x6F Reserved 0x70 DMTPSINTV 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 ON STEP1[7:0]
STEP2[7:0]
BAD1 BAD2 DMT_EVENT WINOPN COUNTER[7:0]
COUNTER[15:8]
COUNTER[23:16]
COUNTER[31:24]
UPRCNT[7:0]
UPRCNT[15:8]
PSCNT[7:0]
PSCNT[15:8]
PSCNT[23:16]
PSCNT[31:24]
PSINTV[7:0]
PSINTV[15:8]
PSINTV[23:16]
PSINTV[31:24]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 218 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) 17.6 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description. Some registers are synchronized when read and/or written. Synchronization is denoted by the Write-Synchronized or the Read-Synchronized property in each individual register description. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable protection is denoted by the Enable-Protected property in each individual register description. Note:All registers in this table have corresponding CLR, SET and INV registers at their virtual addresses plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET and INV Registers from Related Links Related Links 6.1.9. CLR, SET and INV Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 219 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) 17.6.1 Deadman Timer Control Name:
Offset:
Reset:
Property:
DMTCON 0x00 0x00
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset 15 ON HC 0 14 13 12 11 10 Bit 7 6 5 4 3 2 Access Reset Bit 15 ONOn bit The ON bit reflects the status of the configuration fuse CFGCON2.DMTEN, if the fuse is set. Value 1 0 Description Enables the Deadman Timer if the event configuration fuse is not enabled. The DMT disabled. 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 220 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) 17.6.2 Deadman Timer Preclear Name:
Offset:
Reset:
Property:
DMTPRECLR 0x10 0x00
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 Access Reset R/W 0 Bit 7 Access Reset 14 R/W 0 6 13 R/W 0 5 STEP1[7:0]
12 R/W 0 4 11 R/W 0 3 10 R/W 0 2 9 R/W 0 1 8 R/W 0 0 Bits 15:8 STEP1[7:0]Pre-Clear Enable bit when write pattern is:
Description Value 01000000 Enables the Deadman Timer Pre-Clear (STEP 1). all other write patterns Sets DMTSTAT.BAD1 flag to 1. Note:Bits 15:8 are cleared when a DMT reset event occurs. STEP1 is also cleared if DMTCLR.STEP2 is loaded with the correct value in the correct sequence. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 221 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) 17.6.3 Deadman Timer Clear Name:
Offset:
Reset:
Property:
DMTCLR 0x20 0x00
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 STEP2[7:0]
4 R/W 0 3 R/W 0 2 R/W 0 9 1 8 0 R/W 0 R/W 0 Bits 7:0 STEP2[7:0]Clear Timer bit when write pattern is:
Description Value 00001000 Clears DMTPRECLR.STEP1, DMTCLR.STEP2 and the Dead Man Timer if and only if preceded by the correct loading of Pre-Clear Enable (STEP1) in the correct sequence. The write to the DMTCLR.STEP2 field may be verified by reading DMTCNT and observing the counter being reset. The DMTSTAT.BAD2 flag is set to 1, the value in the DMTPRECLR.STEP1 will remain unchanged, and the new value being written DMTCLR.STEP2 will be captured. Note:These bits 7:0 are also cleared when a DMT reset event occurs. all other write patterns 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 222 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) 17.6.4 Deadman Timer Status Name:
Offset:
Reset:
Property:
DMTSTAT 0x30 0x00
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit Access Reset 7 BAD1 R 0 6 BAD2 R 0 5 DMT_EVENT R 0 4 3 2 9 1 8 0 WINOPN R 0 Bit 7 BAD1When an incorrect DMTPRECLR.STEP1 value is detected, this bit is set. It is cleared by a Reset. Bit 6 BAD2When an incorrect value of DMTCLR.STEP2 is detected, this bit is set. It is cleared by a Reset. Bit 5 DMT_EVENTThis bit is set when the Deadman timer event is detected (counter expired or bad STEP1[7:0] or STEP2[7:0] value is entered prior to the counter increment). This bit remains set and is cleared only by a Reset. Bit 0 WINOPNDeadman Timer Clear Window bit. A value of 1 indicates that a STEP2 clear action can take place, and if this clearing action occurs as part of a correct sequence of actions, the DMT counter will be cleared. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 223 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) 17.6.5 Deadman Timer Count Name:
Offset:
Reset:
Property:
DMTCNT 0x40 0x00
Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 R 0 23 R 0 15 R 0 7 R 0 30 R 0 22 R 0 14 R 0 6 R 0 29 R 0 21 R 0 13 R 0 5 R 0 28 27 COUNTER[31:24]
R R 0 0 20 19 COUNTER[23:16]
R R 0 0 11 12 COUNTER[15:8]
R R 0 0 4 3 COUNTER[7:0]
R 0 R 0 26 R 0 18 R 0 10 R 0 2 R 0 Bits 31:0 COUNTER[31:0]Read current contents of DMT Counter. 25 R 0 17 R 0 9 R 0 1 R 0 24 R 0 16 R 0 8 R 0 0 R 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 224 PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) 17.6.6 Deadman Timer Count Holding Register Name:
Offset:
Reset:
Property:
DMTHOLDREG 0x50 0x00
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 Access Reset Bit Access Reset R 0 7 R 0 14 R 0 6 R 0 13 R 0 5 R 0 12 11 UPRCNT[15:8]
R 0 4 R 0 UPRCNT[7:0]
R 0 3 R 0 10 R 0 2 R 0 9 R 0 1 R 0 8 R 0 0 R 0 Bits 15:0 UPRCNT[15:0]
It is the content of DMTCNT.COUNTER[31:16] when the counter was last read to ensure a synchronous snapshot of the counter. This register is initialized to 0 on reset and is only loaded when the DMTCNT register is read. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 225 17.6.7 Post Status Configure DMT Count Status Register PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) Name:
Offset:
Reset:
Property:
DMTPSCNT 0x60 0x00
Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 R 0 23 R 0 15 R 0 7 R 0 30 R 0 22 R 0 14 R 0 6 R 0 29 R 0 21 R 0 13 R 0 5 R 0 28 27 PSCNT[31:24]
R 0 20 R 0 19 PSCNT[23:16]
R 0 12 R 0 4 R 0 PSCNT[15:8]
PSCNT[7:0]
R 0 11 R 0 3 R 0 26 R 0 18 R 0 10 R 0 2 R 0 25 R 0 17 R 0 9 R 0 1 R 0 24 R 0 16 R 0 8 R 0 0 R 0 Bits 31:0 PSCNT[31:0]
DMT Instruction Count Value Configuration Fuse Status bits. This bit always reflects the value of CFGCON2.DMTCNT. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 226 17.6.8 Post Status Configure DMT Interval Status Register PIC32CX-BZ2 and WBZ45 Family Deadman Timer (DMT) Name:
Offset:
Reset:
Property:
DMTPSINTV 0x70 0x00
Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 R 0 23 R 0 15 R 0 7 R 0 30 R 0 22 R 0 14 R 0 6 R 0 29 R 0 21 R 0 13 R 0 5 R 0 28 27 PSINTV[31:24]
R 0 20 R 0 19 PSINTV[23:16]
R 0 12 R 0 4 R 0 PSINTV[15:8]
PSINTV[7:0]
R 0 11 R 0 3 R 0 26 R 0 18 R 0 10 R 0 2 R 0 25 R 0 17 R 0 9 R 0 1 R 0 24 R 0 16 R 0 8 R 0 0 R 0 Bits 31:0 PSINTV[31:0]DMT Window Interval Configuration Status bits. This bit reflects the value of CFGCON2.DMTINTV. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 227 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18. System Configuration and Register Locking (CFG) 18.1 Overview This device provides several user writable configuration registers related to the configuration and operation of the system. The registers marked with (L) are loadable from Flash via their corresponding FBCFG* registers in the following table. The user must program these FBCFG* registers, which, then, loads the appropriate register after Reset. This device provides a single user writable configuration register related to boot configuration of the device. The BCFG0 register provides control, selection and locking for various features of the device, including Flash BCFG7-0 valid, Flash Signature Bit (read only), Code Protect Status (read only). BCFG0 is a read-only register loaded from Flash register FBCFG0 in the following table. Table 18-1. Writable Configuration Registers Register FBCFG0 FBCFG1/DEVCFG0 FBCFG2/DEVCFG1 FBCFG3/DEVCFG2 FBCFG4/DEVCFG4 FBCFG5/FUSERID Address 0x0004_5F9C 0x0004_5F98 0x0004_5F94 0x0004_5F90 0x0004_5F8C 0x0004_5F88 Destination BCFG0 (0x4400_0200) CFGCON0(L) (0x4400_0000) CFGCON1(L) (0x4400_0010) CFGCON2(L) (0x4400_0020) CFGCON4(L) (0x4400_0040) USERID(L) (0x4400_00A0) CFGCON0(L) Provides control, selection and locking for various features of the device. PPS register locking PMD register locking CFGPG register locking Config register locking Trace port enable Flash ECC control JTAG port enable and configuration CFGCON1(L) Provides control, selection and locking for various features of the device. Debug port and feature configuration CFGCON0 locking control Class B functionality enable CFGCON2(L) Provides control, selection and locking for various features of the device. Deadman timer enable and configuration Watchdog timer enable and configuration Clock monitoring and control Oscillator enable and configuration 2-Speed start-up enabled in the Sleep mode bit CFGCON4(L) Provides control, selection and locking for various features of the device. Deep sleep modules control SOSC configuration control CFGPGQOS The CFGPGQOS register defines the permission group settings for various bus hosts on the device bus matrix. USER_ID(L) The USER_ID register is used to provide the end user with a 16-bit ID field that may be read out directly through the JTAG interface via the USER_ID JTAG instruction. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 228 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... BCFG0 Used to set Code Protect, Sign Bit and control PCHE cache mode. 18.2 Applications 18.2.1 Loading User/Device Configuration Registers The non-BCFG system configuration registers (CFGCON* and CFGCON(L)*) are available in a memory mapped area under software-based locking control. The following registers that do not have permanent storage:
Wi-Fi (RF, BBP, PHY) System Configurations Calibration values, System PLL CRU clock switching Analog calibration values For these registers, the firmware (boot code and/or application code) must allocate nonvolatile storage of system configuration values and load them into the memory mapped system configuration registers during a device boot. The recommended non-volatile storage space in NVR boot memory is shown in the Flash Memory Organization table. See Flash Memory Organization from Related Links. In general, if the Reset value or Flash-loaded value of a system configuration register is the value that is required, then it is not necessary to load the system configuration register during a device boot. Related Links 24.5.2. Flash Memory Organization 18.2.2 Locking and Unlocking the System Configuration Registers Write access to the system configuration registers is controlled via the CFGCON0.CFGLOCK[1:0] register bits. 18.2.3 NMI Events The only system configuration that gets Reset on an NMI event are CPUPG bits in the CFGPGQOS register. This allows application firmware to pass control back to the bootloader and re-enable reads of all configuration words from Boot Flash NVR pages if reads of the Boot Flash pages were disabled using group permissions. 18.2.4 Alternate System Configuration To provide better data retention for the configuration data (compared to the data retention of the rest of the device Flash), each set of DEVCFGx, FBCFG0 registers are duplicated in an alternate set. This improves the chances of correct system configuration out of Reset. In the event of an uncorrectable error in a word (ECC DED), the Flash controller uses the alternate set to obtain the correct data. Table 18-2. Alternate Register Register FBCFG0 DEVCFG0 DEVCFG1 DEVCFG2 DEVCFG4 FUSERID Alternate Register ALTFBCFG0(0004_5E9C) ALTDEVCFG0(0004_5E98) ALTDEVCFG1(0004_5E94) ALTDEVCFG2(0004_5E90) ALTDEVCFG4(0004_5E8C) ALTFUSERID(0004_5E88) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 229 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.3 CFG Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 7:0 CPENFILT ACCMP1_ALT EN GPSOSCE*
ADCOPVR JTAGEN TROEN SWOEN TDOEN 0x00 CFGCON0(L) 0x04
... 0x0F Reserved 0x10 CFGCON1(L) 0x14
... 0x1F Reserved 0x20 CFGCON2(L) 0x24
... 0x3F Reserved 0x40 CFGCON4(L) 0x44
... 0x4F Reserved 0x50 CFGPGQOS 0x54
... 0x5F Reserved 0x60 CFGPCLKGEN1 0x64
... 0x6F Reserved 0x70 CFGPCLKGEN2 0x74
... 0x7F Reserved 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 CFGLOCK[1:0]
IOLOCK PMDLOCK PGLOCK PMULOCK RTCOUT_ALT EN RTCIN0_ALT EN SLRTEN2 SLRTEN1 SLRTEN0 HPLUGDIS SMBUSEN2 SMBUSEN1 SMBUSEN0 VBCMODE FRECCDIS FECCCON/ECCCTL[1:0]
ADCFCEN INT0P INT0E PCM ZBTWKSYS TRCEN ICESEL[1:0]
DEBUG[1:0]
QSCHE_EN SMCLR SLRCTRL2 SLRCTRL1 SLRCTRL0 CLASSBDIS CMP1_OE CMP0_OE I2CDSEL2 I2CDSEL1 I2CDSEL0 CCL_OE CLKZBREF QSPIDDRM SCOM_HSEN[2:0]
WDTPSS[4:0]
QSPI_HSEN PMUTEST_V DD_EN DMTINTV[2:0]
ACMP_CYCLE[2:0]
FSCMEN CKSWEN WAKE2SPD SOSCSEL WDTRMCS[1:0]
POSCMD[1:0]
WDTEN DMTEN WINDIS WDTSPGM WDTPSR[4:0]
DMTCNT[4:0]
WINSZ[1:0]
SOSC_CFG[7:0]
MLPCLK_MO D VBKP_DIVSE L VBKP_32KCSEL[1:0]
VBKP_1KCSE L RTCEVENT_ EN RTCEVENTSEL[1:0]
DSWDTPS[2:0]
DSZPBOREN CPEN_DLY[2:0]
RTCEVTYPE RTCNTM_CS EL LPOSCEN UVREGROVR DSBITEN DSWDTEN DSWDTLPRC DSWDTPS[4:3]
ICDJQOS[1:0]
ICDJPG[1:0]
CPUQOS[1:0]
ICMQOS[1:0]
WISIBQOS[1:0]
ICMPG[1:0]
FCQOS[1:0]
ADCQOS[1:0]
CPUPG[1:0]
DMAPG[1:0]
ADCPG[1:0]
DSUPG[1:0]
RCD S01D TCC12CD CM4TD FREQMRCSEL[2:0]
SERCOM01CSEL[2:0]
TCC12CSEL[2:0]
CM4TCSEL[2:0]
C2D C4D C6D C8D EVSYSC2SEL[2:0]
EVSYSC4SEL[2:0]
EVSYSC6SEL[2:0]
EVSYSC8SEL[2:0]
EICCD MCD S23D TC23CD C1D C3D C5D C7D EICCSEL[2:0]
FREQMMCSEL[2:0]
SERCOM23CSEL[2:0]
TC23CSEL[2:0]
EVSYSC1SEL[2:0]
EVSYSC3SEL[2:0]
EVSYSC5SEL[2:0]
EVSYSC7SEL[2:0]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 230 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... ..........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x80 CFGPCLKGEN3 0x84
... 0x9F Reserved 0xA0 USER_ID 0xA4
... 0x01FF Reserved 0x0200 BCFG0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 C10D C12D TCC0CD TC1CD EVSYSC10SEL[2:0]
EVSYSC12SEL[2:0]
TCC0CSEL[2:0]
TC1CSEL[2:0]
C9D C11D ACCD TC0CD EVSYSC9SEL[2:0]
EVSYSC11SEL[2:0]
ACCLKSEL[2:0]
TC0CSEL[2:0]
USER_ID[7:0]
USER_ID[15:8]
BINFOVALID0 SIGN CP PCSCMODE 18.4 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description. Some registers are synchronized when read and/or written. Synchronization is denoted by the Write-Synchronized or the Read-Synchronized property in each individual register description. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable protection is denoted by the Enable-Protected property in each individual register description. Note:All registers in this table have corresponding CLR, SET and INV registers at its virtual address, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET, and INV Registers from Related Links. Related Links 6.1.9. CLR, SET and INV Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 231 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.4.1 Configuration Control Register 0 Name:
Offset:
Reset:
Property:
CFGCON0(L) 0x00 0x7100000b
The CFGLOCK[1:0] register bits are writable only when CFGLOCK[0] = 1b0. The IOLOCK, PMDLOCK and PGLOCK register bits can only be cleared on a system reset. Thereafter, it is controlled as described above. This register is loaded with trusted data from FBCFG1 during the pre-boot period. Trusted data from Flash means when there is no BCFG* fail status and BINFOVALID = 0 during Flash configuration word reads. If accompanied by a fail status or blank/erase indication, then reset values (described in the register description below) are retained and new values from FBCFG1 are not loaded. Under all conditions, Flash loading is omitted for the following bits in the CFGCON0 and HPLUGDIS register:
IOLOCK CFGLOCK[1:0]
PMDLOC PGLOCK PMULOCK JTAGEN Bit 31 Access Reset Bit Access Reset 23 SLRTEN2 R/W/L 0 30 FRECCDIS R/L 1 22 SLRTEN1 R/W/L 0 29 28 FECCCON/ECCCTL[1:0]
R/W/L 1 R/W/L 1 27 ADCFCEN R/W/L 0 26 INT0P R/W/L 0 25 INT0E R/W/L 0 21 SLRTEN0 R/W/L 0 20 HPLUGDIS R/W 0 19 SMBUSEN2 R/W/L 0 18 SMBUSEN1 R/W/L 0 17 SMBUSEN0 R/W/L 0 Bit 15 14 CFGLOCK[1:0]
13 IOLOCK 12 PMDLOCK 11 PGLOCK 10 9 PMULOCK RTCOUT_ALTE Access Reset R/W/L 0 R/W/L 0 R/S/L 0 R/S/L 0 R/S/L 0 Bit 7 CPENFILT Access Reset R/W/L 0 6 ACCMP1_ALTE N R/W/L 0 5 GPSOSCE*
4 ADCOPVR 3 JTAGEN R/W/L 0 R/W 0 R/W/L 1 R/S/L 0 2 TROEN R/W/L 0 N R/W/L 0 1 SWOEN R/W/L 1 24 PCM R/W/L 1 16 VBCMODE R/W/L 0 8 RTCIN0_ALTE N R/W/L 0 0 TDOEN R/W/L 1 Bit 30 FRECCDISFlex RAM ECC Control Notes:
This bit is only writable when CFGLOCK[1:0] is 00. Only a read-only fuse bit, sets the initialization value of RAMECC Control. True RAMECC override is available in RAMECC module. Value 1 0 Description ECC is disabled ECC is enabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 232 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Bits 29:28 FECCCON/ECCCTL[1:0]Flash ECC Control Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 11 10 01 00 Description ECC and dynamically ECC are disabled ECC and dynamically ECC are disabled Dynamically ECC is enabled ECC is enabled (NVMOP = Word Programming disabled) Bit 27 ADCFCENADC FC Channel Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Exclusive ADC FC Channel Enable (Disables all second/third class channels) ADC FC Channel Disable (Only second/third class channels are enabled) Bit 26 INT0PINT0P Polarity Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description INT0 Polarity (Positive) INT0 Polarity (Negative) Bit 25 INT0EINT0 Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description INT0 is enabled INT0 is disabled Bit 24 PCMPCHE I/D Cacheable Mode Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Always enabled from outside. Can be further enabled/disabled by PCHE SFR registers. The cache-ability is controlled by the CPU via HPROT[3]. This feature is not available on all the ARM cores. Bit 23 SLRTEN2SLRT Enable for SERCOM2 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Slew rate is enabled Slew rate is disabled Bit 22 SLRTEN1SLRT Enable for SERCOM1 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Slew rate is enabled Slew rate is disabled Bit 21 SLRTEN0SLRT Enable for SERCOM0 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Slew rate is enabled Slew rate is disabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 233 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Bit 20 HPLUGDISHot Plugging Disable (outside fuse loading) Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Hot Plugging is disabled Hot Plugging is enabled Bit 19 SMBUSEN2SMBus Enable for SERCOM2 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description SMBus is enabled SMBus is disabled Bit 18 SMBUSEN1SMBus Enable for SERCOM1 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description SMBus is enabled SMBus is disabled Bit 17 SMBUSEN0SMBus Enable for SERCOM0 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description SMBus is enabled SMBus is disabled Bit 16 VBCMODEVBC Operating Mode Notes:
This bit is only writable when CFGLOCK[1:0] is 00. Do not change this field if there are pending accesses to VDDBKUPCORE memory map. Failing to do so may result in unexpected data. Value 1 0 Description Indirect addressing. The VDDBKUPCORE IO mapped using PMU Controller. Direct addressing. The VDDBKUPCORE memory mapped on PB-Bridge-B. Bits 15:14 CFGLOCK[1:0]Configuration Register Lock Note:This bit is only writable when CFGLOCK[1:0] is 00 or 10. Value 11 10 01 00 Description All NVR memory self-writes, Boot Configuration (BCFG0) and System Configuration registers (CFG*
and USER_ID) are locked and cannot be written CFGLOCK value cannot be changed. All NVR memory self-writes, Boot Configuration (BCFG0) and System Configuration registers (CFG*
and USER_ID) are locked and cannot be written CFGLOCK value can be changed. Reserved for future use All NVR memory self-writes, Boot Configuration (BCFG0) and System Configuration registers (CFG*
and USER_ID) are not locked and can be written CFGLOCK value can be changed. Bit 13 IOLOCKI/O Lock Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description I/O Remap SFR bits are locked and cannot be modified I/O Remap SFR are not locked and can be modified Bit 12 PMDLOCKPeripheral Module Disable (PMD) Lock Note:This bit is only writable when CFGLOCK[1:0] is 00. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 234 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 1 0 Description PMDx SFR bits are locked and cannot be modified PMDx SFR bits are not locked and can be modified Bit 11 PGLOCKPermission Group Lock Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description CFGPG SFR bits are locked and cannot be modified CFGPG SFR bits are not locked and can be modified Bit 10 PMULOCKPMU Controller Register Lock Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description PMU* SFR bits are locked and cannot be modified PMU* SFR bits are not locked and can be modified Bit 9 RTCOUT_ALTENRTCOUT Alternate Enable Notes:
This bit is only writable when CFGLOCK[1:0] is 00. RTC alternate output is unavailable on PA10 in sleep modes (Deep Sleep and Extreme Deep Sleep). Value 1 0 Description RTC/OUT is available on PA10 RTC/OUT is available on PA4 Bit 8 RTCIN0_ALTENRTCIN0 Alternate Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description RTC/IN0 is available on PA9 RTC/IN0 is available on PA3 Bit 7 CPENFILTADC CP Filter Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description ADC CP filter is enabled ADC CP filter is disabled Bit 6 ACCMP1_ALTENAC CMP1 Alternate Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description AC/CMP1 Out is available on PA6 AC/CMP1 Out is available on PA1 Bit 5 GPSOSCE*GPIO/SOSC Enable* This bit is not applicable to 48-pin devices PIC32CX1012BZ25048. Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description SOSC is selected GPIO is selected Bit 4 ADCOPVRADC Charge Pump Override Notes:
This bit is only writable when CFGLOCK[1:0] is 00. This bit is not fuse loadable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 235 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 1 0 Description Overriden (software controlled) Hardware controlled Bit 3 JTAGENJTAG Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description JTAG port is enabled JTAG port is disabled Bit 2 TROENTrace Output Enable Notes:
When CFGCON1.TRCEN = 0, the value of this bit is ignored but has the effect of being 0. This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Starts Trace Clock and enables Trace Outputs (Trace probe must be present) Stops Trace Clock and disables Trace Outputs Bit 1 SWOENSWO enable on 2-wire debug interface Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description SWO is enabled SWO is disabled Bit 0 TDOENTDO enable for 2-wire JTAG Implementing the JTAG protocol over the 2-wire interface requires four 2-wire clocks for each TCK if TDO is required. However, if the values shifted out TDO are predetermined, then TDO can be disabled, saving two 2-wire clocks. Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description 2-wire JTAG protocol uses TDO (Four phase (Full Duplex) protocol) 2-wire JTAG protocol does not use TDO (Two phase (Half Duplex) protocol) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 236 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.4.2 Configuration Control Register 1 Name:
Offset:
Reset:
Property:
CFGCON1(L) 0x10 0x1f00443b
This register is loaded with trusted data from FBCFG2 during the pre-boot period. Thereafter, it is controlled as described above. Trusted data from Flash means when there is no BCFG* fail status during Flash configuration word reads. If accompanied by fail status or blank/erase indication, then reset values (described in the register description below) are retained, and new values from FBCFG2 are not loaded. Under all conditions, Flash loading is omitted for the following bits in the CFGCON1 register:
DEBUG[1:0]
Bit 31 30 CLKZBREF R/W/L 0 29 QSPIDDRM R/W/L 0 23 I2CDSEL2 R/W/L 0 22 I2CDSEL1 R/W/L 0 21 I2CDSEL0 R/W/L 0 Access Reset Bit Access Reset 28 27 R/W/L 1 20 CCL_OE R/W/L 0 R/W/L 1 19 R/W/L 0 26 WDTPSS[4:0]
R/W/L 1 18 SCOM_HSEN[2:0]
R/W/L 0 25 24 R/W/L 1 17 R/W/L 0 R/W/L 1 16 QSPI_HSEN R/W/L 0 Bit 15 QSCHE_EN Access Reset R/W/L 0 14 SMCLR R/W/L 1 13 SLRCTRL2 R/W/L 0 12 SLRCTRL1 R/W/L 0 11 SLRCTRL0 R/W/L 0 10 CLASSBDIS R/W/L 1 9 CMP1_OE R/W/L 0 8 CMP0_OE R/W/L 0 Bit 7 6 ZBTWKSYS Access Reset R/W/L 0 5 TRCEN R/W/L 1 4 3 2 ICESEL[1:0]
R/W/L 1 R/W/L 1 1 0 DEBUG[1:0]
R/W/L 1 R/W/L 1 Bit 30 CLKZBREFExternal Reference Clock Zigbee Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Enable clk_zb_to_ext on PPS.REFO1 No clk_zb_to_ext on PPS.REFO1, PPS.REFO1 is unchanged Bit 29 QSPIDDRMQSPI DDR Mode Clock Enable Notes:
When using the QSPI DDR Mode, System Clock (SYS_CLK) must be <= 48 MHz. This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description QSPI DDR Mode Clock Enable Disabled Bits 28:24 WDTPSS[4:0]Watchdog Timer Post-scale Select Sleep bits Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 10100 10011 Description 1:1048576 1:524288 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 237 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 10010 10001 10000 01111 01110 01101 01100 01011 01010 01001 01000 00111 00110 00101 00100 00011 00010 00001 00000 Description 1:262144 1:131072 1:65536 1:32768 1:16384 1:8192 1:4096 1:2048 1:1024 1:512 1:256 1:128 1:64 1:32 1:16 1:8 1:4 1:2 1:1 Bit 23 I2CDSEL2I2C Delay Select for SERCOM2 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description I2C Delay Enabled I2C Delay Disabled Bit 22 I2CDSEL1I2C Delay Select for SERCOM1 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description I2C delay is enabled I2C delay is disabled Bit 21 I2CDSEL0I2C Delay Select for SERCOM0 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description I2C delay is enabled I2C delay is disabled Bit 20 CCL_OECCL Pads (via PPS) Output Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description CCL pads (via PPS) output is enabled CCL pads (via PPS) output is disabled Bits 19:17 SCOM_HSEN[2:0]SCOM (Direct) Enable, 17 = SCOM0, 18 = SCOM1, 19 = SCOM2 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Direct mode (High-Speed) via PPS 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 238 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Bit 16 QSPI_HSENQSPI (Direct) Enable Notes:
This bit is only writable when CFGLOCK[1:0] is 00. In Direct mode. Value 1 0 Description Direct mode (High-Speed) via PPS Bit 15 QSCHE_ENQSPI Address Space Cache Attribute Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Cache attribute is enabled Caching is disabled Bit 14 SMCLRSelects CRU handling of MCLR Control Note:This bit is only writable when CFGLOCK[1:0] is 00 or 10. Value 1 0 Description Legacy mode (system clear does not reset all state of device) MCLR causes a faux POR Bit 13 SLRCTRL2I2C Delay Select for SERCOM2 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Slew rate control is configured via SERCOM configuration Slew rate control is configured via GPIO configuration Bit 12 SLRCTRL1I2C Delay Select for SERCOM1 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Slew rate control is configured via SERCOM configuration Slew rate control is configured via GPIO configuration Bit 11 SLRCTRL0I2C Delay Select for SERCOM0 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Slew rate control is configured via SERCOM configuration Slew rate control is configured via GPIO configuration Bit 10 CLASSBDISDisable CLASSB Device Functionality Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description CLASSB functions are disabled CLASSB functions are enabled Bit 9 CMP1_OEAnalog Comparator-1 Output Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description AC1 Output is enabled AC1 Output is disabled Bit 8 CMP0_OEAnalog Comparator-0 Output Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 239 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 1 0 Description AC0 Output is enabled AC0 Output is disabled Bit 7 ZBTWKSYSZigbee Bluetooth Subsystem External Wake-up source Notes:
Write-only bit, with read-as-zero; when written to 1, creates one clk_lp_cycle wide pulse on Zigbee Bluetooth Subsystem.external_NMI0 pin. This enables external system wake-up to Bluetooth subsystem. This allows CPU and Bluetooth subsystem wake-up/sleep to be independent of each other. Flash fuse loading is excluded for this bit. Bit 5 TRCENTrace Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Trace features in the CPU are enabled Trace features in the CPU are disabled Bits 4:3 ICESEL[1:0]EMUC/EMUD Communication Channel Select Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 11 10 01 00 Description ICE EMUC1/EMUD1 pins are shared with PGC1/PGD1 ICE EMUC2/EMUD2 pins are shared with PGC2/PGD2 ICE EMUC3/EMUD3 pins are shared with PGC3/PGD3 (Not used on this device) ICE EMUC4/EMUD4 pins are shared with PGC4/PGD4 Bits 1:0 DEBUG[1:0]Background Debugger Access Selection Notes:
1. 2. 3. JTAGEN = 0 prevents 4-wire JTAG Debugging but not EMUC/EMUD debugging. If CPN = 0, then the JTAG TAP controller denies access to the EJTAG TAP Controller (i.e., the SWTAP command is ignored) and, therefore, external access to the debugging features is denied. This bit is only writable when CFGLOCK[1:0] = 00. Value 11 10 01 00 Description 4-wire JTAG I/F is enabled; EMUC/EMUD is disabled; ICD module is disabled 4-wire JTAG I/F is enabled; EMUC/EMUD is disabled; ICD module is enabled EMUC/EMUD is enabled; 4-wire JTAG I/F is disabled; ICD module is disabled EMUC/EMUD is enabled; 4-wire JTAG I/F is disabled; ICD module is enabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 240 WINSZ[1:0]
R/W/L 1 R/W/L 1 17 16 R/W/L 1 R/W/L 1 9 8 POSCMD[1:0]
R/W/L 1 R/W/L 1 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.4.3 Configuration Control Register 2 Name:
Offset:
Reset:
Property:
CFGCON2(L) 0x20 0x00
This register is loaded with trusted data from FBCFG3 during pre-boot period. Thereafter, it is controlled as described above. Trusted data from Flash means when there is no BCFG* fail status during Flash configuration word reads. If accompanied by fail status or blank/erase indication then reset values (described in the register description below) are retained and new values from FBCFG3 are not loaded. Bit Access Reset 31 DMTEN R/W/L 0 Bit 23 WDTEN R/W/L 0 Access Reset 30 29 R/W/L 1 22 WINDIS R/W/L 1 R/W/L 1 21 WDTSPGM R/W/L 1 27 26 25 24 28 DMTCNT[4:0]
R/W/L 1 R/W/L 1 R/W/L 1 20 19 R/W/L 1 R/W/L 1 18 WDTPSR[4:0]
R/W/L 1 Bit Access Reset 15 FSCMEN R/W/L 1 14 CKSWEN R/W/L 1 13 WAKE2SPD R/W/L 1 12 SOSCSEL R/W/L 1 11 10 WDTRMCS[1:0]
R/W/L 1 R/W/L 1 Bit 7 PMUTEST_VD D_EN R/W/L 0 Access Reset 6 5 4 DMTINTV[2:0]
3 2 1 ACMP_CYCLE[2:0]
0 R/W/L 1 R/W/L 1 R/W/L 1 R/W/L 0 R/W/L 0 R/W/L 0 Bit 31 DMTENDead Man Timer Enable bit Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description DMT is enabled DMT is disabled (control is placed on the DMTCON.ON bit) Bits 30:26 DMTCNT[4:0]Dead Man Timer Count Select bits Notes:
This bit is only writable when CFGLOCK[1:0] is 00. On devices where the DMTCNT[4:0] configuration field is loaded. Value 00000 00001
... 10100 10101 10110 10111 11000 -
11111 Description Counter value is 2^8 for cfg_dmt_cnt[31:0]
Counter value is 2^9 for cfg_dmt_cnt[31:0]
... Counter value is 2^28 for cfg_dmt_cnt[31:0]
Counter value is 2^29 for cfg_dmt_cnt[31:0]
Counter value is 2^30 for cfg_dmt_cnt[31:0]
Counter value is 2^31 for cfg_dmt_cnt[31:0]
Reserved 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 241 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Bits 25:24 WINSZ[1:0]Watchdog Timer Window Size bits Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 00 01 10 11 Description Window size is 75%
Window size is 50%
Window size is 37.5%
Window size is 25%
Bit 23 WDTENWatchdog Timer Enable bit Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description WDT is enabled WDT is disabled (control is placed on the SWDTEN bit) Bit 22 WINDISWindowed Watchdog Timer Disable bit Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Standard WDT is selected; windowed WDT disabled Windowed WDT is enabled Bit 21 WDTSPGMWatchdog Timer Stop during Flash Programming bit Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description The WDT stops during NVR programming (legacy) The WDT runs during NVR programming (for read/execute while programming Flash systems) Bits 20:16 WDTPSR[4:0]Watchdog Timer Post-scale Select Run bits Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 10100 10011 10010 10001 10000 01111 01110 01101 01100 01011 01010 01001 01000 00111 00110 00101 00100 00011 00010 00001 00000 Description 1:1048576 1:524288 1:262144 1:131072 1:65536 1:32768 1:16384 1:8192 1:4096 1:2048 1:1024 1:512 1:256 1:128 1:64 1:32 1:16 1:8 1:4 1:2 1:1 Bit 15 FSCMENFail-Safe Clock Monitor Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 242 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 1 0 Description FSCM enabled FSCM disabled Bit 14 CKSWENSoftware Clock Switching Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Software clock switching is enabled Software clock switching is disabled Bit 13 WAKE2SPD2-Speed startup enabled in Sleep mode bit Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description When the device exits the Sleep mode, the SYS_CLK will be from FRC until the selected clock is ready. Not applicable. Bit 12 SOSCSELSOSC Selection Configuration bit Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Crystal (SOSCI/SOSCO) mode is selected Digital (SCLKI) mode is selected Bits 11:10 WDTRMCS[1:0]WDT RUN Mode Clock Select Note:This bit is only writable when CFGLOCK[1:0] is 00 or 10. Value 11 10 01 00 Description LPRC Do not use Do not use Module PB Clock Bits 9:8 POSCMD[1:0]Primary Oscillator Configuration bits Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 11 10 01 00 Description Primary oscillator is disabled HS oscillator mode is selected HS oscillator mode is selected HS oscillator mode is selected Bit 7 PMUTEST_VDD_ENPMU Test Output or VDD/2 Enable via ADC IE12 Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description PMU test output monitor is enabled VDD/2 monitor is enabled Bits 5:3 DMTINTV[2:0]Dead Man Timer Count Window Interval bits Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 000 001 010 011 100 Description Window/Interval value is zero for cfg_dmt_intv[31:0] - windowed mode is disabled Window/Interval value is 1/2 Counter value for cfg_dmt_intv[31:0]
Window/Interval value is 3/4 Counter value for cfg_dmt_intv[31:0]
Window/Interval value is 7/8 Counter value for cfg_dmt_intv[31:0]
Window/Interval value is 15/16 Counter value for cfg_dmt_intv[31:0]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 243 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 101 110 111 Description Window/Interval value is 31/32 Counter value for cfg_dmt_intv[31:0]
Window/Interval value is 63/64 Counter value for cfg_dmt_intv[31:0]
Window/Interval value is 127/128 Counter value for cfg_dmt_intv[31:0]
Bits 2:0 ACMP_CYCLE[2:0]AC SIB Comparator Result Wait Cycles Note:This bit is only writable when CFGLOCK[1:0] is 00. Value n Description Wait for 32s* ACMP_CYCLE+1 cycles to generate comparator done indication 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 244 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.4.4 Configuration Control Register 4 Name:
Offset:
Reset:
Property:
CFGCON4(L) 0x40 0x840e4000
This register is loaded with trusted data from FBCFG4/DEVCFG4 during the pre-boot period. Trusted data from Flash means when there is no BCFG* fail status during Flash configuration word reads. If accompanied by fail status BCFGFAIL (RCON[26]) or blank/erase indication, then reset values (described in the following register description) are retained and new values from FBCFG4 are not loaded. 30 LPOSCEN 29 UVREGROVR 28 DSBITEN 27 DSWDTEN 26 DSWDTLPRC 25 24 DSWDTPS[4:3]
Bit 31 RTCNTM_CSE L R/W/L 1 Access Reset R/W/L 0 Bit 23 Access Reset R/W/L 0 22 DSWDTPS[2:0]
R/W/L 0 R/W/L 0 21 R/W/L 0 R/W/L 0 20 DSZPBOREN R/W/L 0 R/W/L 0 19 R/W/L 1 R/W/L 1 18 CPEN_DLY[2:0]
R/W/L 1 R/W/L 0 17 R/W/L 1 R/W/L 0 16 RTCEVTYPE R/W/L 0 Bit 15 14 13 12 11 10 9 8 MLPCLK_MOD VBKP_DIVSEL VBKP_32KCSEL[1:0]
VBKP_1KCSEL RTCEVENT_E RTCEVENTSEL[1:0]
Access Reset R/W/L 0 R/W/L 1 R/W/L 0 R/W/L 0 R/W/L 0 Bit 7 6 5 4 3 SOSC_CFG[7:0]
N R/W/L 0 R/W/L 0 R/W/L 0 2 1 0 Access Reset R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 Bit 31 RTCNTM_CSELRTCC Counter Mode Clock Select Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Raw 32 KHz clock Processed 32 KHz clock Bit 30 LPOSCENLow Power (Secondary) Oscillator Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Low Power (Secondary) Oscillator, also at Reset is enabled Low Power (Secondary) Oscillator is disabled Bit 29 UVREGROVRULPVREG Retention Mode Override Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description ULPVREG forced in the Retention mode ULPVREG controlled by XDS/DS FSM Bit 28 DSBITENDeep Sleep Bit Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 245 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 1 0 Description DS bit in DSCON is enabled DS bit in DSCON is disabled Bit 27 DSWDTENDeep Sleep Watchdog Timer Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description DSWDT during deep sleep is enabled DSWDT during deep sleep is disabled Bit 26 DSWDTLPRCDeep Sleep Watchdog Timer Reference Clock Select Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Select LPRC as DSWDT reference clock Select SOSC as DSWDT reference clock Bits 25:21 DSWDTPS[4:0]Deep Sleep Watchdog Timer Postscale Select The DS WDT prescaler is 32; this creates an approximate base time unit of 1 ms. Note:These bits are only writable when CFGLOCK[1:0] is 00. Value 11111 11110 11101 11100 11011 11010 11001 11000 10111 10110 10101 10100 10011 10010 10001 10000 01111 01110 01101 01100 01011 01010 01001 01000 00111 00110 00101 00100 00011 00010 00001 00000 Description 1:236 (25.7 days) 1:235 (12.8 days) 1:234 (6.4 days) 1:233 (77.0 hours) 1:232 (38.5 hours) 1:231 (19.2 hours) 1:230 (9.6 hours) 1:229 (4.8 hours) 1:228 (2.4 hours) 1:227 (72.2 minutes) 1:226 (36.1 minutes) 1:225 (18.0 minutes) 1:224 (9.0 minutes) 1:223 (4.5 minutes) 1:222 (135.3 s) 1:221 (67.7 s) 1:220 (33.825 s) 1:219 (16.912 s) 1:218 (8.456 s) 1:217 (4.228 s) 1:65536 (2.114 s) 1:32768 (1.057 s) 1:16384 (528.5 ms) 1:8192 (264.3 ms) 1:4096 (132.1 ms) 1:2048 (66.1 ms) 1:1024 (33 ms) 1:512 (16.5 ms) 1:256 (8.3 ms) 1:128 (4.1 ms) 1:64 (2.1 ms) 1:32 (1 ms) Bit 20 DSZPBORENDeep Sleep Zero-Power BOR Enable Note:This bit is only writable when CFGLOCK[1:0] is 00. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 246 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 1 0 Description ZPBOR during deep sleep is enabled ZPBOR during deep sleep is disabled Bits 19:17 CPEN_DLY[2:0]Charge-pump Ready Digital Delay (Safety delay to Analog CP Ready) n = (n+1) LPRC Clock Cycle Delay Note:These bits are only writable when CFGLOCK[1:0] is 00. Bit 16 RTCEVTYPERTCC Event Type Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description RTC_EVENT RTC_OUT Bit 15 MLPCLK_MODLPCLK Modifier in Counter/Delay Mode Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Divide-by 1.024 (Recommended, when LPCLK = 32.768 KHz) Divide-by 1 (Recommended, when LPCLK = 32 KHz) Bit 14 VBKP_DIVSELVDDBUKPCORE LPCLK Clock Divider Selection Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Divide by 31.25 (Recommended, when LPCLK = 32 KHz) Divide-by 32 (Recommended, when LPCLK = 32.768 KHz) Bits 13:12 VBKP_32KCSEL[1:0]VDDBUKPCORE 32 KHz Clock Source Selection Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 11 10 01 00 Description LPRC SOSC POSC FRC Bit 11 VBKP_1KCSELVDDBUKPCORE LPCLK Clock Selection Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description Divide by 32 or 31.25 clock depending on VBKP_DIVSEL 32 KHz low power clock Bit 10 RTCEVENT_ENOutput Enable for RTCC Event Output Note:This bit is only writable when CFGLOCK[1:0] is 00. Value 1 0 Description RTCC-Event output is enabled RTCC-Event output is disabled Bits 9:8 RTCEVENTSEL[1:0]RTCC Event Selection Note:These bits are only writable when CFGLOCK[1:0] is 00. Value 00 01 1x Description 1-Second clock Alarm pulse 32 KHz clock 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 247 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Bits 7:0 SOSC_CFG[7:0]SOSC Configuration Bits Note:These bits are only writable when CFGLOCK[1:0] is 00. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 248 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.4.5 Permission Group Configuration Name:
Offset:
Reset:
Property:
CFGPGQOS 0x50 0xe040004c
All bits in this register are writable only when CFGCON0.PGLOCK = 0. There is no Flash location for this register because the purpose of this register is to provide a software-based protection mechanism to a device memory-mapped region, which is typically handled by a trusted boot/OScode. Note:Ensure this register is programmed to the values shown: 0xE040_004C if you are not using Microchip-
provided boot code. Bit 31 30 29 28 27 26 25 24 WISIBQOS[1:0]
FCQOS[1:0]
Access Reset R/W/L 1 R/W/L 1 R/W/L 1 R/W/L 0 Bit 23 22 21 20 ICMQOS[1:0]
ICMPG[1:0]
Access Reset R/W/L 0 R/W/L 1 R/W/L 0 R/W/L 0 19 18 ADCQOS[1:0]
R/W/L 0 R/W/L 0 DSUPG[1:0]
R/W/L 0 R/W/L 0 17 16 ADCPG[1:0]
R/W/L 0 R/W/L 0 Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 ICDJQOS[1:0]
ICDJPG[1:0]
Access Reset R/W/L 0 R/W/L 1 R/W/L 0 R/W/L 0 3 2 CPUQOS[1:0]
R/W/L 1 R/W/L 1 Bits 31:30 WISIBQOS[1:0]Wireless SIB QOS Control bits Note:This field is only writable when CFGCON0.PGLOCK = 0. DMAPG[1:0]
R/W/L 0 R/W/L 0 1 0 CPUPG[1:0]
R/W/L 0 R/W/L 0 Value 00 01 10 11 Description Disable; Background Low; Sensitive bandwidth Medium; Sensitive latency High; Critical latency Bits 29:28 FCQOS[1:0]FC Controller QOS Control bits Note:This field is only writable when CFGCON0.PGLOCK = 0. Value 00 01 10 11 Description Disable; Background Low; Sensitive bandwidth Medium; Sensitive latency High; Critical latency Bits 25:24 DSUPG[1:0]DSU Permission Group, drive the inputs cfg_dsu_pg[1:0] directly to the SSX The DSU bus host has access to Access Controlled memory regions as defined by the bit-fields RDPER[3:0] and WRPER[3:0] in the Bus Structures Permission Groups SFRs for these memory regions. The encoding works as follows:
DSUPG[1:0] == 2b11 : Read Access if RDPER[3]==1, Write Access if WRPER[3]==1 (Perm. Grp. 3) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 249 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... DSUPG[1:0] == 2b10 : Read Access if RDPER[2]==1, Write Access if WRPER[2]==1 (Perm. Grp. 2) DSUPG[1:0] == 2b01 : Read Access if RDPER[1]==1, Write Access if WRPER[1]==1 (Perm. Grp. 1) DSUPG[1:0] == 2b00 : Read Access if RDPER[0]==1, Write Access if WRPER[0]==1 (Perm. Grp. 0) Note:This field is only writable when CFGCON0.PGLOCK = 0. Bits 23:22 ICMQOS[1:0]ICM QOS Control bits Note:This field is only writable when CFGCON0.PGLOCK = 0. Value 00 01 10 11 Description Disable; Background Low; Sensitive bandwidth Medium; Sensitive latency High; Critical latency Bits 21:20 ICMPG[1:0]ICM Permission Group, drive the inputs cfg_icm_pg[1:0] directly to the SSX The ICM bus host has access to Access Controlled memory regions as defined by the bit-fields RDPER[3:0] and WRPER[3:0] in the Bus Structures Permission Groups SFRs for these memory regions. The encoding works as follows:
ICMPG[1:0] == 2b11 : Read Access if RDPER[3]==1, Write Access if WRPER[3]==1 (Perm. Grp. 3) ICMPG[1:0] == 2b10 : Read Access if RDPER[2]==1, Write Access if WRPER[2]==1 (Perm. Grp. 2) ICMPG[1:0] == 2b01 : Read Access if RDPER[1]==1, Write Access if WRPER[1]==1 (Perm. Grp. 1) ICMPG[1:0] == 2b00 : Read Access if RDPER[0]==1, Write Access if WRPER[0]==1 (Perm. Grp. 0) Note:This field is only writable when CFGCON0.PGLOCK = 0. Bits 19:18 ADCQOS[1:0]ADC Controller QOS Control bits Note:This field is only writable when CFGCON0.PGLOCK = 0. Value 00 01 10 11 Description Disable; Background Low; Sensitive bandwidth Medium; Sensitive latency High; Critical latency Bits 17:16 ADCPG[1:0]ADC Controller Permission Group, drive the inputs cfg_adc_pg[1:0] directly to the SSX The ADC bus host has access to Access Controlled memory regions as defined by the bit-fields RDPER[3:0] and WRPER[3:0] in the Bus Structures Permission Groups SFRs for these memory regions. The encoding works as follows:
ADCPG[1:0] == 2b11 : Read Access if RDPER[3]==1, Write Access if WRPER[3]==1 (Perm. Grp. 3) ADCPG[1:0] == 2b10 : Read Access if RDPER[2]==1, Write Access if WRPER[2]==1 (Perm. Grp. 2) ADCPG[1:0] == 2b01 : Read Access if RDPER[1]==1, Write Access if WRPER[1]==1 (Perm. Grp. 1) ADCPG[1:0] == 2b00 : Read Access if RDPER[0]==1, Write Access if WRPER[0]==1 (Perm. Grp. 0) Note:This field is only writable when CFGCON0.PGLOCK = 0. Bits 9:8 DMAPG[1:0]DMA (Rd/Wr) Permission Group, drive the inputs cfg_dma_pg[1:0] directly to the SSX The DMA bus host has access to Access Controlled memory regions as defined by the bit-fields RDPER[3:0] and WRPER[3:0] in the Bus Structures Permission Groups SFRs for these memory regions. The encoding works as follows:
DMAPG[1:0] == 2b11 : Read Access if RDPER[3]==1, Write Access if WRPER[3]==1 (Perm. Grp. 3) DMAPG[1:0] == 2b10 : Read Access if RDPER[2]==1, Write Access if WRPER[2]==1 (Perm. Grp. 2) DMAPG[1:0] == 2b01 : Read Access if RDPER[1]==1, Write Access if WRPER[1]==1 (Perm. Grp. 1) DMAPG[1:0] == 2b00 : Read Access if RDPER[0]==1, Write Access if WRPER[0]==1 (Perm. Grp. 0) Note:This field is only writable when CFGCON0.PGLOCK = 0. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 250 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Bits 7:6 ICDJQOS[1:0]ICD-JTAG Bus QOS Control bits Note:This field is only writable when CFGCON0.PGLOCK = 0. Value 00 01 10 11 Description Disable; Background Low; Sensitive bandwidth Medium; Sensitive latency High; Critical latency Bits 5:4 ICDJPG[1:0]ICD-JTAG Permission Group, drive the inputs cfg_icdj_pg[1:0] directly to the SSX The ICD-JTAG bus host has access to Access Controlled memory regions as defined by the bit-fields RDPER[3:0]
and WRPER[3:0] in the Bus Structures Permission Groups SFRs for these memory regions. The encoding works as follows:
ICDJPG[1:0] == 2b11 : Read Access if RDPER[3]==1, Write Access if WRPER[3]==1 (Perm. Grp. 3) ICDJPG[1:0] == 2b10 : Read Access if RDPER[2]==1, Write Access if WRPER[2]==1 (Perm. Grp. 2) ICDJPG[1:0] == 2b01 : Read Access if RDPER[1]==1, Write Access if WRPER[1]==1 (Perm. Grp. 1) ICDJPG[1:0] == 2b00 : Read Access if RDPER[0]==1, Write Access if WRPER[0]==1 (Perm. Grp. 0) Note:This field is only writable when CFGCON0.PGLOCK = 0. Bits 3:2 CPUQOS[1:0]CPU I/D and System Bus QOS Control bits Note:This field is only writable when CFGCON0.PGLOCK = 0. Value 00 01 10 11 Description Disable; Background Low; Sensitive bandwidth Medium; Sensitive latency High; Critical latency Bits 1:0 CPUPG[1:0]CPU (Code) Permission Group, drive the inputs cfg_cpu_pg[1:0] directly to the SSX The CPU Bus host has access to Access Controlled memory regions as defined by the bit fields RDPER[3:0] and WRPER[3:0] in the Bus Structures Permission Groups SFRs for these memory regions. The encoding works as follows:
CPUPG[1:0] == 2b11 : Read Access if RDPER[3]==1, Write Access if WRPER[3]==1 (Perm. Grp. 3) CPUPG[1:0] == 2b10 : Read Access if RDPER[2]==1, Write Access if WRPER[2]==1 (Perm. Grp. 2) CPUPG[1:0] == 2b01 : Read Access if RDPER[1]==1, Write Access if WRPER[1]==1 (Perm. Grp. 1) CPUPG[1:0] == 2b00 : Read Access if RDPER[0]==1, Write Access if WRPER[0]==1 (Perm. Grp. 0) Notes:
CPUPG[1:0] automatically reverts to 2b00 when the CPU acknowledges entering into an NMI exception as indicated by its STAUS[NMI] bit, which is carried by the cpu1_si_nmitaken system signal. This field is only writable when CFGCON0.PGLOCK = 0. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 251 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.4.6 Peripheral Clock Generator 1 Name:
Offset:
Reset:
Property:
CFGPCLKGEN1 0x60 0x00
The CFGPCLKGEN1 dictates the peripheral clock selection described in the Clock System chapter. There is no Flash location for this register because the purpose of this register is to provide an application-based peripheral clocking selection. This is best handled in the application software drivers. Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 CM4TD R/W 0 23 TCC12CD R/W 0 15 S01D R/W 0 7 RCD R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 CM4TCSEL[2:0]
R/W 0 21 TCC12CSEL[2:0]
R/W 0 13 SERCOM01CSEL[2:0]
R/W 0 5 FREQMRCSEL[2:0]
R/W 0 28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 27 TC23CD R/W 0 19 S23D R/W 0 11 MCD R/W 0 3 EICCD R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 TC23CSEL[2:0]
R/W 0 17 SERCOM23CSEL[2:0]
R/W 0 9 FREQMMCSEL[2:0]
R/W 0 1 EICCSEL[2:0]
R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bit 31 CM4TDPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 30:28 CM4TCSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 27 TC23CDPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 26:24 TC23CSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 Description No clock is selected 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 252 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 1-6 7 Description REFO1-6 clock is selected Low power clock is selected Bit 23 TCC12CDPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 22:20 TCC12CSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 19 S23DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 18:16 SERCOM23CSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 15 S01DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 14:12 SERCOM01CSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 11 MCDPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 10:8 FREQMMCSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 253 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 7 RCDPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 6:4 FREQMRCSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 3 EICCDPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 2:0 EICCSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 254 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.4.7 Peripheral Clock Generator 2 Name:
Offset:
Reset:
Property:
CFGPCLKGEN2 0x70 0x00
The CFGPCLKGEN2 dictates the peripheral clock selection described in the Clock System chapter. There is no Flash location for this register because the purpose of this register is to provide an application-based peripheral clocking selection. This is best handled in the application software drivers. Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 C8D R/W 0 23 C6D R/W 0 15 C4D R/W 0 7 C2D R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 EVSYSC8SEL[2:0]
R/W 0 21 EVSYSC6SEL[2:0]
R/W 0 13 EVSYSC4SEL[2:0]
R/W 0 5 EVSYSC2SEL[2:0]
R/W 0 28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 27 C7D R/W 0 19 C5D R/W 0 11 C3D R/W 0 3 C1D R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 EVSYSC7SEL[2:0]
R/W 0 17 EVSYSC5SEL[2:0]
R/W 0 9 EVSYSC3SEL[2:0]
R/W 0 1 EVSYSC1SEL[2:0]
R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bit 31 C8DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 30:28 EVSYSC8SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 27 C7DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 26:24 EVSYSC7SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 Description No clock is selected 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 255 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 1-6 7 Description REFO1-6 clock is selected Low power clock is selected Bit 23 C6DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 22:20 EVSYSC6SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 19 C5DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 18:16 EVSYSC5SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 15 C4DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 14:12 EVSYSC4SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 11 C3DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 10:8 EVSYSC3SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 256 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 7 C2DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 6:4 EVSYSC2SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 3 C1DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 2:0 EVSYSC1SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 257 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.4.8 Peripheral Clock Generator 3 Name:
Offset:
Reset:
Property:
CFGPCLKGEN3 0x80 0x00
The CFGPCLKGEN3 dictates the peripheral clock selection described in the Clock System chapter. There is no Flash location for this register because the purpose of this register is to provide an application-based peripheral clocking selection. This is best handled in the application software drivers. Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 TC1CD R/W 0 23 TCC0CD R/W 0 15 C12D R/W 0 7 C10D R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 TC1CSEL[2:0]
R/W 0 21 TCC0CSEL[2:0]
R/W 0 13 EVSYSC12SEL[2:0]
R/W 0 5 EVSYSC10SEL[2:0]
R/W 0 28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 27 TC0CD R/W 0 19 ACCD R/W 0 11 C11D R/W 0 3 C9D R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 TC0CSEL[2:0]
R/W 0 17 ACCLKSEL[2:0]
R/W 0 9 EVSYSC11SEL[2:0]
R/W 0 1 EVSYSC9SEL[2:0]
R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bit 31 TC1CDPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 30:28 TC1CSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 27 TC0CDPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 26:24 TC0CSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 Description No clock is selected 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 258 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 1-6 7 Description REFO1-6 clock is selected Low power clock is selected Bit 23 TCC0CDPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 22:20 TCC0CSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 19 ACCDPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 18:16 ACCLKSEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 15 C12DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 14:12 EVSYSC12SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 11 C11DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 10:8 EVSYSC11SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 259 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 7 C10DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 6:4 EVSYSC10SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected Bit 3 C9DPeripheral Clock Disable Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1 Description Clock is disabled Clock is enabled Bits 2:0 EVSYSC9SEL[2:0]Peripheral Clock Selection Note:This field is only writable when CFGLOCK[1:0] = 00. Value 0 1-6 7 Description No clock is selected REFO1-6 clock is selected Low power clock is selected 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 260 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.4.9 User Unique ID Name:
Offset:
Reset:
Property:
USER_ID 0xA0 0x00
The User ID is a 16-bit ID that may be programmed to differentiate products that use the same device. The User ID value may be read directly out of the USER_ID register or through the JTAG interface via the MCHP_CMD.USER ID command. There is no dedicated JTAG status bit to indicate when the User ID value is loaded into the USER_ID register and is ready to be read from JTAG. It is assumed that a non-zero value for the User ID will be used to indicate that the User ID is loaded. The USER_ID register is reset on power-up, then is loaded with trusted data from FBCFG5 during the pre-boot period and it is controlled. Trusted data from Flash means when there is no BCFG* fail status during Flash configuration word reads. If accompanied by fail status or blank/erase indication, then Reset values (described in the register description below) are retained and new values from FBCFG5 are not loaded. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 USER_ID[15:8]
Access Reset R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 Bit 7 6 5 4 3 2 1 0 USER_ID[7:0]
Access Reset R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 R/W/L 0 Bits 15:0 USER_ID[15:0]User unique ID, readable using the JTAG USER_ID instruction Note:This field is only writable when CFGLOCK[1:0] = 00. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 261 PIC32CX-BZ2 and WBZ45 Family System Configuration and Register Locking ... 18.4.10 Boot Configuration 0 Name:
Offset:
Reset:
Property:
BCFG0 0x200 0x00
Note:Safe value of BCFG0 is 0xFFFF_FFFF as applicable only to the implemented bits. Bit 31 BINFOVALID0 R c Access Reset 30 Bit 23 22 Access Reset 29 SIGN R c 21 28 CP R c 20 27 26 25 24 19 18 17 16 Bit 15 14 13 12 11 10 9 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 31 BINFOVALID0First 256-bit BCFG information is valid Notes:
1 PCSCMODE R c 8 0 1. 2. 3. This bit is added to provide a mechanism to determine if information coming from Flash is valid or invalid. The BCFG area is critical to the device boot-up. Trusted FBCFG* data = (BINFOVALID = 0) and (BCFGFAIL = 0). It is recommended that the application program this bit to zero for proper operation. Value 1 0 Description FBCFG0 to FBCFG5 is not valid (Untrusted, Flash values are ignored and safe values are used) FBCFG0 to FBCFG5 is valid (Trusted and loaded from Flash) Bit 29 SIGNFlash SIGN bit Value 1 0 Description Unsigned Signed Bit 28 CPBoot Code Protect (~FCPN0.CPN && ~FSIGN0.SIGN). Value 1 0 Description Protection is enabled Protection is disabled Bit 1 PCSCMODEPCHE Single Cache mode Value 1 0 Description PCHE ICache Only. CPU Instructions (code, data) go to PCHE ICache only. PCHE ICache and DCache. CPU opcodes go to PCEHE ICache port and data goes to PCHE DCache port. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 262 PIC32CX-BZ2 and WBZ45 Family Register Locking 19. Register Locking This device provides several different types of register-level locking:
Locking using the System Lock Register This mechanism, described in System Lock Register (see System Lock Register from Related Links), provides for a 2-way (locking and unlocking) write lock of system critical registers. It includes protection for the following registers:
CRU.OSCCON CRU.OSCTRM CRU.SPLLCON CRU.RSWRST CRU.RNMICON CRU.PB1DIV CRU.PB2DIV CRU.PB3DIV CRU.SLEWCON CRU.CLK_DIAG Locking using the CFGCON0.IOLOCK, CFGCON0.PMDLOCK, CFGCON0.PMUCLOCK and CFGCON0.PGLOCK register bits This mechanism provides for a 1-way lock (once locked, only a reset can unlock) of the following registers:
All PPS registers (IOLOCK bit) All PMD registers (PMDLOCK bit) CFGPG register (PGLOCK bit) All PMU registers (PMULOCK bit) Locking using the CFGCON0.CFGLOCK[1:0] register bits This mechanism provides for a 1-way or 2-way lock
(software selectable). It applies to the following registers and memories:
BCFG0 CFGCON0 CFGCON1 CFGCON2 CFGCON3 USER_ID CFGCON4 CFGPCLKGENx Related Links 19.1. System Lock Register 19.1 System Lock Register Several modules contain registers that are protected from errant code causing unwanted changes by the system lock feature. When the system lock is in effect, which is the default state, registers protected by it are not writable. The system lock feature protects registers that are system critical such as the boot time option. Each module that uses the system lock feature describes which register bits and functions it affects. A specific sequence of writes to the SYSKEY register unlock the access to those register bits and features. 19.1.1 Unlock Requirements The unlock sequence must be atomic. If any other peripheral bus access occurs on the same peripheral bus on which SYSKEY resides during the unlock attempt sequence, the unlock fails. Therefore, turn off all bus initiators like DMA, USB and so on, and disable interrupts. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 263 PIC32CX-BZ2 and WBZ45 Family Register Locking 19.1.2 Unlock Sequence It is recommended that application code performs step 2 and 3 before step 5 and 6. The unlock sequencer, however, only looks for step 5 and 6 to be atomic. For this sequence, atomic means that there is no other activity on the peripheral bus between step 5 and 6. Step 4 is only needed to ensure that the sequence starts from a known locked state. 1. 2. 3. 4. 5. 6. Suspend all other Peripheral Bus accesses. Load 0xAA996655 to CPU register X. Load 0x556699AA to CPU register Y. Store CPU register r0 to SYSKEY. Store CPU register X to SYSKEY. Store CPU register Y to SYSKEY. 19.1.3 Lock Sequence When the system is unlocked, any write to the SYSKEY register causes the system lock to become active. 19.1.4 Lock/Unlock Indication The SYSKEY register read value indicates the status of the unlock sequence. A value of 0x00000000 indicates the system is still locked. A value of 0x00000001 indicates the sequence succeeded and the system is unlocked. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 264 PIC32CX-BZ2 and WBZ45 Family Register Locking 19.2 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00
... 0xAF Reserved 0xB0 SYSKEY 7:0 15:8 23:16 31:24 SYSKEY7 SYSKEY6 SYSKEY5 SYSKEY4 SYSKEY3 SYSKEY2 SYSKEY1 SYSKEY0 SYSKEY15 SYSKEY14 SYSKEY13 SYSKEY12 SYSKEY11 SYSKEY10 SYSKEY9 SYSKEY8 SYSKEY23 SYSKEY22 SYSKEY21 SYSKEY20 SYSKEY19 SYSKEY18 SYSKEY17 SYSKEY16 SYSKEY31 SYSKEY30 SYSKEY29 SYSKEY28 SYSKEY27 SYSKEY26 SYSKEY25 SYSKEY24 19.3 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description. Some registers are synchronized when read and/or written. Synchronization is denoted by the Write-Synchronized or the Read-Synchronized property in each individual register description. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable protection is denoted by the Enable-Protected property in each individual register description. Note:All registers in this table have corresponding CLR, SET and INV registers at its virtual address, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET, and INV Registers from Related Links. Related Links 6.1.9. CLR, SET and INV Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 265 PIC32CX-BZ2 and WBZ45 Family Register Locking 19.3.1 System Key Register Name:
Offset:
Reset:
SYSKEY 0xB0 0x0 Bit 31 SYSKEY31 Access Reset R/W 0 Bit 23 SYSKEY23 Access Reset R/W 0 Bit 15 SYSKEY15 Access Reset R/W 0 Bit Access Reset 7 SYSKEY7 R/W 0 30 SYSKEY30 R/W 0 22 SYSKEY22 R/W 0 14 SYSKEY14 R/W 0 6 SYSKEY6 R/W 0 29 SYSKEY29 R/W 0 21 SYSKEY21 R/W 0 13 SYSKEY13 R/W 0 5 SYSKEY5 R/W 0 28 SYSKEY28 R/W 0 20 SYSKEY20 R/W 0 12 SYSKEY12 R/W 0 4 SYSKEY4 R/W 0 27 SYSKEY27 R/W 0 19 SYSKEY19 R/W 0 11 SYSKEY11 R/W 0 3 SYSKEY3 R/W 0 26 SYSKEY26 R/W 0 18 SYSKEY18 R/W 0 10 SYSKEY10 R/W 0 2 SYSKEY2 R/W 0 25 SYSKEY25 R/W 0 17 SYSKEY17 R/W 0 9 SYSKEY9 R/W 0 1 SYSKEY1 R/W 0 24 SYSKEY24 R/W 0 16 SYSKEY16 R/W 0 8 SYSKEY8 R/W 0 0 SYSKEY0 R/W 0 Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 SYSKEY System Key Keys are written to this register as part of a sequence to unlock system critical registers. A successful key write to this register will set the system signal. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 266 PIC32CX-BZ2 and WBZ45 Family Peripheral Module Disable Register (PMD) 20. Peripheral Module Disable Register (PMD) 20.1 Overview This section describes the following peripheral module disable functions:
Device peripheral configuration Configuration defined by product variants Peripheral disable for power conservation 20.2 Enabling Peripherals Peripheral Module Disable (PMD) register bits control the operation of individual peripherals on the device. When a peripherals associated PMD bit is zero (0), the peripheral is enabled and operates as programmed. However, when the associated PMD bit is one (1), the peripheral logic, memory map and SFR bits are completely removed from visibility and the peripheral is held in Reset. This disabled state provides for the lowest power state of the peripheral. Before a peripheral may be configured or used, it must be enabled by clearing the corresponding PMD register bit. There are some caveats to using PMD bits. The following must be observed:
1. Disabling a peripheral while its ON bit is zero (0) results in undefined behavior of the external interface. For bus initiators, software must verify the module is not busy after setting the ON bit to zero (0) before 2. disabling it. Setting the PMD bit when there is a pending interrupt results in undefined behavior. Therefore, all Interrupt Flags must be cleared prior to setting the associated PMD. 3. 20.3 Registers and Bits Note:PMD registers can be write-locked using the CFGCON0.PMDLOCK register bit. If this bit is set, then writing of PMD registers has no effect. See PMD1, PMD2 and PMD3 in the PMD Register Summary from Related Links for a description of the PMD registers, and to identify the location of the register, see Device Configuration Map in the Product Memory Mapping Overview from Related Links. Related Links 8. Product Memory Mapping Overview 20.4.1. PMD Register Summary 20.4 PMD Register 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 267 PIC32CX-BZ2 and WBZ45 Family Peripheral Module Disable Register (PMD) 20.4.1 PMD Register Summary Note:All registers in this table have corresponding CLR, SET and INV registers at its virtual address, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET and INV Registers from Related Links. Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00
... 0xBF Reserved 0xC0 PMD1 7:0 15:8 23:16 31:24 ADCMD ACMD PLVDMD LPAMD MPAMD BTMD ZBMD SQIMD ADCSARMD RTCCMD Related Links 6.1.9. CLR, SET and INV Registers 20.4.2 Register Description Some peripherals include module enable bits internally. The PMD bit is used for clock gating of the PBx_CLK and GCLK for all peripherals. If the peripheral also includes the internal enable bit, the PMD bit and internal enable configuration bit must be configured by software for that peripheral. The following table summarizes each peripheral's enable and disable controls. For more details on the internal enable/disable control, see Peripheral Access Controller (PAC) from Related Links. Table 20-1. Module Enable/Disable Controls Module PMD control Module control Enable/Disable Strategy AC AES CCL CMCC DMAC DSU EIC EVSYS FREQM ICM PAC PUKCC QSPI Present Present NA NA NA NA NA NA NA Present NA Present Present RAMECC NA RTCC Present SERCOM Present TC TCC TRNG Present Present Present Present Present Present Present Present NA Present NA Present Present NA NA Present NA Present Present Present Present Present Disable at PMD or Module Disable at PMD or Module Disable at Module Disable at Module Disable at Module Always Enabled (Dynamic On/Off) Disable at Module Always Enabled (Dynamic On/Off) Disable at Module Enable both/Disable at PMD or Module Always Enabled (Dynamic On/Off) Disable at PMD Enable both/Disable at PMD or Module Disable using fuse bit Enable both/Disable at PMD or Module Enable both/Disable at PMD or Module Enable both/Disable at PMD or Module Enable both/Disable at PMD or Module Enable both/Disable at PMD or Module 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 268 PIC32CX-BZ2 and WBZ45 Family Peripheral Module Disable Register (PMD) Note:For Modules with both PMD control and Module control, Enable = PMDx=0 AND Module Enable=1, Disable
=PMDx=1 OR Module Enable=0. Related Links 26. Peripheral Access Controller (PAC) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 269 Access Reset Bit Access Reset PIC32CX-BZ2 and WBZ45 Family Peripheral Module Disable Register (PMD) 20.4.3 PMD1 Peripheral Module Disable 1 Register Name:
Offset:
Reset:
Property:
Notes:
PMD1 0x00C0 0x00000000
This bit is only writable when CFGCON0.PMDLOCK = 0. All registers in this table have corresponding CLR, SET and INV registers at its virtual address, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET and INV Registers from Related Links. Bit 31 30 Access Reset 29 SQIMD R/W/L 0 28 27 26 25 24 Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 RTCCMD R/W/L 0 8 ADCSARMD R/W/L 0 7 ADCMD R/W/L 0 6 ACMD R/W/L 0 5 4 PLVDMD R/W/L 0 3 LPAMD R/W/L 0 2 MPAMD R/W/L 0 1 BTMD R/W/L 0 0 ZBMD R/W/L 0 Bit 29 SQIMDSQI Module Disable Description SQI module is disabled SQI module is enabled Value 1 0 Bit 16 RTCCMDRTCC Module Disable (Unused at top level, part of XDS controller SFR) Value 1 0 Description RTCC module is disabled RTCC module is enabled Bit 8 ADCSARMDShared ADC SAR Core Module Disable bit Value 1 0 Description ADC SAR Core module is disabled. When disabled, the corresponding ADC SAR SHARED will be disabled. ADC SAR Core module is enabled Bit 7 ADCMDADC Controller Module Disable Value 1 0 Description ADC Controller module is disabled ADC Controller module is enabled Bit 6 ACMDAC Module Disable Value 1 0 Description AC module is disabled AC module is enabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 270 PIC32CX-BZ2 and WBZ45 Family Peripheral Module Disable Register (PMD) Bit 4 PLVDMDPLVD Module Disable bit Value 1 Description PLVD module is disabled. When disabled, the corresponding PLVD will be disabled. Bit 3 LPAMDRF LPA Module Disable bit Value 1 0 Description RF LPA module is disabled RF LPA module is enabled Bit 2 MPAMDRF MPA Module Disable bit Value 1 0 Description RF MPA module is disabled RF MPA module is enabled Bit 1 BTMDBluetooth Module Disable bit Value 1 0 Description Bluetooth module is disabled Bluetooth module is enabled Bit 0 ZBMDZigbee Module Disable bit Value 1 0 Description Zigbee module is disabled Zigbee module is enabled Related Links 6.1.9. CLR, SET and INV Registers 20.5 PMDx Initialization Values by Variant Name Table 20-2. PMDx Initialization Values PartName 1 3 4 2 3 2 6 1 5 1 8 7 0 Hex D M Q S I PMD1 D M C C T R 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M R A S C D A 0 D AD M C C D M A D D M D V L P D M A P L D M A P M D M T B D M B Z 0 0 0 0 0 01 01 PIC32CX1 012BZ250 48 PartName PIC32CX1 012BZ250 48 1 3 D M 4 O F E R 0 D M 3 O F E R 0 D M 2 O F E R 0 0 1 0 1 000 0_0 000 1 0 Hex 4 2 3 2 6 1 5 1 8 7 PMD2 D M 1 O F E R D M 6 O F E R D M 5 O F E R 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 000 0_0 000 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 271 PIC32CX-BZ2 and WBZ45 Family Peripheral Module Disable Register (PMD) PartName 1 3 4 2 3 2 6 1 1 5 8 7 0 Hex PMD3 D M 2 C C T D M 1 C C T D M 0 C C T D M 3 C T D M 2 C T D M 1 C T D M 0 C T D M S E A D M G N R D M C C K U P D M M C I D M 3 R E S D M 2 R E S D M 1 R E S D M 0 R E S 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 01 01 01 01 01 01 PIC32CX1 012BZ250 48 0 1 0 1 000 0_0 000 1 Note:
1. The value depends on the specific Device Variant, as specified in Configuration Summary, see Configuration Summary from Related Links. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 272 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21. Real-Time Counter and Calendar (RTCC) 21.1 Overview The Real-Time Counter and Calendar (RTCC) is a 32-bit counter with a 10-bit programmable prescaler that typically runs continuously to keep track of time. The RTCC can wake up the device from sleep modes using the alarm/
compare wake up, periodic wake up, or overflow wake up mechanisms. The RTCC can generate periodic peripheral events from outputs of the prescaler, as well as alarm/compare interrupts and peripheral events, which can trigger at any counter value. Additionally, the timer can trigger an overflow interrupt and peripheral event, and can be reset on the occurrence of an alarm/compare match. This allows periodic interrupts and peripheral events at very long and accurate intervals. The 10-bit programmable prescaler can scale down the clock source. By this, a wide range of resolutions and time-out periods can be configured. With a 32.768 kHz clock source, the minimum counter tick interval is 30.5s, and time-out periods can range up to 36 hours. For a counter tick interval of 1s, the maximum time-out period is more than 136 years. 21.2 Features 32-bit counter with 10-bit prescaler Multiple clock sources 32-bit or 16-bit counter mode Clock/Calendar mode Time in seconds, minutes, and hours (12/24) Date in day of month, month, and year Leap year correction Digital prescaler correction/tuning for increased accuracy Overflow, alarm/compare match and prescaler interrupts and events Optional clear on alarm/compare match 4 general purpose registers 1 backup register with retention capability Tamper Detection Timestamp on event or up to 4 inputs with debouncing Active layer protection 21.3 Block Diagram Figure 21-1. RTCC Block Diagram (Mode 0 32-Bit Counter) 0x00000000 MATCHCLR LPCLK_RTC CLK_RTC_OSC PRESCALER CLK_RTC_CNT COUNT OVF Periodic Events
CMPn COMPn 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 273 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Figure 21-2. RTCC Block Diagram (Mode 1 16-Bit Counter) Figure 21-3. RTCC Block Diagram (Mode 2 Clock/Calendar) Figure 21-4. RTCC Block Diagram (Tamper Detection) 21.4 Signal Description Table 21-1. Signal Description Signal INn [n=0..3]
OUT Description Tamper Detection Input Tamper Detection Output Type Digital input Digital output 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 274 CLK_RTC_OSCCLK_RTC_CNTLPCLK_RTCPRESCALERCOMPnPERCOUNT0x0000Periodic Events==CMPnOVF CLK_RTC_CNTCLK_RTC_OSCLPCLK_RTCPRESCALERPeriodic EventsMASKnCLOCKALARMn=0x00000000OVFMATCHCLRALARMn=PRESCALERDEBOUNCEDEBOUNCEDEBOUNCETIMESTAMPCAPTUREINnIN1IN0OUTTamper Input [0..3]PCB Active LayerProtectionTAMPEVTTAMPERALARMFREQCORRCLOCK PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC)
...........continued Signal RTC_EVENT Description RTC Event Output Type Digital output 21.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 21.5.1 I/O Lines In order to use the I/O lines of this peripheral, the RTC must be enabled and no higher priority peripherals for the RTC pins can be enabled. See I/O Ports and Peripheral Pin Select (PPS) from Related Links. Related Links 6. I/O Ports and Peripheral Pin Select (PPS) 21.5.2 Power Management The RTC will continue to operate in any sleep modes where the selected source clock is running. The RTC interrupts can be used to wake-up the device from sleep modes. Events connected to the event system can trigger other operations in the system without exiting sleep modes. See Power Management Unit (PMU) from Related Links for details on the different sleep modes. The RTCC can only be reset by a power on reset (POR) or by setting the Software Reset bit in the Control A register
(CTRLA.SWRST = 1). Related Links 15. Power Management Unit (PMU) 21.5.3 Clocks A 32 KHz or 1 KHz oscillator clock (CLK_RTC_OSC) is required to clock the RTC. The 32 KHz clock source can be FRC, POSC, SOSC or LPRC based on the mux selection controlled by the CFG.CFGCON4.VBKP_32KCSEL bit. The 1 KHz clock source is based on the mux selection controlled by the CFG.CFGCON4.VBKP_1KCSEL bit. This oscillator clock is asynchronous to the bus clock (PB3_CLK). Due to this asynchronicity, writing to certain registers will require synchronization between the clock domains. 21.5.4 DMA 21.5.5 Interrupts The interrupt request line is connected to the Interrupt Controller. Using the RTC interrupt requires the Interrupt Controller to be configured first. 21.5.6 Events The events are connected to the Event System. See Event System (EVSYS) from Related Links. Related Links 28. Event System (EVSYS) 21.5.7 Debug Operation When the CPU is halted in debug mode the RTC will halt normal operation. The RTC can be forced to continue operation during debugging. See DBGCTRL from Related Links. Related Links 21.8.7. DBGCTRL 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 275 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.6 Functional Description 21.6.1 Principle of Operation The RTC keeps track of time in the system and enables periodic events, as well as interrupts and events at a specified time. The RTC consists of a 10-bit prescaler that feeds a 32-bit counter. The actual format of the 32-bit counter depends on the RTC operating mode. The RTC can function in one of these modes:
Mode 0 - COUNT32: RTC serves as 32-bit counter Mode 1 - COUNT16: RTC serves as 16-bit counter Mode 2 - CLOCK: RTC serves as clock/calendar with alarm functionality 21.6.2 Basic Operation 21.6.2.1 Initialization The following bits are enable-protected, meaning that they can only be written when the RTC is disabled
(CTRLA.ENABLE=0):
Operating Mode bits in the Control A register (CTRLA.MODE) Prescaler bits in the Control A register (CTRLA.PRESCALER) Clear on Match bit in the Control A register (CTRLA.MATCHCLR) Clock Representation bit in the Control A register (CTRLA.CLKREP) BKUP Registers Reset On Tamper bit in Control A register (CTRLA.BKTRST) GP Registers Reset On Tamper Enable in Control A register (CTRLA.GPTRST) The following registers are enable-protected:
Event Control register (EVCTRL) Control B register (CTRLB) Enable-protected bits and registers can be changed only when the RTC is disabled (CTRLA.ENABLE=0). If the RTC is enabled (CTRLA.ENABLE=1), these operations are necessary: first write CTRLA.ENABLE=0 and check whether the write synchronization has finished, then change the desired bit field value. Enable-protected bits in CTRLA register can be written at the same time as CTRLA.ENABLE is written to '1', but not at the same time as CTRLA.ENABLE is written to '0'. Enable-protection is denoted by the "Enable-Protected" property in the register description. The RTC prescaler divides the source clock for the RTC counter. Note:In Clock/Calendar mode, the prescaler must be configured to provide a 1.024 kHz clock to the counter for correct operation. The frequency of the RTC clock (CLK_RTC_CNT) is given by the following formula:
fCLK_RTC_CNT =
The frequency of the oscillator clock, CLK_RTC_OSC, is given by fCLK_RTC_OSC, and fCLK_RTC_CNT is the frequency of the internal prescaled RTC clock, CLK_RTC_CNT. 2 fCLK_RTC_OSC PRESCALER 21.6.2.2 Enabling, Disabling, and Resetting The RTC is enabled by setting the Enable bit in the Control A register (CTRLA.ENABLE=1). The RTC is disabled by writing CTRLA.ENABLE=0. The RTC is reset by setting the Software Reset bit in the Control A register (CTRLA.SWRST=1). All registers in the RTC, except DEBUG, will be reset to their initial state, and the RTC will be disabled. The RTC must be disabled before resetting it. 21.6.2.3 32-Bit Counter (Mode 0) When the RTC Operating Mode bits in the Control A register (CTRLA.MODE) are written to 0x0, the counter operates in 32-bit Counter mode. See RTC Block Diagram (Mode 0 32-Bit Counter) figure in the Block Diagram from 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 276 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Related Links. When the RTC is enabled, the counter will increment on every 0-to-1 transition of CLK_RTC_CNT. The counter will increment until it reaches the top value of 0xFFFFFFFF, and then wrap to 0x00000000. This sets the Overflow Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.OVF). The RTC counter value can be read from or written to the Counter Value register (COUNT) in 32-bit format. The counter value is continuously compared with the 32-bit Compare register (COMP). When a compare match occurs, the Compare Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.CMP) is set on the next 0-to-1 transition of CLK_RTC_CNT. If the Clear on Match bit in the Control A register (CTRLA.MATCHCLR) is '1', the counter is cleared on the next counter cycle when a compare match with COMP occurs. This allows the RTC to generate periodic interrupts or events with longer periods than the prescaler events. Note that when CTRLA.MATCHCLR is '1', INTFLAG.CMP and INTFLAG.OVF will both be set simultaneously on a compare match with COMP. Related Links 21.3. Block Diagram 21.6.2.4 16-Bit Counter (Mode 1) When the RTC Operating Mode bits in the Control A register (CTRLA.MODE) are written to 0x1, the counter operates in 16-bit Counter mode. See RTC Block Diagram (Mode 1 16-Bit Counter) figure in the Block Diagram from Related Links. When the RTC is enabled, the counter will increment on every 0-to-1 transition of CLK_RTC_CNT. In 16-bit Counter mode, the 16-bit Period register (PER) holds the maximum value of the counter. The counter will increment until it reaches the PER value, and then wrap to 0x0000. This sets the Overflow Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.OVF). The RTC counter value can be read from or written to the Counter Value register (COUNT) in 16-bit format. The counter value is continuously compared with the 16-bit Compare registers (COMPn, n=0..). When a compare match occurs, the Compare n Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.CMPn, n=0..) is set on the next 0-to-1 transition of CLK_RTC_CNT. Related Links 21.3. Block Diagram 21.6.2.5 Clock/Calendar (Mode 2) When the RTC Operating Mode bits in the Control A register (CTRLA.MODE) are written to 0x2, the counter operates in Clock/Calendar mode. See RTC Block Diagram (Mode 2 Clock/Calendar) figure in the Block Diagram from Related Links. When the RTC is enabled, the counter will increment on every 0-to-1 transition of CLK_RTC_CNT. The selected clock source and RTC prescaler must be configured to provide a 1Hz clock to the counter for correct operation in this mode. The time and date can be read from or written to the Clock Value register (CLOCK) in a 32-bit time/date format. Time is represented as:
Seconds Minutes Hours Hours can be represented in either 12- or 24-hour format, selected by the Clock Representation bit in the Control A register (CTRLA.CLKREP). This bit can be changed only while the RTC is disabled. The date is represented in this form:
Day as the numeric day of the month (starting at 1) Month as the numeric month of the year (1 = January, 2 = February, etc.) Year as a value from 0x00 to 0x3F. This value must be added to a user-defined reference year. The reference year must be a leap year (2016, 2020 etc). Example: the year value 0x2D, added to a reference year 2016, represents the year 2061. The RTC will increment until it reaches the top value of 23:59:59 December 31 of year value 0x3F, and then wrap to 00:00:00 January 1 of year value 0x00. This will set the Overflow Interrupt flag in the Interrupt Flag Status and Clear registers (INTFLAG.OVF). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 277 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) The clock value is continuously compared with the 32-bit Alarm register (ALARM). When an alarm match occurs, the Alarm Interrupt flag in the Interrupt Flag Status and Clear registers (INTFLAG.ALARM) is set on the next 0-to-1 transition of CLK_RTC_CNT. E.g. For a 1Hz clock counter, it means the Alarm 0 Interrupt flag is set with a delay of 1s after the occurrence of alarm match. A valid alarm match depends on the setting of the Alarm Mask Selection bits in the Alarm Mask register (MASK.SEL). These bits determine which time/date fields of the clock and alarm values are valid for comparison and which are ignored. If the Clear on Match bit in the Control A register (CTRLA.MATCHCLR) is set, the counter is cleared on the next counter cycle when an alarm match with ALARM occurs. This allows the RTC to generate periodic interrupts or events with longer periods than it would be possible with the prescaler events only (see Periodic Intervals from Related Links). Note:When CTRLA.MATCHCLR is 1, INTFLAG.ALARMn and INTFLAG.OVF will both be set simultaneously on an alarm match with ALARM. Related Links 21.3. Block Diagram 21.6.8.1. Periodic Intervals 21.6.3 DMA Operation 21.6.4 Interrupts The RTC has the following interrupt sources:
Overflow (OVF): Indicates that the counter has reached its top value and wrapped to zero. Compare (CMPn): Indicates a match between the counter value and the compare register. Alarm (ALARM): Indicates a match between the clock value and the alarm register. Period n (PERn): The corresponding bit in the prescaler has toggled, see Periodic Intervals from Related Links. Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by setting the corresponding bit in the Interrupt Enable Set register (INTENSET=1), and disabled by setting the corresponding bit in the Interrupt Enable Clear register (INTENCLR=1). The status of enabled interrupts can be read from either INTENSET or INTENCLR. An interrupt request is generated when the interrupt flag is raised and the corresponding interrupt is enabled. The interrupt request remains active until either the interrupt flag is cleared, the interrupt is disabled or the RTC is reset. See the description of the INTFLAG registers for details on how to clear interrupt flags. All interrupt requests from the peripheral are ORed together on system level to generate one combined interrupt request to the NVIC, see Nested Vector Interrupt Controller (NVIC) from Related Links. The user must read the INTFLAG register to determine which interrupt condition is present. Note:Interrupts must be globally enabled for interrupt requests to be generated, see Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 21.6.8.1. Periodic Intervals 21.6.5 Events The RTC can generate the following output events and these events can be used by EVSYS module:
Overflow (OVF): Generated when the counter has reached its top value and wrapped to zero. Compare (CMPn): Indicates a match between the counter value and the compare register. Alarm (ALARMn): Indicates a match between the clock value and the alarm register. Period n (PERn): The corresponding bit in the prescaler has toggled, see Periodic Intervals from Related Links. Periodic Daily (PERD): Generated when the COUNT/CLOCK has incremented at a fixed period of time. RTC Event (RTC_EVENT): Generates specific external signal on the RTC EVENT I/O pin. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 278 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Setting the Event Output bit in the Event Control Register (EVCTRL.xxxEO=1) enables the corresponding output event. Writing a zero to this bit disables the corresponding output event. See Event System (EVSYS) from Related Links for more details on configuring the event system. The RTC can take the following actions on an input event:
Tamper (TAMPEVT): Capture the RTC counter to the timestamp register. See Tamper Detection from Related Links. Writing a one to an Event Input bit into the Event Control register (EVCTRL.xxxEI) enables the corresponding action on input event. Writing a zero to this bit disables the corresponding action on input event. RTC Event (RTC_EVENT): Other than the above events, which are mapped to the EVSYS module, the following events can generate specific external signal on the RTC EVENT I/O pin. 32 KHz clock Alarm pulse 1-second clock These event signals are configured using CFGCON4.RTCEVENTSEL[1:0] bits. Note:The RTC_OUT and RTC_EVENT signals are multiplexed and any one of the signal can be out at a time in pin limited variants. See I/O Ports and Peripheral Pin Select (PPS) from Related Links. The selection between RTC_OUT and RTC_EVENT is configurable through CFGCON4.RTCEVTYPE bit. Related Links 6. I/O Ports and Peripheral Pin Select (PPS) 21.6.8.1. Periodic Intervals 21.6.8.5. Tamper Detection 28. Event System (EVSYS) 21.6.6 Sleep Mode Operation The RTC will continue to operate in any sleep mode where the source clock is active. The RTC interrupts can be used to wake up the device from a sleep mode. RTC events can trigger other operations in the system without exiting the sleep mode. An interrupt request will be generated after the wake-up if the Interrupt Controller is configured accordingly. Otherwise the CPU will wake up directly, without triggering any interrupt. In this case, the CPU continues executing right from the first instruction that followed the entry into sleep. The periodic events can also wake up the CPU through the interrupt function of the Event System. In this case, the event must be enabled and connected to an event channel with its interrupt enabled. See Event System (EVSYS) from Related Links. Related Links 28. Event System (EVSYS) 21.6.7 Synchronization Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be synchronized when written or read. The following bits are synchronized when written:
Software Reset bit in Control A register, CTRLA.SWRST Enable bit in Control A register, CTRLA.ENABLE The following registers are synchronized when written:
Counter Value register, COUNT Clock Value register, CLOCK Counter Period register, PER Compare n Value registers, COMPn Alarm n Value registers, ALARMn 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 279 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Frequency Correction register, FREQCORR Alarm n Mask register, MASKn The following registers are synchronized when read:
The Counter Value register, COUNT, if the Counter Read Sync Enable bit in CTRLA (CTRLA.COUNTSYNC) is
'1'
The Clock Value register, CLOCK, if the Clock Read Sync Enable bit in CTRLA (CTRLA.CLOCKSYNC) is '1'
Required write synchronization is denoted by the "Write-Synchronized" property in the register description. Required read synchronization is denoted by the "Read-Synchronized" property in the register description. 21.6.8 Additional Features 21.6.8.1 Periodic Intervals The RTC prescaler can generate interrupts and events at periodic intervals, allowing flexible system tick creation. Any of the upper eight bits of the prescaler (bits 2 to 9) can be the source of an interrupt/event. When one of the eight Periodic Event Output bits in the Event Control register (EVCTRL.PEREO[n=0..7]) is '1', an event is generated on the 0-to-1 transition of the related bit in the prescaler, resulting in a periodic event frequency of:
fCLK_RTC_OSC n+3 fPERIODIC(n) =
fCLK_RTC_OSC is the frequency of the internal prescaler clock CLK_RTC_OSC, and n is the position of the EVCTRL.PEREOn bit. For example, PER0 will generate an event every eight CLK_RTC_OSC cycles, PER1 every 16 cycles, etc. This is shown in the figure below. 2 Periodic events are independent of the prescaler setting used by the RTC counter, except if CTRLA.PRESCALER is zero. Then, no periodic events will be generated. Figure 21-5. Example Periodic Events Note:This example also applies to interrupts. Just replace EVCTRL.PEREOn with the PERn fields of INTENCLR, INTENSET, and INTFLAG. For Modes 0 and 2, n = 0,..7. For Mode 1 n = 2...7. 21.6.8.2 Frequency Correction The RTC Frequency Correction module employs periodic counter corrections to compensate for a too-slow or too-fast oscillator. Frequency correction requires that CTRLA.PRESCALER is greater than 1. The digital correction circuit adds or subtracts cycles from the RTC prescaler to adjust the frequency in approximately 1ppm steps. Digital correction is achieved by adding or skipping a single count in the prescaler once every CLK_RTC_OSC cycles. The Value bit group in the Frequency Correction register (FREQCORR.VALUE) determines the number of times the adjustment is applied over of these periods. The resulting correction is as follows:
This results in a resolution of ppm. The Sign bit in the Frequency Correction register (FREQCORR.SIGN) determines the direction of the correction. A positive value will add counts and increase the period (reducing the frequency), and a negative value will reduce counts per period (speeding up the frequency). Digital correction also affects the generation of the periodic events from the prescaler. When the correction is applied at the end of the correction cycle period, the interval between the previous periodic event and the next occurrence may also be shortened or lengthened depending on the correction value. 21.6.8.3 Backup Registers The RTC includes one Backup register (BKUP0). This register maintain its content in Backup/Deep Sleep mode. It can be used to store user-defined values. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 280 CLK_RTC_OSCPER0PER1PER2PER3 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) If more user-defined data must be stored than the Backup register can hold, the General Purpose registers (GPn) can be used. 21.6.8.4 General Purpose Registers The RTC includes four General Purpose registers (GPn). These registers are reset only when the RTC is reset, and remain powered while the RTC is powered. They can be used to store user-defined values while other parts of the system are powered off. The general purpose registers 2*n and 2*n+1 are enabled by writing a '1' to the General Purpose Enable bit n in the Control B register (CTRLB.GPnEN). The GP registers share internal resources with the COMPARE/ALARM features. Each COMPARE/ALARM register have a separate read buffer and write buffer. When the general purpose feature is enabled the even GP uses the read buffer while the odd GP uses the write buffer. When the COMPARE/ALARM register is written, the write buffer hold temporarily the COMPARE/ALARM value until the synchronisation is complete (bit SYNCBUSY.COMPn going to 0). After the write is completed the write buffer can be used as a odd general purpose register without affecting the COMPARE/ALARM function. If the COMPARE/ALARM function is not used, the read buffer can be used as an even general purpose register. In this case, writing the even GP will temporarily use the write buffer until the synchronisation is complete (bit SYNCBUSY.GPn going to 0). Thus an even GP must be written before writing the odd GP. Changing or writing an even GP needs to temporarily save the value of the odd GP. Before using an even GP, the associated COMPARE/ALARM feature must be disabled by writing a 1 to the General Purpose Enable bit in the Control B register (CTRLB.GPnEN). To re-enable the compare/alarm, CTRLB.GPnEN must be written to zero and the associated COMPn/ALARMn must be written with the correct value. It is recommended to use the Backup register (BKUPn) first to store user-defined values, and use the GPn only when the user-defined values exceed the capacity of the provided BKUPn. An example procedure to write the general purpose registers GP0 and GP1 is:
1. Wait for any ongoing write to COMP0 to complete (SYNCBUSY.COMP0 = 0). If the RTC is operating in Mode 1, wait for any ongoing write to COMP1 to complete as well (SYNCBUSY.COMP1 = 0). 2. Write CTRLB.GP0EN = 1 if GP0 is needed. 3. Write GP0 if needed. 4. Wait for any ongoing write to GP0 to complete (SYNCBUSY.GP0 = 0). Note that GP1 will also show as busy when GP0 is busy. 5. Write GP1 if needed. The following table provides the correspondence of General Purpose Registers and the COMPARE/ALARM read or write buffer in all RTC modes. Table 21-2. General Purpose Registers Versus Compare/Alarm Registers: n in 0, 2, 4, 6... Register GPn COMPn/2 write buffer Mode 0 Mode 1 Mode 2 Write Before GPn+1 COMPn/2 read buffer
(COMPn , COMPn+1) write buffer
(COMPn , COMPn+1) read buffer ALARMn/2 write buffer GPn+1 ALARMn/2 read buffer 21.6.8.5 Tamper Detection The RTC provides four tamper channels that can be used for tamper detection. The action of each tamper channel is configured using the Input n Action bits in the Tamper Control register
(TAMPCTRL.INnACT):
Off: Detection for tamper channel n is disabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 281 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Wake: A transition on INn input (tamper channel n) matching TAMPCTRL.TAMPLVLn will be detected and the tamper interrupt flag (INTFLAG.TAMPER) will be set. The RTC value will not be captured in the TIMESTAMP register. Capture: A transition on INn input (tamper channel n) matching TAMPCTRL.TAMPLVLn will be detected and the tamper interrupt flag (INTFLAG.TAMPER) will be set. The RTC value will be captured in the TIMESTAMP register. Active Layer Protection: A mismatch of an internal RTC signal routed between INn and OUTn pins will be detected and the tamper interrupt flag (INTFLAG.TAMPER) will be set. The RTC value will be captured in the TIMESTAMP register. In order to determine which tamper source caused a tamper event, the Tamper ID register (TAMPID) provides the detection status of each tamper channel. These bits remain active until cleared by software. A single interrupt request (TAMPER) is available for all tamper channels. The RTC also supports an input event (TAMPEVT) for generating a tamper condition within the Event System. The tamper input event is enabled by the Tamper Input Event Enable bit in the Event Control register
(EVCTRL.TAMPEVTEI). Up to four polarity external inputs (INn) can be used for tamper detection. The polarity for each input is selected with the Tamper Level bits in the Tamper Control register (TAMPCTRL.TAMPLVLn). Separate debouncers are embedded for each external input. The debouncer for each input is enabled/disabled with the Debounce Enable bits in the Tamper Control register (TAMPCTRL.DEBNCn). The debouncer configuration is fixed for all inputs as set by the Control B register (CTRLB). The debouncing period duration is configurable using the Debounce Frequency field in the Control B register (CTRLB.DEBF). The period is set for all debouncers (i.e., the duration cannot be adjusted separately for each debouncer). When TAMPCTRL.DEBNCn = 0, INn is detected asynchronously. See the following figure for an example. Figure 21-6. Edge Detection with Debouncer Disabled When TAMPCTRL.DEBNCn = 1, the detection time depends on whether the debouncer operates synchronously or asynchronously, and whether majority detection is enabled or not. For more details, refer to the following table. Synchronous versus asynchronous stability debouncing is configured by the Debounce Asynchronous Enable bit in the Control B register (CTRLB.DEBASYNC):
Synchronous (CTRLB.DEBASYNC = 0): INn is synchronized in two CLK_RTC periods and then must remain stable for four CLK_RTC_DEB periods before a valid detection occurs. See the following figure for an example. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 282 CLK_RTCCLK_RTC_DEBINOUTNENEPETAMLVL=0CLK_RTCCLK_RTC_DEBINOUTNENEPETAMLVL=1PENEPEPENEPE PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Figure 21-7. Edge Detection with Synchronous Stability Debouncing Asynchronous (CTRLB.DEBASYNC = 1): The first edge on INn is detected. Further detection is blanked until INn remains stable for four CLK_RTC_DEB periods. See the following figure for an example. Figure 21-8. Edge Detection with Asynchronous Stability Debouncing Majority debouncing is configured by the Debounce Majority Enable bit in the Control B register (CTRLB.DEBMAJ). INn must be valid for two out of three CLK_RTC_DEB periods. See the following figure for an example. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 283 OUTTAMLVL=0CLK_RTCCLK_RTC_DEBINOUTNENEPETAMLVL=1PENEPEWhenever an edge is detected, input must bestable for 4 consecutive CLK_RTC_DEB inorder for edge to be considered validCLK_RTCCLK_RTC_DEBINNENEPEPENEPEWhenever an edge is detected, input must bestable for 4 consecutive CLK_RTC_DEB inorder for edge to be considered validCLK_RTCCLK_RTC_DEBINOUTOnce a new edge is detected, ignore subsequent edgesuntil input is stable for 4 consecutive CLK_RTC_DEBNENEPETAMLVL=0CLK_RTCCLK_RTC_DEBINOUTOnce a new edge is detected, ignore subsequent edgesuntil input is stable for 4 consecutive CLK_RTC_DEBNENEPETAMLVL=1PENEPEPENEPE PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Figure 21-9. Edge Detection with Majority Debouncing Table 21-3. Debouncer Configuration TAMPCTRL. DEBNCn CTRLB. DEBMAJ CTRLB. DEBASYNC Description 0 1 1 1 X 0 0 1 X 0 1 X Detect edge on INn with no debouncing. Every edge detected is immediately triggered. Detect edge on INn with synchronous stability debouncing. Edge detected is only triggered when INn is stable for 4 consecutive CLK_RTC_DEB periods. Detect edge on INn with asynchronous stability debouncing. First detected edge is triggered immediately. All subsequent detected edges are ignored until INn is stable for 4 consecutive CLK_RTC_DEB periods. Detect edge on INn with majority debouncing. Pin INn is sampled for 3 consecutive CLK_RTC_DEB periods. Signal level is determined by majority-rule (LLL, LLH, LHL, HLL = '0'
and LHH, HLH, HHL, HHH = '1'). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 284 100110111111011101110CLK_RTCCLK_RTC_DEBININ shift 0IN shift 1IN shift 2MAJORITY3OUTCLK_RTCCLK_RTC_DEBININ shift 0IN shift 1IN shift 2MAJORITY3OUT111011101010001000000000111000TAMLVL=1TAMLVL=00-to-1 transition1-to-0 transitionNENEPEPENEPE000111111100110111111011101110111011101010001000000000111000NENEPEPENEPE000111111 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.6.8.5.1 Timestamp As part of tamper detection the RTC can capture the counter value (COUNT/CLOCK) into the TIMESTAMP register. Three CLK_RTC periods are required to detect the tampering condition and capture the value. The TIMESTAMP value can be read once the Tamper flag in the Interrupt Flag register (INTFLAG.TAMPER) is set. If the DMA Enable bit in the Control B register (CTRLB.DMAEN) is 1, a DMA request will be triggered by the timestamp. In order to determine which tamper source caused a capture, the Tamper ID register (TAMPID) provides the detection status of each tamper channel and the tamper input event. A DMA transfer can then read both TIMESTAMP and TAMPID in succession. A new timestamp value cannot be captured until the Tamper flag is cleared, either by reading the timestamp or by writing a 1 to INTFLAG.TAMPER. If several tamper conditions occur in a short window before the flag is cleared, only the first timestamp may be logged. However, the detection of each tamper will still be recorded in TAMPID. The Tamper Input Event (TAMPEVT) will always perform a timestamp capture. To capture on the external inputs
(INn), the corresponding Input Action field in the Tamper Control register (TAMPCTRL.INnACT) must be written to 1. If an input is set for wake functionality it does not capture the timestamp; however the Tamper flag and TAMPID will still be updated. Note:Once the value from the TIMESTAMP register is read, the INTFLAG.TAMPER bit must be cleared. The next value from this register must be read only after the INTFLAG.TAMPER bit is set again. 21.6.8.5.2 Active Layer Protection The RTC provides a mean of detecting broken traces on the PCB, also known as Active layer Protection. In this mode, a generated internal RTC signal can be directly routed over critical components on the board using the RTC_OUT output pin to one RTC INn input pin. A tamper condition is detected if there is a mismatch on the generated RTC signal. The Active Layer Protection mode and the generation of the RTC signal is enabled by setting the RTCOUT bit in the Control B register (CTRLB.RTCOUT). Note:The Active Layer Protection works with one output pin (RTC_OUT) and multiple input pin INn. This is achieved by clearing the Separate Tamper Output bit CTRLB.SEPTO. Enabling active layer protection requires the following steps:
Enable the RTC prescaler output by writing a 1 to the RTC Out bit in the Control B register (CTRLB.RTCOUT). The I/O pins must also be configured to correctly route the signal to the external pins. Select the frequency of the output signal by configuring the RTC Active Layer Frequency field in the Control B register (CTRLB.ACTF). CLK_RTC CTRLB.ACTF +1 CLK_RTC_OUT =
Enable the tamper input n (INn) in Active Layer mode by writing 3 to the corresponding Input Action field in the Tamper Control register (TAMPCTRL.INnACT). When active layer protection is enabled and INn and OUTn pin are used, the value of INn is sampled on the falling edge of CLK_RTC and compared to the expected value of OUTn. Therefore up to one half of a CLK_RTC period is available for propagation delay through the trace. 2 Enable Active Layer Protection by setting CTRLB.RTCOUT bit. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 285 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.7 Register Summary - Mode 0 - 32-Bit Counter Offset Name Bit Pos. 7 6 5 4 3 2 1 0 7:0 MATCHCLR MODE[1:0]
ENABLE SWRST 0x00 CTRLA 0x02 CTRLB 0x04 EVCTRL 0x08 INTENCLR 0x0A INTENSET 0x0C 0x0E 0x0F INTFLAG DBGCTRL Reserved 0x10 SYNCBUSY 0x14 0x15
... 0x17 FREQCORR Reserved 0x18 COUNT 0x1C
... 0x1F Reserved 0x20 COMP0 0x24 COMP1 0x28
... 0x3F Reserved 0x40 GP0 0x44 GP1 0x48 GP2 15:8 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 7:0 15:8 7:0 15:8 7:0 7:0 15:8 23:16 31:24 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 COUNTSYN C BKTRST PRESCALER[3:0]
DMAEN RTCOUT DEBASYNC DEBMAJ ACTF[2:0]
GP0EN DEBF[2:0]
PEREO7 PEREO6 PEREO5 PEREO4 PEREO3 PEREO2 PEREO1 PEREO0 OVFEO PER7 OVF PER7 OVF PER7 OVF COUNTSYN C PER6 PER5 PER4 PER3 PER2 PER1 PER0 PER6 PER5 PER4 PER3 PER2 PER1 PER0 PER6 PER5 PER4 PER3 PER2 PER1 PER0 TAMPER DBGRUN COUNT FREQCORR ENABLE SWRST SIGN VALUE[6:0]
COUNT[7:0]
COUNT[15:8]
COUNT[23:16]
COUNT[31:24]
COMP[7:0]
COMP[15:8]
COMP[23:16]
COMP[31:24]
COMP[7:0]
COMP[15:8]
COMP[23:16]
COMP[31:24]
GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 286 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x4C GP3 0x50
... 0x5F Reserved 0x60 TAMPCTRL 0x64
... 0x67 Reserved 0x68 TAMPID 0x6C
... 0x7F Reserved 0x80 BKUP0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 TAMPEVT GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
IN3ACT[1:0]
IN2ACT[1:0]
IN0ACT[1:0]
TAMLVL3 TAMLVL2 TAMLVL1 TAMLVL0 DEBNC3 DEBNC2 DEBNC1 DEBNC0 TAMPID3 TAMPID2 TAMPID1 TAMPID0 BKUP[7:0]
BKUP[15:8]
BKUP[23:16]
BKUP[31:24]
21.8 Register Description - Mode 0 - 32-Bit Counter This Register Description section is valid if the RTC is in COUNT32 mode (CTRLA.MODE=0). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 287 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.1 Control A in COUNT32 mode (CTRLA.MODE=0) Name:
Offset:
Reset:
Property: Enable-Protected, Write-Synchronized CTRLA 0x00 0x0000 Bit 15 COUNTSYNC R/W 0 Access Reset 14 13 BKTRST R/W 0 12 Bit 7 6 5 4 MATCHCLR Access Reset R/W 0 Bit 15 COUNTSYNCCOUNT Read Synchronization Enable 11 R/W 0 3 R/W 0 MODE[1:0]
10 9 PRESCALER[3:0]
R/W 0 2 R/W 0 R/W 0 1 ENABLE R/W 0 8 R/W 0 0 SWRST R/W 0 The COUNT register requires synchronization when reading. Disabling the synchronization will prevent reading valid values from the COUNT register. This bit is not enable-protected. Value 0 1 Description COUNT read synchronization is disabled COUNT read synchronization is enabled Bit 13 BKTRSTBKUP Registers Reset On Tamper Enable All BKUPn registers are affected. This bit can be written only when the peripheral is disabled. This bit is not synchronized. Value 0 1 Description BKUPn registers will not reset when a tamper condition occurs. BKUPn registers will reset when a tamper condition occurs. Bits 11:8 PRESCALER[3:0]Prescaler These bits define the prescaling factor for the RTC clock source (GCLK_RTC) to generate the counter clock
(CLK_RTC_CNT). Periodic events and interrupts are not available when the prescaler is off. These bits are not synchronized. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC-0xF Description CLK_RTC_CNT = GCLK_RTC/1 CLK_RTC_CNT = GCLK_RTC/1 CLK_RTC_CNT = GCLK_RTC/2 CLK_RTC_CNT = GCLK_RTC/4 CLK_RTC_CNT = GCLK_RTC/8 CLK_RTC_CNT = GCLK_RTC/16 CLK_RTC_CNT = GCLK_RTC/32 CLK_RTC_CNT = GCLK_RTC/64 CLK_RTC_CNT = GCLK_RTC/128 CLK_RTC_CNT = GCLK_RTC/256 CLK_RTC_CNT = GCLK_RTC/512 CLK_RTC_CNT = GCLK_RTC/1024 Reserved Name OFF DIV1 DIV2 DIV4 DIV8 DIV16 DIV32 DIV64 DIV128 DIV256 DIV512 DIV1024
Bit 7 MATCHCLRClear on Match This bit defines if the counter is cleared or not on a match. This bit is not synchronized. Value 0 Description The counter is not cleared on a Compare/Alarm match 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 288 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Value 1 Description The counter is cleared on a Compare/Alarm match Bits 3:2 MODE[1:0]Operating Mode This bit group defines the operating mode of the RTC. This bit is not synchronized. Value 0x0 0x1 0x2 0x3 Name COUNT32 COUNT16 CLOCK
Description Mode 0: 32-bit counter Mode 1: 16-bit counter Mode 2: Clock/calendar Reserved Bit 1 ENABLEEnable Due to synchronization there is a delay between writing CTRLA.ENABLE and until the peripheral is enabled/disabled. The value written to CTRLA.ENABLE will read back immediately and the Enable bit in the Synchronization Busy register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete. Value 0 1 Description The peripheral is disabled The peripheral is enabled Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets all registers in the RTC (except DBGCTRL) to their initial state, and the RTC will be disabled. Writing a '1' to CTRLA.SWRST will always take precedence, meaning that all other writes in the same write-operation will be discarded. Due to synchronization there is a delay between writing CTRLA.SWRST and until the reset is complete. CTRLA.SWRST will be cleared when the reset is complete. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description There is not reset operation ongoing The reset operation is ongoing 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 289 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.2 Control B in COUNT32 mode (CTRLA.MODE=0) Name:
Offset:
Reset:
Property: Enable-Protected CTRLB 0x02 0x0000 Bit 15 14 R/W 0 13 ACTF[2:0]
R/W 0 12 R/W 0 7 DMAEN R/W 0 6 RTCOUT R/W 0 5 DEBASYNC R/W 0 4 DEBMAJ R/W 0 Access Reset Bit Access Reset 11 3 10 R/W 0 2 9 DEBF[2:0]
R/W 0 1 8 R/W 0 0 GP0EN R/W 0 Bits 14:12 ACTF[2:0]Active Layer Frequency These bits define the prescaling factor for the RTC clock output (OUT) used during active layer protection in terms of the CLK_RTC. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description CLK_RTC_OUT = CLK_RTC / 2 CLK_RTC_OUT = CLK_RTC / 4 CLK_RTC_OUT = CLK_RTC / 8 CLK_RTC_OUT = CLK_RTC / 16 CLK_RTC_OUT = CLK_RTC / 32 CLK_RTC_OUT = CLK_RTC / 64 CLK_RTC_OUT = CLK_RTC / 128 CLK_RTC_OUT = CLK_RTC / 256 Name DIV2 DIV4 DIV8 DIV16 DIV32 DIV64 DIV128 DIV256 Bits 10:8 DEBF[2:0]Debounce Frequency These bits define the prescaling factor for the input debouncers in terms of the CLK_RTC. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description CLK_RTC_DEB = CLK_RTC / 2 CLK_RTC_DEB = CLK_RTC / 4 CLK_RTC_DEB = CLK_RTC / 8 CLK_RTC_DEB = CLK_RTC / 16 CLK_RTC_DEB = CLK_RTC / 32 CLK_RTC_DEB = CLK_RTC / 64 CLK_RTC_DEB = CLK_RTC / 128 CLK_RTC_DEB = CLK_RTC / 256 Name DIV2 DIV4 DIV8 DIV16 DIV32 DIV64 DIV128 DIV256 Bit 7 DMAENDMA Enable The RTC can trigger a DMA request when the timestamp is ready in the TIMESTAMP register. Value 0 1 Description Tamper DMA request is disabled. Reading TIMESTAMP has no effect on INTFLAG.TAMPER. Tamper DMA request is enabled. Reading TIMESTAMP will clear INTFLAG.TAMPER. Bit 6 RTCOUTRTC Output Enable Value 0 1 Description The RTC active layer output is disabled. The RTC active layer output is enabled. Bit 5 DEBASYNCDebouncer Asynchronous Enable 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 290 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Value 0 1 Description The tamper input debouncers operate synchronously. The tamper input debouncers operate asynchronously. Bit 4 DEBMAJDebouncer Majority Enable Value 0 1 Description The tamper input debouncers match three equal values. The tamper input debouncers match majority two of three values. Bit 0 GP0ENGeneral Purpose 0 Enable Value 0 1 Description COMP0 compare function enabled. GP0/GP1 disabled. COMP0 compare function disabled. GP0/GP1 enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 291 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.3 Event Control in COUNT32 mode (CTRLA.MODE=0) Name:
Offset:
Reset:
Property: Enable-Protected EVCTRL 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset Bit Access Reset 15 OVFEO R/W 0 7 PEREO7 R/W 0 14 13 12 11 10 9 8 6 PEREO6 R/W 0 5 PEREO5 R/W 0 4 PEREO4 R/W 0 3 PEREO3 R/W 0 2 PEREO2 R/W 0 1 PEREO1 R/W 0 0 PEREO0 R/W 0 Bit 15 OVFEOOverflow Event Output Enable Value 0 1 Description Overflow event is disabled and will not be generated. Overflow event is enabled and will be generated for every overflow. Bits 0, 1, 2, 3, 4, 5, 6, 7 PEREOnPeriodic Interval n Event Output Enable [n = 7..0]
Value 0 1 Description Periodic Interval n event is disabled and will not be generated. Periodic Interval n event is enabled and will be generated. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 292 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.4 Interrupt Enable Clear in COUNT32 mode (CTRLA.MODE=0) Name:
Offset:
Reset:
INTENCLR 0x08 0x0000 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set (INTENSET) register. Bit Access Reset Bit Access Reset 15 OVF R/W 0 7 PER7 R/W 0 14 13 12 11 10 9 8 6 PER6 R/W 0 5 PER5 R/W 0 4 PER4 R/W 0 3 PER3 R/W 0 2 PER2 R/W 0 1 PER1 R/W 0 0 PER0 R/W 0 Bit 15 OVFOverflow Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Overflow Interrupt Enable bit, which disables the Overflow interrupt. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. Bits 0, 1, 2, 3, 4, 5, 6, 7 PERnPeriodic Interval n Interrupt Enable [n = 7..0]
Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Periodic Interval n Interrupt Enable bit, which disables the Periodic Interval n interrupt. Value 0 1 Description Periodic Interval n interrupt is disabled. Periodic Interval n interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 293 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.5 Interrupt Enable Set in COUNT32 mode (CTRLA.MODE=0) Name:
Offset:
Reset:
INTENSET 0x0A 0x0000 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear (INTENCLR) register. Bit Access Reset Bit Access Reset 15 OVF R/W 0 7 PER7 R/W 0 14 13 12 11 10 9 8 6 PER6 R/W 0 5 PER5 R/W 0 4 PER4 R/W 0 3 PER3 R/W 0 2 PER2 R/W 0 1 PER1 R/W 0 0 PER0 R/W 0 Bit 15 OVFOverflow Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Overflow Interrupt Enable bit, which enables the Overflow interrupt. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. Bits 0, 1, 2, 3, 4, 5, 6, 7 PERnPeriodic Interval n Interrupt Enable [n = 7..0]
Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Periodic Interval n Interrupt Enable bit, which enables the Periodic Interval n interrupt. Value 0 1 Description Periodic Interval n interrupt is disabled. Periodic Interval n interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 294 21.8.6 Interrupt Flag Status and Clear in COUNT32 mode (CTRLA.MODE=0) PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Name:
Offset:
Reset:
Property:
INTFLAG 0x0C 0x0000
Bit Access Reset Bit Access Reset 15 OVF R/W 0 7 PER7 R/W 0 14 TAMPER R/W 0 6 PER6 R/W 0 Bit 15 OVFOverflow 13 12 11 10 9 8 5 PER5 R/W 0 4 PER4 R/W 0 3 PER3 R/W 0 2 PER2 R/W 0 1 PER1 R/W 0 0 PER0 R/W 0 This flag is cleared by writing a '1' to the flag. This flag is set on the next CLK_RTC_CNT cycle after an overflow condition occurs, and an interrupt request will be generated if INTENCLR/SET.OVF is '1'. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Overflow interrupt flag. Bit 14 TAMPERTamper event This flag is set after a tamper condition occurs, and an interrupt request will be generated if INTENCLR.TAMPER/
INTENSET.TAMPER is '1'. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Tamper interrupt flag. Bits 0, 1, 2, 3, 4, 5, 6, 7 PERnPeriodic Interval n [n = 7..0]
This flag is cleared by writing a '1' to the flag. This flag is set on the 0-to-1 transition of prescaler bit [n+2], and an interrupt request will be generated if INTENCLR/
SET.PERn is one. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Periodic Interval n interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 295 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.7 Debug Control Name:
Offset:
Reset:
DBGCTRL 0x0E 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGRUNDebug Run This bit is not reset by a software reset. This bit controls the functionality when the CPU is halted by an external debugger. Value 0 1 Description The RTC is halted when the CPU is halted by an external debugger. The RTC continues normal operation when the CPU is halted by an external debugger. DBGRUN R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 296 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.8 Synchronization Busy in COUNT32 mode (CTRLA.MODE=0) Name:
Offset:
Reset:
Property:
SYNCBUSY 0x10 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 COUNTSYNC R 0 Access Reset 14 13 12 11 10 9 8 Bit 7 6 5 4 Access Reset 3 COUNT R 0 2 FREQCORR R 0 1 ENABLE R 0 0 SWRST R 0 Bit 15 COUNTSYNCCount Read Sync Enable Synchronization Busy Status Value 0 1 Description Write synchronization for CTRLA.COUNTSYNC bit is complete. Write synchronization for CTRLA.COUNTSYNC bit is ongoing. Bit 3 COUNTCount Value Synchronization Busy Status Description Read/write synchronization for COUNT register is complete. Read/write synchronization for COUNT register is ongoing. Value 0 1 Bit 2 FREQCORRFrequency Correction Synchronization Busy Status Value 0 1 Description Write synchronization for FREQCORR register is complete. Write synchronization for FREQCORR register is ongoing. Bit 1 ENABLEEnable Synchronization Busy Status Value 0 1 Description Write synchronization for CTRLA.ENABLE bit is complete. Write synchronization for CTRLA.ENABLE bit is ongoing. Bit 0 SWRSTSoftware Reset Synchronization Busy Status Note: During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description Write synchronization for CTRLA.SWRST bit is complete. Write synchronization for CTRLA.SWRST bit is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 297 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.9 Frequency Correction FREQCORR Name:
0x14 Offset:
Reset:
0x00 Property: Write-Synchronized Bit Access Reset 7 SIGN R/W 0 6 R/W 0 5 R/W 0 4 R/W 0 3 VALUE[6:0]
R/W 0 2 R/W 0 1 R/W 0 0 R/W 0 Bit 7 SIGNCorrection Sign Value 0 1 Description The correction value is positive, i.e., frequency will be decreased. The correction value is negative, i.e., frequency will be increased. Bits 6:0 VALUE[6:0]Correction Value These bits define the amount of correction applied to the RTC prescaler. Value 0 1 - 127 Description Correction is disabled and the RTC frequency is unchanged. The RTC frequency is adjusted according to the value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 298 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.10 Counter Value in COUNT32 mode (CTRLA.MODE=0) Name:
Offset:
Reset:
Property: Write-Synchronized, Read-Synchronized COUNT 0x18 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 COUNT[31:24]
R/W 0 20 R/W 0 19 COUNT[23:16]
R/W 0 12 R/W 0 11 COUNT[15:8]
R/W 0 4 R/W 0 3 COUNT[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 COUNT[31:0]Counter Value These bits define the value of the 32-bit RTC counter in mode 0. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 299 21.8.11 Compare 0 Value in COUNT32 mode (CTRLA.MODE=0) PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Name:
Offset:
Reset:
Property: Write-Synchronized COMP0 0x20 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 COMP[31:24]
R/W 0 20 R/W 0 19 COMP[23:16]
R/W 0 12 R/W 0 11 COMP[15:8]
R/W 0 4 R/W 0 COMP[7:0]
R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 COMP[31:0]Compare Value The 32-bit value of COMPn is continuously compared with the 32-bit COUNT value. When a match occurs, the Compare n interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.CMPn) is set on the next counter cycle, and the counter value is cleared if CTRLA.MATCHCLR is one. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 300 21.8.12 Compare 1 Value in COUNT32 mode (CTRLA.MODE=1) PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Name:
Offset:
Reset:
Property: Write-Synchronized COMP1 0x24 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 COMP[31:24]
R/W 0 20 R/W 0 19 COMP[23:16]
R/W 0 12 R/W 0 11 COMP[15:8]
R/W 0 4 R/W 0 COMP[7:0]
R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 COMP[31:0]Compare Value The 32-bit value of COMPn is continuously compared with the 32-bit COUNT value. When a match occurs, the Compare n interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.CMPn) is set on the next counter cycle, and the counter value is cleared if CTRLA.MATCHCLR is one. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 301 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.13 General Purpose n Name:
Offset:
Reset:
Property:
GPn 0x40 + n*0x04 [n=0..3]
0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 GP[31:24]
GP[23:16]
GP[15:8]
GP[7:0]
27 R/W 0 19 R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 GP[31:0]General Purpose These bits are for user-defined general purpose use, see General Purpose Registers from Related Links. Related Links 21.6.8.4. General Purpose Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 302 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.14 Tamper Control Name:
Offset:
Reset:
Property: Enable-Protected TAMPCTRL 0x60 0x00000000 Bit 31 30 29 28 Access Reset Bit 23 22 21 20 Access Reset Bit 15 14 13 12 Access Reset 27 DEBNC3 26 DEBNC2 25 DEBNC1 24 DEBNC0 0 0 0 0 19 TAMLVL3 18 TAMLVL2 17 TAMLVL1 16 TAMLVL0 0 11 0 10 0 9 0 8 Bit 7 6 5 Access Reset 4 0 IN3ACT[1:0]
3 0 2 0 IN2ACT[1:0]
1 0 0 IN0ACT[1:0]
0 Bits 24, 25, 26, 27 DEBNCnDebounce Enable of Tamper Input INn [n=0..3]
Note:Debounce feature does not apply to the Active Layer Protection mode (TAMPCTRL.INACT = ACTL). Value 0 1 Description Debouncing is disabled for Tamper input INn Debouncing is enabled for Tamper input INn Bits 16, 17, 18, 19 TAMLVLnTamper Level Select of Tamper Input INn [n=0..3]
Note:Tamper Level feature does not apply to the Active Layer Protection mode (TAMPCTRL.INACT = ACTL). Value 0 1 Description A falling edge condition will be detected on Tamper input INn. A rising edge condition will be detected on Tamper input INn. Bits 0:1, 1:2, 2:3, 3:4 INnACTTamper Channel n Action [n=0..3]
These bits determine the action taken by Tamper Channel n. Value 0x0 0x1 0x2 0x3 Description Name Off (Disabled) OFF WAKE Wake and set Tamper flag CAPTURE Capture timestamp and set Tamper flag ACTL Compare RTC signal routed between INn and OUT pins . When a mismatch occurs, capture timestamp and set Tamper flag 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 303 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.15 Tamper ID Name:
Offset:
Reset:
TAMPID 0x68 0x00000000 Bit Access Reset 31 TAMPEVT R/W 0 30 29 28 27 26 25 24 Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 Access Reset 3 TAMPID3 R/W 0 2 TAMPID2 R/W 0 1 TAMPID1 R/W 0 0 TAMPID0 R/W 0 Bit 31 TAMPEVTTamper Event Detected Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the tamper detection bit. Value 0 1 Description A tamper input event has not been detected A tamper input event has been detected Bits 0, 1, 2, 3 TAMPIDnTamper on Channel n Detected [n=0..3]
Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the tamper detection bit. Value 0 1 Description A tamper condition has not been detected on Channel n A tamper condition has been detected on Channel n 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 304 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.8.16 Backup0 Name:
Offset:
Reset:
BKUP0 0x80 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 BKUP[31:24]
R/W 0 20 R/W 0 19 BKUP[23:16]
R/W 0 12 R/W 0 4 R/W 0 R/W 0 11 R/W 0 3 R/W 0 BKUP[15:8]
BKUP[7:0]
26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 BKUP[31:0]Backup These bits are user-defined for general purpose use in the Backup domain. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 305 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.9 Register Summary - Mode 1 - 16-Bit Counter Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CTRLA 0x02 CTRLB 0x04 EVCTRL 0x08 INTENCLR 0x0A INTENSET 0x0C 0x0E 0x0F INTFLAG DBGCTRL Reserved 0x10 SYNCBUSY 0x14 0x15
... 0x17 0x18 0x1A
... 0x1B 0x1C 0x1E
... 0x1F 0x20 FREQCORR Reserved COUNT Reserved PER Reserved COMP0 0x22 COMP1 0x24 COMP2 0x26 0x28
... 0x3F COMP3 Reserved 0x40 GP0 0x44 GP1 7:0 15:8 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 7:0 15:8 7:0 15:8 7:0 7:0 15:8 23:16 31:24 7:0 7:0 15:8 7:0 15:8 7:0 15:8 7:0 15:8 7:0 15:8 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 COUNTSYN C BKTRST PRESCALER[3:0]
DMAEN RTCOUT DEBASYNC DEBMAJ ACTF[2:0]
GP0EN DEBF[2:0]
PEREO7 PEREO6 PEREO5 PEREO4 PEREO3 PEREO2 PEREO1 PEREO0 MODE[1:0]
ENABLE SWRST OVFEO PER7 OVF PER7 OVF PER7 OVF COUNTSYN C PER6 PER5 PER4 PER3 PER2 PER1 PER0 PER6 PER5 PER4 PER3 PER2 PER1 PER0 PER6 PER5 PER4 PER3 PER2 PER1 PER0 PER COUNT FREQCORR ENABLE SWRST DBGRUN SIGN VALUE[6:0]
COUNT[7:0]
COUNT[15:8]
PER[7:0]
PER[15:8]
COMP[7:0]
COMP[15:8]
COMP[7:0]
COMP[15:8]
COMP[7:0]
COMP[15:8]
COMP[7:0]
COMP[15:8]
GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 306 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x48 GP2 0x4C GP3 0x50
... 0x5F Reserved 0x60 TAMPCTRL 0x64
... 0x67 Reserved 0x68 TAMPID 0x6C
... 0x7F Reserved 0x80 BKUP0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
IN3ACT[1:0]
IN2ACT[1:0]
IN0ACT[1:0]
TAMLVL3 TAMLVL2 TAMLVL1 TAMLVL0 DEBNC3 DEBNC2 DEBNC1 DEBNC0 TAMPID3 TAMPID2 TAMPID1 TAMPID0 TAMPEVT BKUP[7:0]
BKUP[15:8]
BKUP[23:16]
BKUP[31:24]
21.10 Register Description - Mode 1 - 16-Bit Counter This Register Description section is valid if the RTC is in COUNT16 mode (CTRLA.MODE=1). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 307 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.1 Control A in COUNT16 mode (CTRLA.MODE=1) Name:
Offset:
Reset:
Property: Enable-Protected, Write-Synchronized CTRLA 0x00 0x0000 Bit 15 COUNTSYNC R/W 0 Access Reset 14 13 BKTRST R/W 0 12 Bit 7 6 5 4 Access Reset 11 R/W 0 3 R/W 0 MODE[1:0]
10 9 PRESCALER[3:0]
R/W 0 2 R/W 0 R/W 0 1 ENABLE R/W 0 8 R/W 0 0 SWRST R/W 0 Bit 15 COUNTSYNCCOUNT Read Synchronization Enable The COUNT register requires synchronization when reading. Disabling the synchronization will prevent reading valid values from the COUNT register. This bit is not enable-protected. Value 0 1 Description COUNT read synchronization is disabled COUNT read synchronization is enabled Bit 13 BKTRSTBKUP Registers Reset On Tamper Enable All BKUPn registers are affected. This bit can be written only when the peripheral is disabled. This bit is not synchronized. Value 0 1 Description BKUPn registers will not reset when a tamper condition occurs. BKUPn registers will reset when a tamper condition occurs. Bits 11:8 PRESCALER[3:0]Prescaler These bits define the prescaling factor for the RTC clock source (GCLK_RTC) to generate the counter clock
(CLK_RTC_CNT). Periodic events and interrupts are not available when the prescaler is off. These bits are not synchronized. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC-0xF Description CLK_RTC_CNT = GCLK_RTC/1 CLK_RTC_CNT = GCLK_RTC/1 CLK_RTC_CNT = GCLK_RTC/2 CLK_RTC_CNT = GCLK_RTC/4 CLK_RTC_CNT = GCLK_RTC/8 CLK_RTC_CNT = GCLK_RTC/16 CLK_RTC_CNT = GCLK_RTC/32 CLK_RTC_CNT = GCLK_RTC/64 CLK_RTC_CNT = GCLK_RTC/128 CLK_RTC_CNT = GCLK_RTC/256 CLK_RTC_CNT = GCLK_RTC/512 CLK_RTC_CNT = GCLK_RTC/1024 Reserved Name OFF DIV1 DIV2 DIV4 DIV8 DIV16 DIV32 DIV64 DIV128 DIV256 DIV512 DIV1024
Bits 3:2 MODE[1:0]Operating Mode This field defines the operating mode of the RTC. This bit is not synchronized. Value 0x0 0x1 Description Mode 0: 32-bit counter Mode 1: 16-bit counter Name COUNT32 COUNT16 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 308 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Value 0x2 0x3 Name CLOCK
Description Mode 2: Clock/calendar Reserved Bit 1 ENABLEEnable Due to synchronization there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRLA.ENABLE will read back immediately and the Enable bit in the Synchronization Busy register
(SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete. Value 0 1 Description The peripheral is disabled The peripheral is enabled Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets all registers in the RTC (except DBGCTRL) to their initial state, and the RTC will be disabled. Writing a '1' to CTRLA.SWRST will always take precedence, meaning that all other writes in the same write-operation will be discarded. Due to synchronization there is a delay from writing CTRLA.SWRST until the reset is complete. CTRLA.SWRST will be cleared when the reset is complete. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description There is not reset operation ongoing The reset operation is ongoing 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 309 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.2 Control B in COUNT16 mode (CTRLA.MODE=1) Name:
Offset:
Reset:
Property: Enable-Protected CTRLB 0x02 0x0000 Bit 15 14 R/W 0 13 ACTF[2:0]
R/W 0 12 R/W 0 7 DMAEN R/W 0 6 RTCOUT R/W 0 5 DEBASYNC R/W 0 4 DEBMAJ R/W 0 Access Reset Bit Access Reset 11 3 10 R/W 0 2 9 DEBF[2:0]
R/W 0 1 8 R/W 0 0 GP0EN R/W 0 Bits 14:12 ACTF[2:0]Active Layer Frequency These bits define the prescaling factor for the RTC clock output (OUT) used during active layer protection in terms of the CLK_RTC. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description CLK_RTC_OUT = CLK_RTC / 2 CLK_RTC_OUT = CLK_RTC / 4 CLK_RTC_OUT = CLK_RTC / 8 CLK_RTC_OUT = CLK_RTC / 16 CLK_RTC_OUT = CLK_RTC / 32 CLK_RTC_OUT = CLK_RTC / 64 CLK_RTC_OUT = CLK_RTC / 128 CLK_RTC_OUT = CLK_RTC / 256 Name DIV2 DIV4 DIV8 DIV16 DIV32 DIV64 DIV128 DIV256 Bits 10:8 DEBF[2:0]Debounce Frequency These bits define the prescaling factor for the input debouncers in terms of the CLK_RTC. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description CLK_RTC_DEB = CLK_RTC / 2 CLK_RTC_DEB = CLK_RTC / 4 CLK_RTC_DEB = CLK_RTC / 8 CLK_RTC_DEB = CLK_RTC / 16 CLK_RTC_DEB = CLK_RTC / 32 CLK_RTC_DEB = CLK_RTC / 64 CLK_RTC_DEB = CLK_RTC / 128 CLK_RTC_DEB = CLK_RTC / 256 Name DIV2 DIV4 DIV8 DIV16 DIV32 DIV64 DIV128 DIV256 Bit 7 DMAENDMA Enable The RTC can trigger a DMA request when the timestamp is ready in the TIMESTAMP register. Value 0 1 Description Tamper DMA request is disabled. Reading TIMESTAMP has no effect on INTFLAG.TAMPER. Tamper DMA request is enabled. Reading TIMESTAMP will clear INTFLAG.TAMPER. Bit 6 RTCOUTRTC Output Enable Value 0 1 Description The RTC active layer output is disabled. The RTC active layer output is enabled. Bit 5 DEBASYNCDebouncer Asynchronous Enable 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 310 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Value 0 1 Description The tamper input debouncers operate synchronously. The tamper input debouncers operate asynchronously. Bit 4 DEBMAJDebouncer Majority Enable Value 0 1 Description The tamper input debouncers match three equal values. The tamper input debouncers match majority two of three values. Bit 0 GP0ENGeneral Purpose 0 Enable Value 0 1 Description COMP0 compare function enabled. GP0/GP1 disabled. COMP0 compare function disabled. GP0/GP1 enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 311 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.3 Event Control in COUNT16 mode (CTRLA.MODE=1) Name:
Offset:
Reset:
Property: Enable-Protected EVCTRL 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset Bit Access Reset 15 OVFEO R/W 0 7 PEREO7 R/W 0 14 13 12 11 10 9 8 6 PEREO6 R/W 0 5 PEREO5 R/W 0 4 PEREO4 R/W 0 3 PEREO3 R/W 0 2 PEREO2 R/W 0 1 PEREO1 R/W 0 0 PEREO0 R/W 0 Bit 15 OVFEOOverflow Event Output Enable Value 0 1 Description Overflow event is disabled and will not be generated. Overflow event is enabled and will be generated for every overflow. Bits 0, 1, 2, 3, 4, 5, 6, 7 PEREOnPeriodic Interval n Event Output Enable [n = 7..0]
Value 0 1 Description Periodic Interval n event is disabled and will not be generated. Periodic Interval n event is enabled and will be generated. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 312 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.4 Interrupt Enable Clear in COUNT16 mode (CTRLA.MODE=1) Name:
Offset:
Reset:
INTENCLR 0x08 0x0000 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set (INTENSET) register. Bit Access Reset Bit Access Reset 15 OVF R/W 0 7 PER7 R/W 0 14 13 12 11 10 9 8 6 PER6 R/W 0 5 PER5 R/W 0 4 PER4 R/W 0 3 PER3 R/W 0 2 PER2 R/W 0 1 PER1 R/W 0 0 PER0 R/W 0 Bit 15 OVFOverflow Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Overflow Interrupt Enable bit, which disables the Overflow interrupt. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. Bits 0, 1, 2, 3, 4, 5, 6, 7 PERnPeriodic Interval n Interrupt Enable [n = 7..0]
Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Periodic Interval n Interrupt Enable bit, which disables the Periodic Interval n interrupt. Description Value Periodic Interval n interrupt is disabled. 0 Periodic Interval n interrupt is enabled. 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 313 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.5 Interrupt Enable Set in COUNT16 mode (CTRLA.MODE=1) Name:
Offset:
Reset:
INTENSET 0x0A 0x0000 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear (INTENCLR) register. Bit Access Reset Bit Access Reset 15 OVF R/W 0 7 PER7 R/W 0 14 13 12 11 10 9 8 6 PER6 R/W 0 5 PER5 R/W 0 4 PER4 R/W 0 3 PER3 R/W 0 2 PER2 R/W 0 1 PER1 R/W 0 0 PER0 R/W 0 Bit 15 OVFOverflow Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Overflow Interrupt Enable bit, which enables the Overflow interrupt. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. Bits 0, 1, 2, 3, 4, 5, 6, 7 PERnPeriodic Interval n Interrupt Enable [n = 7..0]
Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Periodic Interval n Interrupt Enable bit, which enables the Periodic Interval n interrupt. Description Value Periodic Interval n interrupt is disabled. 0 Periodic Interval n interrupt is enabled. 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 314 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.6 Interrupt Flag Status and Clear in COUNT16 mode (CTRLA.MODE=1) Name:
Offset:
Reset:
Property:
INTFLAG 0x0C 0x0000
Bit Access Reset Bit Access Reset 15 OVF R/W 0 7 PER7 R/W 0 Bit 15 OVFOverflow 14 13 12 11 10 9 8 6 PER6 R/W 0 5 PER5 R/W 0 4 PER4 R/W 0 3 PER3 R/W 0 2 PER2 R/W 0 1 PER1 R/W 0 0 PER0 R/W 0 This flag is cleared by writing a '1' to the flag. This flag is set on the next CLK_RTC_CNT cycle after an overflow condition occurs, and an interrupt request will be generated if INTENCLR/SET.OVF is '1'. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Overflow interrupt flag. Bits 0, 1, 2, 3, 4, 5, 6, 7 PERnPeriodic Interval n [n = 7..0]
This flag is cleared by writing a '1' to the flag. This flag is set on the 0-to-1 transition of prescaler bit [n+2], and an interrupt request will be generated if INTENCLR/
SET.PERx is one. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Periodic Interval n interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 315 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.7 Debug Control Name:
Offset:
Reset:
DBGCTRL 0x0E 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGRUNDebug Run This bit is not reset by a software reset. This bit controls the functionality when the CPU is halted by an external debugger. Value 0 1 Description The RTC is halted when the CPU is halted by an external debugger. The RTC continues normal operation when the CPU is halted by an external debugger. DBGRUN R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 316 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.8 Synchronization Busy in COUNT16 mode (CTRLA.MODE=1) Name:
Offset:
Reset:
SYNCBUSY 0x10 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 COUNTSYNC R 0 Access Reset 14 13 12 11 10 9 8 Bit 7 6 5 Access Reset 4 PER R 0 3 COUNT R 0 2 FREQCORR R 0 1 ENABLE R 0 0 SWRST R 0 Bit 15 COUNTSYNCCount Read Sync Enable Synchronization Busy Status Value 0 1 Description Write synchronization for CTRLA.COUNTSYNC bit is complete. Write synchronization for CTRLA.COUNTSYNC bit is ongoing. Bit 4 PERPeriod Synchronization Busy Status Value 0 1 Description Write synchronization for PER register is complete. Write synchronization for PER register is ongoing. Bit 3 COUNTCount Value Synchronization Busy Status Description Read/write synchronization for COUNT register is complete. Read/write synchronization for COUNT register is ongoing. Value 0 1 Bit 2 FREQCORRFrequency Correction Synchronization Busy Status Value 0 1 Description Write synchronization for FREQCORR register is complete. Write synchronization for FREQCORR register is ongoing. Bit 1 ENABLEEnable Synchronization Busy Status Value 0 1 Description Write synchronization for CTRLA.ENABLE bit is complete. Write synchronization for CTRLA.ENABLE bit is ongoing. Bit 0 SWRSTSoftware Reset Synchronization Busy Status Note: During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 317 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Value 0 1 Description Write synchronization for CTRLA.SWRST bit is complete. Write synchronization for CTRLA.SWRST bit is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 318 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.9 Frequency Correction FREQCORR Name:
0x14 Offset:
Reset:
0x00 Property: Write-Synchronized Bit Access Reset 7 SIGN R/W 0 6 R/W 0 5 R/W 0 4 R/W 0 3 VALUE[6:0]
R/W 0 2 R/W 0 1 R/W 0 0 R/W 0 Bit 7 SIGNCorrection Sign Value 0 1 Description The correction value is positive, i.e., frequency will be decreased. The correction value is negative, i.e., frequency will be increased. Bits 6:0 VALUE[6:0]Correction Value These bits define the amount of correction applied to the RTC prescaler. Value 0 1 - 127 Description Correction is disabled and the RTC frequency is unchanged. The RTC frequency is adjusted according to the value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 319 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.10 Counter Value in COUNT16 mode (CTRLA.MODE=1) Name:
Offset:
Reset:
Property: Write-Synchronized, Read-Synchronized COUNT 0x18 0x0000 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 12 11 COUNT[15:8]
R/W 0 4 R/W 0 3 COUNT[7:0]
R/W 0 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 COUNT[15:0]Counter Value These bits define the value of the 16-bit RTC counter in COUNT16 mode (CTRLA.MODE=1). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 320 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.11 Counter Period in COUNT16 mode (CTRLA.MODE=1) PER Name:
0x1C Offset:
Reset:
0x0000 Property: Write-Synchronized Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 PER[15:8]
PER[7:0]
12 R/W 0 4 R/W 0 11 R/W 0 3 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 PER[15:0]Counter Period These bits define the value of the 16-bit RTC period in COUNT16 mode (CTRLA.MODE=1). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 321 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.12 Compare n Value in COUNT16 mode (CTRLA.MODE=1) Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized COMP 0x20 + n*0x02 [n=0..3]
0x0000 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 12 11 COMP[15:8]
R/W 0 4 R/W 0 COMP[7:0]
R/W 0 3 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 COMP[15:0]Compare Value The 16-bit value of COMPn is continuously compared with the 16-bit COUNT value. When a match occurs, the Compare n interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.CMPn) is set on the next counter cycle. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 322 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.13 General Purpose n Name:
Offset:
Reset:
Property:
GPn 0x40 + n*0x04 [n=0..3]
0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 GP[31:24]
GP[23:16]
GP[15:8]
GP[7:0]
27 R/W 0 19 R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 GP[31:0]General Purpose These bits are for user-defined general purpose use, see General Purpose Registers from Related Links. Related Links 21.6.8.4. General Purpose Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 323 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.14 Tamper Control Name:
Offset:
Reset:
Property: Enable-Protected TAMPCTRL 0x60 0x00000000 Bit 31 30 29 28 Access Reset Bit 23 22 21 20 Access Reset Bit 15 14 13 12 Access Reset 27 DEBNC3 26 DEBNC2 25 DEBNC1 24 DEBNC0 0 0 0 0 19 TAMLVL3 18 TAMLVL2 17 TAMLVL1 16 TAMLVL0 0 11 0 10 0 9 0 8 Bit 7 6 5 Access Reset 4 0 IN3ACT[1:0]
3 0 2 0 IN2ACT[1:0]
1 0 0 IN0ACT[1:0]
0 Bits 24, 25, 26, 27 DEBNCnDebounce Enable of Tamper Input INn [n=0..3]
Note:Debounce feature does not apply to the Active Layer Protection mode (TAMPCTRL.INACT = ACTL). Value 0 1 Description Debouncing is disabled for Tamper input INn Debouncing is enabled for Tamper input INn Bits 16, 17, 18, 19 TAMLVLnTamper Level Select of Tamper Input INn [n=0..3]
Note:Tamper Level feature does not apply to the Active Layer Protection mode (TAMPCTRL.INACT = ACTL). Value 0 1 Description A falling edge condition will be detected on Tamper input INn. A rising edge condition will be detected on Tamper input INn. Bits 0:1, 1:2, 2:3, 3:4 INnACTTamper Channel n Action [n=0..3]
These bits determine the action taken by Tamper Channel n. Value 0x0 0x1 0x2 0x3 Description Name Off (Disabled) OFF WAKE Wake and set Tamper flag CAPTURE Capture timestamp and set Tamper flag ACTL Compare RTC signal routed between INn and OUT pins . When a mismatch occurs, capture timestamp and set Tamper flag 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 324 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.15 Tamper ID Name:
Offset:
Reset:
TAMPID 0x68 0x00000000 Bit Access Reset 31 TAMPEVT R/W 0 30 29 28 27 26 25 24 Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 Access Reset 3 TAMPID3 R/W 0 2 TAMPID2 R/W 0 1 TAMPID1 R/W 0 0 TAMPID0 R/W 0 Bit 31 TAMPEVTTamper Event Detected Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the tamper detection bit. Value 0 1 Description A tamper input event has not been detected A tamper input event has been detected Bits 0, 1, 2, 3 TAMPIDnTamper on Channel n Detected [n=0..3]
Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the tamper detection bit. Value 0 1 Description A tamper condition has not been detected on Channel n A tamper condition has been detected on Channel n 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 325 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.10.16 Backup0 Name:
Offset:
Reset:
BKUP0 0x80 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 BKUP[31:24]
R/W 0 20 R/W 0 19 BKUP[23:16]
R/W 0 12 R/W 0 4 R/W 0 R/W 0 11 R/W 0 3 R/W 0 BKUP[15:8]
BKUP[7:0]
26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 BKUP[31:0]Backup These bits are user-defined for general purpose use in the Backup domain. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 326 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.11 Register Summary - Mode 2 - Clock/Calendar Offset Name Bit Pos. 7 6 5 4 3 2 1 0 7:0 MATCHCLR CLKREP MODE[1:0]
ENABLE SWRST 0x00 CTRLA 0x02 CTRLB 0x04 EVCTRL 0x08 INTENCLR 0x0A INTENSET 0x0C 0x0E 0x0F INTFLAG DBGCTRL Reserved 0x10 SYNCBUSY 0x14 0x15
... 0x17 FREQCORR Reserved 0x18 CLOCK 0x1C
... 0x1F Reserved 0x20 ALARM0 0x24 0x25
... 0x27 MASK0 Reserved 0x28 ALARM1 0x2C 0x2D
... 0x3F MASK1 Reserved 0x40 GP0 15:8 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 7:0 15:8 7:0 15:8 7:0 7:0 15:8 23:16 31:24 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 7:0 15:8 23:16 31:24 7:0 7:0 15:8 23:16 31:24 CLOCKSYN C BKTRST PRESCALER[3:0]
DMAEN RTCOUT DEBASYNC DEBMAJ ACTF[2:0]
GP0EN DEBF[2:0]
PEREO7 PEREO6 PEREO5 PEREO4 PEREO3 PEREO2 PEREO1 PEREO0 ALARMEO1 ALARMEO0 PER6 PER5 PER4 PER3 PER2 PER1 PER0 PER6 PER5 PER4 PER3 PER2 PER1 PER0 PER6 PER5 PER4 PER3 PER2 PER1 PER0 DBGRUN CLOCK FREQCORR ENABLE SWRST OVFEO PER7 OVF PER7 OVF PER7 OVF CLOCKSYN C SIGN VALUE[6:0]
MINUTE[1:0]
MONTH[1:0]
HOUR[3:0]
SECOND[5:0]
MINUTE[5:2]
DAY[4:0]
YEAR[5:0]
HOUR[4]
MONTH[3:2]
MINUTE[1:0]
MONTH[1:0]
HOUR[3:0]
SECOND[5:0]
MINUTE[5:2]
DAY[4:0]
HOUR[4]
YEAR[5:0]
MONTH[3:2]
SEL[2:0]
MINUTE[1:0]
MONTH[1:0]
HOUR[3:0]
SECOND[5:0]
MINUTE[5:2]
DAY[4:0]
HOUR[4]
YEAR[5:0]
MONTH[3:2]
SEL[2:0]
GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 327 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x44 GP1 0x48 GP2 0x4C GP3 0x50
... 0x5F Reserved 0x60 TAMPCTRL 0x64
... 0x67 Reserved 0x68 TAMPID 0x6C
... 0x7F Reserved 0x80 BKUP0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
GP[7:0]
GP[15:8]
GP[23:16]
GP[31:24]
IN3ACT[1:0]
IN2ACT[1:0]
IN0ACT[1:0]
TAMLVL3 TAMLVL2 TAMLVL1 TAMLVL0 DEBNC3 DEBNC2 DEBNC1 DEBNC0 TAMPID3 TAMPID2 TAMPID1 TAMPID0 TAMPEVT BKUP[7:0]
BKUP[15:8]
BKUP[23:16]
BKUP[31:24]
21.12 Register Description - Mode 2 - Clock/Calendar This Register Description section is valid if the RTC is in Clock/Calendar mode (CTRLA.MODE=2). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 328 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.1 Control A in Clock/Calendar mode (CTRLA.MODE=2) Name:
Offset:
Reset:
Property: Enable-Protected, Write-Synchronized CTRLA 0x00 0x0000 Bit 15 CLOCKSYNC R/W 0 Access Reset 14 13 BKTRST R/W 0 12 Bit 7 MATCHCLR Access Reset R/W 0 6 CLKREP R/W 0 5 4 Bit 15 CLOCKSYNCCLOCK Read Synchronization Enable 11 R/W 0 3 R/W 0 MODE[1:0]
10 9 PRESCALER[3:0]
R/W 0 2 R/W 0 R/W 0 1 ENABLE R/W 0 8 R/W 0 0 SWRST R/W 0 The CLOCK register requires synchronization when reading. Disabling the synchronization will prevent reading valid values from the CLOCK register. This bit is not enable-protected. Value 0 1 Description CLOCK read synchronization is disabled CLOCK read synchronization is enabled Bit 13 BKTRSTBKUP Registers Reset On Tamper Enable All BKUPn registers are affected. This bit can be written only when the peripheral is disabled. This bit is not synchronized. Value 0 1 Description BKUPn registers will not reset when a tamper condition occurs. BKUPn registers will reset when a tamper condition occurs. Bits 11:8 PRESCALER[3:0]Prescaler These bits define the prescaling factor for the RTC clock source (GCLK_RTC) to generate the counter clock
(CLK_RTC_CNT). Periodic events and interrupts are not available when the prescaler is off. These bits are not synchronized. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC-0xF Description CLK_RTC_CNT = GCLK_RTC/1 CLK_RTC_CNT = GCLK_RTC/1 CLK_RTC_CNT = GCLK_RTC/2 CLK_RTC_CNT = GCLK_RTC/4 CLK_RTC_CNT = GCLK_RTC/8 CLK_RTC_CNT = GCLK_RTC/16 CLK_RTC_CNT = GCLK_RTC/32 CLK_RTC_CNT = GCLK_RTC/64 CLK_RTC_CNT = GCLK_RTC/128 CLK_RTC_CNT = GCLK_RTC/256 CLK_RTC_CNT = GCLK_RTC/512 CLK_RTC_CNT = GCLK_RTC/1024 Reserved Name OFF DIV1 DIV2 DIV4 DIV8 DIV16 DIV32 DIV64 DIV128 DIV256 DIV512 DIV1024
Bit 7 MATCHCLRClear on Match This bit is valid only in Mode 0 (COUNT32) and Mode 2 (CLOCK). This bit can be written only when the peripheral is disabled. This bit is not synchronized. Description Value The counter is not cleared on a Compare/Alarm 0 match 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 329 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Value 1 Description The counter is cleared on a Compare/Alarm 0 match Bit 6 CLKREPClock Representation This bit is valid only in Mode 2 and determines how the hours are represented in the Clock Value (CLOCK) register. This bit can be written only when the peripheral is disabled. This bit is not synchronized. Value 0 1 Description 24 Hour 12 Hour (AM/PM) Bits 3:2 MODE[1:0]Operating Mode This field defines the operating mode of the RTC. This bit is not synchronized. Value 0x0 0x1 0x2 0x3 Description Mode 0: 32-bit counter Mode 1: 16-bit counter Mode 2: Clock/calendar Reserved Name COUNT32 COUNT16 CLOCK
Bit 1 ENABLEEnable Due to synchronization there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRLA.ENABLE will read back immediately and the Enable bit in the Synchronization Busy register
(SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete. Value 0 1 Description The peripheral is disabled The peripheral is enabled Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets all registers in the RTC, except DBGCTRL, to their initial state, and the RTC will be disabled. Writing a '1' to CTRLA.SWRST will always take precedence, meaning that all other writes in the same write-operation will be discarded. Due to synchronization there is a delay from writing CTRLA.SWRST until the reset is complete. CTRLA.SWRST will be cleared when the reset is complete. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description There is not reset operation ongoing The reset operation is ongoing 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 330 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.2 Control B in Clock/Calendar mode (CTRLA.MODE=2) Name:
Offset:
Reset:
Property: Enable-Protected CTRLB 0x2 0x0000 Bit 15 14 R/W 0 13 ACTF[2:0]
R/W 0 12 R/W 0 7 DMAEN R/W 0 6 RTCOUT R/W 0 5 DEBASYNC R/W 0 4 DEBMAJ R/W 0 Access Reset Bit Access Reset 11 3 10 R/W 0 2 9 DEBF[2:0]
R/W 0 1 8 R/W 0 0 GP0EN R/W 0 Bits 14:12 ACTF[2:0]Active Layer Frequency These bits define the prescaling factor for the RTC clock output (OUT) used during active layer protection in terms of the CLK_RTC. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description CLK_RTC_OUT = CLK_RTC / 2 CLK_RTC_OUT = CLK_RTC / 4 CLK_RTC_OUT = CLK_RTC / 8 CLK_RTC_OUT = CLK_RTC / 16 CLK_RTC_OUT = CLK_RTC / 32 CLK_RTC_OUT = CLK_RTC / 64 CLK_RTC_OUT = CLK_RTC / 128 CLK_RTC_OUT = CLK_RTC / 256 Name DIV2 DIV4 DIV8 DIV16 DIV32 DIV64 DIV128 DIV256 Bits 10:8 DEBF[2:0]Debounce Frequency These bits define the prescaling factor for the input debouncers in terms of the CLK_RTC. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description CLK_RTC_DEB = CLK_RTC / 2 CLK_RTC_DEB = CLK_RTC / 4 CLK_RTC_DEB = CLK_RTC / 8 CLK_RTC_DEB = CLK_RTC / 16 CLK_RTC_DEB = CLK_RTC / 32 CLK_RTC_DEB = CLK_RTC / 64 CLK_RTC_DEB = CLK_RTC / 128 CLK_RTC_DEB = CLK_RTC / 256 Name DIV2 DIV4 DIV8 DIV16 DIV32 DIV64 DIV128 DIV256 Bit 7 DMAENDMA Enable The RTC can trigger a DMA request when the timestamp is ready in the TIMESTAMP register. Value 0 1 Description Tamper DMA request is disabled. Reading TIMESTAMP has no effect on INTFLAG.TAMPER. Tamper DMA request is enabled. Reading TIMESTAMP will clear INTFLAG.TAMPER. Bit 6 RTCOUTRTC Out Enable Value 0 1 Description The RTC active layer output is disabled. The RTC active layer output is enabled. Bit 5 DEBASYNCDebouncer Asynchronous Enable 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 331 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) Value 0 1 Description The tamper input debouncers operate synchronously. The tamper input debouncers operate asynchronously. Bit 4 DEBMAJDebouncer Majority Enable Value 0 1 Description The tamper input debouncers match three equal values. The tamper input debouncers match majority two of three values. Bit 0 GP0ENGeneral Purpose 0 Enable Value 0 1 Description COMP0 compare function enabled. GP0 disabled. COMP0 compare function disabled. GP0 enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 332 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.3 Event Control in Clock/Calendar mode (CTRLA.MODE=2) Name:
Offset:
Reset:
Property: Enable-Protected EVCTRL 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset Bit Access Reset 15 OVFEO R/W 0 7 PEREO7 R/W 0 14 13 12 11 10 9 ALARMEO1 R/W 0 6 PEREO6 R/W 0 5 PEREO5 R/W 0 4 PEREO4 R/W 0 3 PEREO3 R/W 0 2 PEREO2 R/W 0 1 PEREO1 R/W 0 8 ALARMEO0 R/W 0 0 PEREO0 R/W 0 Bit 15 OVFEOOverflow Event Output Enable Value 0 1 Description Overflow event is disabled and will not be generated. Overflow event is enabled and will be generated for every overflow. Bit 9 ALARMEO1Alarm 1 Event Output Enable Value 0 1 Description Alarm 1 event is disabled and will not be generated. Alarm 1 event is enabled and will be generated for every compare match. Bit 8 ALARMEO0Alarm 0 Event Output Enable Value 0 1 Description Alarm 0 event is disabled and will not be generated. Alarm 0 event is enabled and will be generated for every compare match. Bits 0, 1, 2, 3, 4, 5, 6, 7 PEREOnPeriodic Interval n Event Output Enable [n = 7..0]
Value 0 1 Description Periodic Interval n event is disabled and will not be generated. Periodic Interval n event is enabled and will be generated. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 333 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.4 Interrupt Enable Clear in Clock/Calendar mode (CTRLA.MODE=2) Name:
Offset:
Reset:
INTENCLR 0x08 0x0000 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set (INTENSET) register. Bit Access Reset Bit Access Reset 15 OVF R/W 0 7 PER7 R/W 0 14 13 12 11 10 9 8 6 PER6 R/W 0 5 PER5 R/W 0 4 PER4 R/W 0 3 PER3 R/W 0 2 PER2 R/W 0 1 PER1 R/W 0 0 PER0 R/W 0 Bit 15 OVFOverflow Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Overflow Interrupt Enable bit, which disables the Overflow interrupt. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. Bits 0, 1, 2, 3, 4, 5, 6, 7 PERnPeriodic Interval n Interrupt Enable [n = 7..0]
Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Periodic Interval n Interrupt Enable bit, which disables the Periodic Interval n interrupt. Description Value Periodic Interval n interrupt is disabled. 0 Periodic Interval n interrupt is enabled. 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 334 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.5 Interrupt Enable Set in Clock/Calendar mode (CTRLA.MODE=2) Name:
Offset:
Reset:
INTENSET 0x0A 0x0000 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear (INTENCLR) register. Bit Access Reset Bit Access Reset 15 OVF R/W 0 7 PER7 R/W 0 14 13 12 11 10 9 8 6 PER6 R/W 0 5 PER5 R/W 0 4 PER4 R/W 0 3 PER3 R/W 0 2 PER2 R/W 0 1 PER1 R/W 0 0 PER0 R/W 0 Bit 15 OVFOverflow Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Overflow Interrupt Enable bit, which enables the Overflow interrupt. Value 0 1 Description The Overflow interrupt is disabled. The Overflow interrupt is enabled. Bits 0, 1, 2, 3, 4, 5, 6, 7 PERnPeriodic Interval n Interrupt Enable [n = 7..0]
Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Periodic Interval n Interrupt Enable bit, which enables the Periodic Interval n interrupt. Description Value Periodic Interval n interrupt is disabled. 0 Periodic Interval n interrupt is enabled. 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 335 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.6 Interrupt Flag Status and Clear in Clock/Calendar mode (CTRLA.MODE=2) Name:
Offset:
Reset:
Property:
INTFLAG 0x0C 0x0000
Bit Access Reset Bit Access Reset 15 OVF R/W 0 7 PER7 R/W 0 Bit 15 OVFOverflow 14 13 12 11 10 9 8 6 PER6 R/W 0 5 PER5 R/W 0 4 PER4 R/W 0 3 PER3 R/W 0 2 PER2 R/W 0 1 PER1 R/W 0 0 PER0 R/W 0 This flag is cleared by writing a '1' to the flag. This flag is set on the next CLK_RTC_CNT cycle after an overflow condition occurs, and an interrupt request will be generated if INTENCLR/SET.OVF is '1'. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Overflow interrupt flag. Bits 0, 1, 2, 3, 4, 5, 6, 7 PERnPeriodic Interval n [n = 7..0]
This flag is cleared by writing a '1' to the flag. This flag is set on the 0-to-1 transition of prescaler bit [n+2], and an interrupt request will be generated if INTENCLR/
SET.PERx is '1'. Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the Periodic Interval n interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 336 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.7 Debug Control Name:
Offset:
Reset:
DBGCTRL 0x0E 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGRUNDebug Run This bit is not reset by a software reset. This bit controls the functionality when the CPU is halted by an external debugger. Value 0 1 Description The RTC is halted when the CPU is halted by an external debugger. The RTC continues normal operation when the CPU is halted by an external debugger. DBGRUN R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 337 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.8 Synchronization Busy in Clock/Calendar mode (CTRLA.MODE=2) Name:
Offset:
Reset:
Property:
SYNCBUSY 0x10 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 CLOCKSYNC R 0 Access Reset 14 13 12 11 10 9 8 Bit 7 6 5 4 Access Reset 3 CLOCK R 0 2 FREQCORR R 0 1 ENABLE R 0 0 SWRST R 0 Bit 15 CLOCKSYNCClock Read Sync Enable Synchronization Busy Status Value 0 1 Description Write synchronization for CTRLA.CLOCKSYNC bit is complete. Write synchronization for CTRLA.CLOCKSYNC bit is ongoing. Bit 3 CLOCKClock Register Synchronization Busy Status Description Read/write synchronization for CLOCK register is complete. Read/write synchronization for CLOCK register is ongoing. Value 0 1 Bit 2 FREQCORRFrequency Correction Synchronization Busy Status Value 0 1 Description Write synchronization for FREQCORR register is complete. Write synchronization for FREQCORR register is ongoing. Bit 1 ENABLEEnable Synchronization Busy Status Value 0 1 Description Write synchronization for CTRLA.ENABLE bit is complete. Write synchronization for CTRLA.ENABLE bit is ongoing. Bit 0 SWRSTSoftware Reset Synchronization Busy Status Note: During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description Write synchronization for CTRLA.SWRST bit is complete. Write synchronization for CTRLA.SWRST bit is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 338 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.9 Frequency Correction FREQCORR Name:
0x14 Offset:
Reset:
0x00 Property: Write-Synchronized Bit Access Reset 7 SIGN R/W 0 6 R/W 0 5 R/W 0 4 R/W 0 3 VALUE[6:0]
R/W 0 2 R/W 0 1 R/W 0 0 R/W 0 Bit 7 SIGNCorrection Sign Value 0 1 Description The correction value is positive, i.e., frequency will be decreased. The correction value is negative, i.e., frequency will be increased. Bits 6:0 VALUE[6:0]Correction Value These bits define the amount of correction applied to the RTC prescaler. Value 0 1 - 127 Description Correction is disabled and the RTC frequency is unchanged. The RTC frequency is adjusted according to the value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 339 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.10 Clock Value in Clock/Calendar mode (CTRLA.MODE=2) Name:
Offset:
Reset:
Property: Write-Synchronized, Read-Synchronized CLOCK 0x18 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 30 R/W 0 22 MONTH[1:0]
Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 R/W 0 14 R/W 0 6 HOUR[3:0]
MINUTE[1:0]
Access Reset R/W 0 R/W 0 Bits 31:26 YEAR[5:0]Year 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 YEAR[5:0]
28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 27 R/W 0 19 DAY[4:0]
R/W 0 11 R/W 0 3 26 R/W 0 18 R/W 0 10 R/W 0 2 SECOND[5:0]
R/W 0 R/W 0 25 24 MONTH[3:2]
R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 R/W 0 16 HOUR[4]
R/W 0 8 R/W 0 0 R/W 0 MINUTE[5:2]
The year offset with respect to the reference year (defined in software). The year is considered a leap year if YEAR[1:0] is zero. Bits 25:22 MONTH[3:0]Month 1 January 2 February
... 12 December Bits 21:17 DAY[4:0]Day Day starts at 1 and ends at 28, 29, 30, or 31, depending on the month and year. Bits 16:12 HOUR[4:0]Hour When CTRLA.CLKREP=0, the Hour bit group is in 24-hour format, with values 0-23. When CTRLA.CLKREP=1, HOUR[3:0] has values 1-12, and HOUR[4] represents AM (0) or PM (1). Bits 11:6 MINUTE[5:0]Minute 0 59 Bits 5:0 SECOND[5:0]Second 0 59 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 340 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.11 Alarm n Value in Clock/Calendar mode (CTRLA.MODE=2) Name:
Offset:
Reset:
Property: Write-Synchronized ALARM 0x20 + n*0x08 [n=0..1]
0x00000000 The 32-bit value of ALARMn is continuously compared with the 32-bit CLOCK value, based on the masking set by MASKn.SEL. When a match occurs, the Alarm n interrupt flag in the Interrupt Flag Status and Clear register
(INTFLAG.ALARMn) is set on the next counter cycle, and the counter is cleared if CTRLA.MATCHCLR is '1'. YEAR[5:0]
Bit 31 Access Reset R/W 0 Bit 23 30 R/W 0 22 MONTH[1:0]
Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 R/W 0 14 R/W 0 6 HOUR[3:0]
MINUTE[1:0]
Access Reset R/W 0 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 27 R/W 0 19 DAY[4:0]
R/W 0 11 R/W 0 3 26 R/W 0 18 R/W 0 10 R/W 0 2 SECOND[5:0]
R/W 0 R/W 0 25 24 MONTH[3:2]
R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 R/W 0 16 HOUR[4]
R/W 0 8 R/W 0 0 R/W 0 MINUTE[5:2]
Bits 31:26 YEAR[5:0]Year The alarm year. Years are only matched if MASKn.SEL is 6 Bits 25:22 MONTH[3:0]Month The alarm month. Months are matched only if MASKn.SEL is greater than 4. Bits 21:17 DAY[4:0]Day The alarm day. Days are matched only if MASKn.SEL is greater than 3. Bits 16:12 HOUR[4:0]Hour The alarm hour. Hours are matched only if MASKn.SEL is greater than 2. Bits 11:6 MINUTE[5:0]Minute The alarm minute. Minutes are matched only if MASKn.SEL is greater than 1. Bits 5:0 SECOND[5:0]Second The alarm second. Seconds are matched only if MASKn.SEL is greater than 0. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 341 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.12 Alarm n Mask in Clock/Calendar mode (CTRLA.MODE=2) MASK Name:
0x24 + n*0x08 [n=0..1]
Offset:
Reset:
0x00 Property: Write-Synchronized Bit 7 6 5 4 3 Access Reset Bits 2:0 SEL[2:0]Alarm Mask Selection 2 R/W 0 1 SEL[2:0]
R/W 0 0 R/W 0 These bits define which bit groups of Alarm n are valid. Description Value Alarm Disabled 0x0 Match seconds only 0x1 Match seconds and minutes only 0x2 Match seconds, minutes, and hours only 0x3 Match seconds, minutes, hours, and days only 0x4 Match seconds, minutes, hours, days, and months only 0x5 Match seconds, minutes, hours, days, months, and years 0x6 Reserved 0x7 Name OFF SS MMSS HHMMSS DDHHMMSS MMDDHHMMSS YYMMDDHHMMSS
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 342 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.13 General Purpose n Name:
Offset:
Reset:
Property:
GPn 0x40 + n*0x04 [n=0..3]
0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 GP[31:24]
GP[23:16]
GP[15:8]
GP[7:0]
27 R/W 0 19 R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 GP[31:0]General Purpose These bits are for user-defined general purpose use, see General Purpose Registers from Related Links. Related Links 21.6.8.4. General Purpose Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 343 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.14 Tamper Control Name:
Offset:
Reset:
Property: Enable-Protected TAMPCTRL 0x60 0x00000000 Bit 31 30 29 28 Access Reset Bit 23 22 21 20 Access Reset Bit 15 14 13 12 Access Reset 27 DEBNC3 26 DEBNC2 25 DEBNC1 24 DEBNC0 0 0 0 0 19 TAMLVL3 18 TAMLVL2 17 TAMLVL1 16 TAMLVL0 0 11 0 10 0 9 0 8 Bit 7 6 5 Access Reset 4 0 IN3ACT[1:0]
3 0 2 0 IN2ACT[1:0]
1 0 0 IN0ACT[1:0]
0 Bits 24, 25, 26, 27 DEBNCnDebounce Enable of Tamper Input INn [n=0..3]
Note:Debounce feature does not apply to the Active Layer Protection mode (TAMPCTRL.INACT = ACTL). Value 0 1 Description Debouncing is disabled for Tamper input INn Debouncing is enabled for Tamper input INn Bits 16, 17, 18, 19 TAMLVLnTamper Level Select of Tamper Input INn [n=0..3]
Note:Tamper Level feature does not apply to the Active Layer Protection mode (TAMPCTRL.INACT = ACTL). Value 0 1 Description A falling edge condition will be detected on Tamper input INn. A rising edge condition will be detected on Tamper input INn. Bits 0:1, 1:2, 2:3, 3:4 INnACTTamper Channel n Action [n=0..3]
These bits determine the action taken by Tamper Channel n. Value 0x0 0x1 0x2 0x3 Description Name Off (Disabled) OFF WAKE Wake and set Tamper flag CAPTURE Capture timestamp and set Tamper flag ACTL Compare RTC signal routed between INn and OUT pins . When a mismatch occurs, capture timestamp and set Tamper flag 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 344 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.15 Tamper ID Name:
Offset:
Reset:
TAMPID 0x68 0x00000000 Bit Access Reset 31 TAMPEVT R/W 0 30 29 28 27 26 25 24 Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 Access Reset 3 TAMPID3 R/W 0 2 TAMPID2 R/W 0 1 TAMPID1 R/W 0 0 TAMPID0 R/W 0 Bit 31 TAMPEVTTamper Event Detected Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the tamper detection bit. Value 0 1 Description A tamper input event has not been detected A tamper input event has been detected Bits 0, 1, 2, 3 TAMPIDnTamper on Channel n Detected [n=0..3]
Writing a '0' to this bit has no effect. Writing a '1' to this bit clears the tamper detection bit. Value 0 1 Description A tamper condition has not been detected on Channel n A tamper condition has been detected on Channel n 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 345 PIC32CX-BZ2 and WBZ45 Family Real-Time Counter and Calendar (RTCC) 21.12.16 Backup0 Name:
Offset:
Reset:
BKUP0 0x80 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 BKUP[31:24]
R/W 0 20 R/W 0 19 BKUP[23:16]
R/W 0 12 R/W 0 4 R/W 0 R/W 0 11 R/W 0 3 R/W 0 BKUP[15:8]
BKUP[7:0]
26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 BKUP[31:0]Backup These bits are user-defined for general purpose use in the Backup domain. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 346 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22. Direct Memory Access Controller (DMAC) 22.1 Overview The Direct Memory Access Controller (DMAC) contains both a Direct Memory Access engine and a Cyclic Redundancy Check (CRC) engine. The DMAC can transfer data between memories and peripherals, and thus off-load these tasks from the CPU. It enables high data transfer rates with minimum CPU intervention, and frees up CPU time. With access to all peripherals, the DMAC can handle automatic transfer of data between communication modules. The DMA part of the DMAC has several DMA channels which all can receive different types of transfer triggers to generate transfer requests from the DMA channels to the arbiter (see DMAC Block Diagram in the Block Diagram from Related Links). The arbiter will grant one DMA channel at a time to act as the active channel. When an active channel has been granted, the fetch engine of the DMAC will fetch a transfer descriptor from the SRAM and store it in the internal memory of the active channel, which will execute the data transmission. An ongoing data transfer of an active channel can be interrupted by a higher prioritized DMA channel. The DMAC will write back the updated transfer descriptor from the internal memory of the active channel to SRAM, and grant the higher prioritized channel to start transfer as the new active channel. Once a DMA channel is done with its transfer, interrupts and events can be generated optionally. The DMAC has four bus interfaces:
The data transfer bus is used for performing the actual DMA transfer. The AHB/APB Bridge bus is used when writing and reading the I/O registers of the DMAC. The descriptor fetch bus is used by the fetch engine to fetch transfer descriptors before data transfer can be started or continued. The write-back bus is used to write the transfer descriptor back to SRAM. All buses are AHB Manager interfaces except for the AHB/APB Bridge bus, which is an APB Subordinate interface. Burst transfer options, buffered active channel to pre-fetch descriptors and advance quality of service features ensure low-latency transfers for high-speed peripherals or high-speed operations. The CRC engine can be used by software to detect an accidental error in the transferred data and to take corrective action, such as requesting the data to be sent again or simply not using the incorrect data. Note:Traditional Direct Memory Access Controller (DMAC) documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Host and Client respectively. Related Links 22.3. Block Diagram 22.2 Features Data transfer from:
Peripheral to peripheral Peripheral to memory Memory to peripheral Memory to memory Transfer trigger sources Software Events from Event System Dedicated requests from peripherals SRAM based transfer descriptors Single transfer using one descriptor Multi-buffer or circular buffer modes by linking multiple descriptors 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 347 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Up to 16 channels Enable 16 independent transfers Automatic descriptor fetch for each channel Suspend/resume operation support for each channel Flexible arbitration scheme 4 configurable priority levels for each channel Fixed or round-robin priority scheme within each priority level From 1 to 256KB data transfer in a single block transfer Multiple addressing modes Static Configurable increment scheme Optional interrupt generation On block transfer complete On error detection On channel suspend 8 event inputs One event input for each of the 8 least significant DMA channels Can be selected to trigger normal transfers, periodic transfers or conditional transfers Can be selected to suspend or resume channel operation 4 event outputs One output event for each of the 4 least significant DMA channels Selectable generation on AHB, block, or transaction transfer complete Error management supported by write-back function Dedicated Write-Back memory section for each channel to store ongoing descriptor transfer CRC polynomial software selectable to CRC-16 (CRC-CCITT) CRC-32 (IEEE 802.3) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 348 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.3 Block Diagram Figure 22-1. DMAC Block Diagram CPU M Write-Back Buffer S HIGH SPEED BUS MATRIX S AHB/APB Bridge M M S a t a D r e f s n a r T a t a D r e f s n a r T Host Interface Fifo Arbiter Active Channel AHB/APB Bridge Fetch Engine Pre-Fetch Channel CRC Engine Interrupts Optional Event System Peripheral k c A
t s e u q e R k c A
t u p n I t n e v E t u p t u O t n e v E SRAM Transfer Control Descriptor r o t p i r c s e D h c t e F k c a b
e t i r W DMAC Internal Architecture DMA Channels Channel n Channel 0 n 22.4 Signal Description Not applicable. 22.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 22.5.1 I/O Lines Not applicable. 22.5.2 Power Management The DMAC will continue to operate in any Sleep mode where the selected source clock is running. The DMACs interrupts can be used to wake up the device from Sleep modes. Events connected to the event system can trigger other operations in the system without exiting Sleep modes. On hardware or software Reset, all registers are set to their Reset value. 22.5.3 DMA Not applicable. 22.5.4 Interrupts The interrupt request line is connected to the interrupt controller. Using the DMAC interrupt requires the interrupt controller to be configured first. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 349 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.5.5 Events The events are connected to the event system. 22.5.6 Debug Operation When the CPU is halted in Debug mode the DMAC will halt normal operation. The DMAC can be forced to continue operation during debugging. See DBGCTRL from Related Links. Related Links 22.8.6. DBGCTRL 22.5.7 Register Access Protection All registers with write access can be write-protected optionally by the Peripheral Access Controller (PAC), except for the following registers:
Interrupt Pending register (INTPEND) Channel ID register (CHID) Channel Interrupt Flag Status and Clear register (CHINTFLAG) Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. PAC write protection does not apply to accesses through an external debugger. 22.5.8 Analog Connections Not applicable. 22.6 Functional Description 22.6.1 Principle of Operation The DMAC consists of a DMA module and a CRC module. 22.6.1.1 DMA The DMAC can transfer data between memories and peripherals without interaction from the CPU. The data transferred by the DMAC are called transactions, and these transactions can be split into smaller data transfers. The following figure shows the relationship between the different transfer sizes:
Figure 22-2. DMA Transfer Sizes Link Enabled Link Enabled Link Enabled Beat transfer Burst transfer Block transfer DMA transaction Beat transfer: The size of one data transfer bus access, and the size is selected by writing the Beat Size bit group in the Block Transfer Control register (BTCTRL.BEATSIZE) Block transfer: The amount of data one transfer descriptor can transfer, and the amount can range from 1 to 64k beats. A block transfer can be interrupted. Transaction: The DMAC can link several transfer descriptors by having the first descriptor pointing to the second and so forth, as shown in the figure above. A DMA transaction is the complete transfer of all blocks within a linked list. A transfer descriptor describes how a block transfer must be carried out by the DMAC, and it must remain in SRAM
(see Transfer Descriptors from Related Links). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 350 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) The figure above shows several block transfers linked together, which are called linked descriptors (see Linked Descriptors from Related Links). A DMA transfer is initiated by an incoming transfer trigger on one of the DMA channels. This trigger can be configured to be either a software trigger, an event trigger, or one of the dedicated peripheral triggers. The transfer trigger will result in a DMA transfer request from the specific channel to the arbiter. If there are several DMA channels with pending transfer requests, the arbiter chooses which channel is granted access to become the active channel. The DMA channel granted access as the active channel will carry out the transaction as configured in the transfer descriptor. A current transaction can be interrupted by a higher prioritized channel, but will resume the block transfer when the according DMA channel is granted access as the active channel again. For each beat transfer, an optional output event can be generated. For each block transfer, optional interrupts and an optional output event can be generated. When a transaction is completed, depending on the configuration, the DMA channel will either be suspended or disabled. Related Links 22.6.2.3. Transfer Descriptors 22.6.3.1. Linked Descriptors 22.6.1.2 CRC The internal CRC engine supports two commonly used CRC polynomials: CRC-16 (CRC-CCITT) and CRC-32 (IEEE 802.3). It can be used on a selectable DMA channel, or on the I/O interface. See CRC Operation from Related Links. Related Links 22.6.3.8. CRC Operation 22.6.2 Basic Operation 22.6.2.1 Initialization DMAC Initialization Before DMAC is enabled, it must be configured as defined below:
The SRAM address of where the descriptor memory section is located must be written to the Description Base Address (BASEADDR) register. The SRAM address of where the write-back section must be located must be written to the Write-Back Memory Base Address (WRBADDR) register. Priority level x of the arbiter can be enabled by setting the Priority Level x Enable bit in the Control register
(CTRL.LVLENx=1) DMA Channel Initialization Before a DMA channel is enabled, the DMA channel and the corresponding first transfer descriptor must be configured, as defined below:
DMA Channel Configuration:
The channel number of the DMA channel to configure must be written to the Channel Control A
(CHCTRLA) register. Trigger action must be selected by writing the Trigger Action bit field in the Channel Control A
(CHCTRLA.TRIGACT) register. Trigger source must be selected by writing the Trigger Source bit field in the Channel Control A
(CHCTRLA.TRIGSRC) register. Transfer Descriptor The size of each access of the data transfer bus must be selected by writing the Beat Size bit group in the Block Transfer Control (BTCTRL.BEATSIZE) register. The transfer descriptor must be made valid by writing a one to the Valid bit in the Block Transfer Control
(BTCTRL.VALID) register. Number of beats in the block transfer must be selected by writing the Block Transfer Count (BTCNT) register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 351 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Source address for the block transfer must be selected by writing the Block Transfer Source Address
(SRCADDR) register. Destination address for the block transfer must be selected by writing the Block Transfer Destination Address (DSTADDR) register. CRC Calculation If CRC calculation is needed, the CRC engine must be configured before it is enabled, as described below:
The CRC input source must selected by writing the CRC Input Source bit group in the CRC Control
(CRCCTRL.CRCSRC) register. The type of CRC calculation must be selected by writing the CRC Polynomial Type bit group in the CRC Control
(CRCCTRL.CRCPOLY) register. If I/O is selected as input source, the beat size must be selected by writing the CRC Beat Size bit group in the CRC Control (CRCCTRL.CRCBEATSIZE) register. Register Properties The following DMAC registers are enable-protected, that is, they can only be written when the DMAC is disabled
(CTRL.DMAENABLE=0):
The Descriptor Base Memory Address (BASEADDR) register The Write-Back Memory Base Address (WRBADDR) register The following DMAC bit is enable-protected, that is, it can only be written when the DMAC and CRC are disabled
(CTRL.DMAENABLE=0 and CRCCTRL.CRCSRC=0):
The Software Reset bit in the Control (CTRL.SWRST) register The following DMA channel bit is enable-protected, meaning that it can only be written when the corresponding DMA channel is disabled:
The Channel Software Reset bit in the Channel Control A (CHCTRLA.SWRST) register The following CRC registers are enable-protected, that is, they can only be written when the CRC is disabled
(CRCCTRL.CRCSRC=0):
The CRC Control (CRCCTRL) register CRC Checksum (CRCCHKSUM) register Enable-protection is denoted by the Enable-Protected property in the register description. 22.6.2.2 Enabling, Disabling, and Resetting The DMAC is enabled by writing the DMA Enable bit in the Control register (CTRL.DMAENABLE) to '1'. The DMAC is disabled by writing a '0' to the CTRL.DMAENABLE bit. A DMA channel is enabled by writing the Enable bit in the Channel Control A register (CHCTRLA.ENABLE) to
'1', after the corresponding channel ID to the channel is configured. A DMA channel is disabled by writing a '0' to CHCTRLAn.ENABLE. The CRC is enabled by writing a 1 to the CRC Enable bit in the Control register (CTRL.CRCENABLE). The CRC is disabled by writing a '0' to CTRL.CRCENABLE. The DMAC is reset by writing a '1' to the Software Reset bit in the Control register (CTRL.SWRST) while the DMAC and CRC are disabled. All registers in the DMAC except DBGCTRL will be reset to their initial state. A DMA channel is reset by writing a '1' to the Software Reset bit in the Channel Control A register
(CHCTRLAn.SWRST), after writing the corresponding channel ID to the Channel ID bit group in the Channel ID register (CHID.ID). The channel registers will be reset to their initial state. The corresponding DMA channel must be disabled in order for the Reset to take effect. 22.6.2.3 Transfer Descriptors The transfer descriptors, together with the channel configurations, decide how a block transfer must be executed. Before a DMA channel is enabled (CHCTRLA.ENABLE is written to one) and receives a transfer trigger, its first transfer descriptor must be initialized and valid (BTCTRL.VALID). The first transfer descriptor describes the first block transfer of a transaction. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 352 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) All transfer descriptors must reside in SRAM. The addresses stored in the Descriptor Memory Section Base Address
(BASEADDR) and Write-Back Memory Section Base Address (WRBADDR) registers tell the DMAC where to find the descriptor memory section and the write-back memory section. The descriptor memory section is where the DMAC expects to find the first transfer descriptors for all DMA channels. As BASEADDR points only to the first transfer descriptor of channel 0 (see the following figure). All first transfer descriptors must be stored in a contiguous memory section, where the transfer descriptors must be ordered according to their channel number (see Linked Descriptors from Related Links). The write-back memory section is where the DMAC stores the transfer descriptors for the ongoing block transfers. WRBADDR points to the ongoing transfer descriptor of channel 0. All ongoing transfer descriptors are stored in a contiguous memory section where the transfer descriptors are ordered according to their channel number. The figure below shows an example of linked descriptors on DMA channel 0 (see Linked Descriptors from Related Links). Figure 22-3. Memory Sections DESCADDR Channel 0 Last Descriptor DESCADDR Channel 0 Descriptor n-1 Descriptor Section Channel n First Descriptor Channel 2 First Descriptor Channel 1 First Descriptor Channel 0 First Descriptor BASEADDR Write-Back Section Channel n Ongoing Descriptor Channel 2 Ongoing Descriptor Channel 1 Ongoing Descriptor Channel 0 Ongoing Descriptor Device Memory Space WRBADDR 0x00000000 DSTADDR SRCADDR BTCNT BTCTRL DESCADDR DSTADDR SRCADDR BTCNT BTCTRL DESCADDR DSTADDR SRCADDR BTCNT BTCTRL Undefined Undefined Undefined Undefined Undefined The size of the descriptor and write-back memory sections are dependent on the number of the most significant enabled DMA channel m, as shown below:
For memory optimization, it is recommended to use the less significant DMA channels, if not all channels are Size = 128bits m + 1 required. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 353 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) The descriptor and write-back memory sections can either be two separate memory sections, or they can share a memory section (BASEADDR=WRBADDR). The benefit of having them in two separate sections, is that the same transaction for a channel can be repeated without having to modify the first transfer descriptor. Related Links 22.6.3.1. Linked Descriptors 22.6.2.4 Arbitration If a DMA channel is enabled and not suspended when it receives a transfer trigger, it will send a transfer request to the arbiter. When the arbiter receives the transfer request it will include the DMA channel in the queue of channels having pending transfers, and the corresponding Pending Channel x bit in the Pending Channels registers
(PENDCH.PENDCHx) will be set. Depending on the arbitration scheme, the arbiter will choose which DMA channel will be the next active channel. The next transfer descriptor will be fetched from SRAM memory and stored internally in the Pre-Fetch Channel. The active channel is the DMA channel being granted access to perform its next burst transfer. When the Active Channel has completed a burst transfer, the descriptor stored in the Pre-Fetch Channel is transferred to the Active Channel and a new burst will take place. When the descriptor stored in the Pre-Fetch Channel is transferred to the Active Channel, the corresponding PENDCH.PENDCHx will be cleared. In the same way, depending on trigger action settings and if the upcoming burst transfer is the first for the transfer request or not, the corresponding Busy Channel x bit in the Busy Channels register (BUSYCH.BUSYCHx), will either be set or remain 1. When the channel has performed its granted burst transfer(s) it will be either fed into the queue of channels with pending transfers, set to be waiting for a new transfer trigger, suspended, or disabled. This depends on the channel and block transfer configuration. If the DMA channel is set to wait for a new transfer trigger, suspended or disabled, the corresponding BUSYCH.BUSYCHx will be cleared. If a DMA channel is suspended while it has a pending transfer, it will be removed from the queue of pending channels, but the corresponding PENDCH.PENDCHx will remain set. The status will also be indicated in CHINTFLAGn.SUSP. When the same DMA channel is resumed, it will be added to the queue of pending channels again. If a DMA channel gets disabled (CHCTRLA.ENABLE=0) while it has a pending transfer, it will be removed from the queue of pending channels, and the corresponding PENDCH.PENDCHx will be cleared. Figure 22-4. Arbiter Overview Channel 0 Channel N Channel Pending Channel Suspend Channel Priority Level Channel Burst Done Channel Pending Channel Suspend Channel Priority Level Channel Burst Done Arbiter Priority decoder Channel Number Empty Pre-Fetch Channel Level Enable CTRL.LVLENx ACTIVE.LVLEXx PRICTRLx.LVLPRI Active Channel e n o D t s r u B Host Interface Burst Transfer Priority Levels When a channel level is pending or the channel is transferring data, the corresponding Level Executing bit is set in the Active Channel and Levels register (ACTIVE.LVLEXx). Each DMA channel supports up to 4-level priority scheme. The priority level for a channel is configured by writing to the Channel Arbitration Level bit group in the Channel Priority Level register (CHPRILVL.PRILVL). As long as all priority levels are enabled, a channel with a higher priority level number will have priority over a channel with a lower priority level number. A priority level is enabled by writing the Priority Level x Enable bit in the Control register (CTRL.LVLENx) to 1, for the corresponding level. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 354 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Within each priority level, the DMAC's arbiter can be configured to prioritize statically or dynamically. For the arbiter to perform static arbitration within a priority level, the Level X Round-Robin Scheduling Enable bit in the Priority Control x register (PRICTRL0.RRLVLENx) has to be written to 0. When static arbitration is enabled (PRICTRL0.RRLVLENx is 0), the arbiter will prioritize a low channel number over a high channel number as shown in the following figure. When using the static scheme, there is a risk of high channel numbers never being granted access as the active channel. This can be avoided using a dynamic arbitration scheme. Figure 22-5. Static Priority Scheduling Lowest Channel Channel 0 Highest Priority
. Channel x Channel x+1
. Highest Channel Channel N Lowest Priority The dynamic arbitration scheme in the DMAC is round-robin. Round-robin arbitration is enabled by writing PRICTRL0.RRLVLEN to 1, for a given priority level x. With the round-robin scheme, the channel number of the last channel being granted access will have the lowest priority the next time the arbiter has to grant access to a channel within the same priority level, as shown in the following figure. The channel number of the last channel being granted access as the active channel is stored in the Level x Channel Priority Number bit group in the Priority Control 0 register (PRICTRL0.LVLPRIx) for the corresponding priority level. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 355 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Figure 22-6. Dynamic (Round-Robin) Priority Scheduling Channel x last acknowledge request Channel (x+1) last acknowledge request Channel 0 Channel 0 Channel x Channel x+1 Lowest Priority Highest Priority Channel N 22.6.2.5 Data Transmission
. Channel x Channel x+1 Channel x+2
. Channel N Lowest Priority Highest Priority Before the DMAC can perform a data transmission, a DMA channel has to be configured and enabled, its corresponding transfer descriptor has to be initialized, and the arbiter has to grant the DMA channel access as the active channel. Once the arbiter has granted a DMA channel access as the active channel (see DMAC Block Diagram in the Block Diagram from Related Links) the transfer descriptor for the DMA channel will be fetched from SRAM using the fetch bus, and stored in the internal memory for the active channel. For a new block transfer, the transfer descriptor will be fetched from the descriptor memory section (BASEADDR); For an ongoing block transfer, the descriptor will be fetched from the write-back memory section (WRBADDR). By using the data transfer bus, the DMAC will read the data from the current source address and write it to the current destination address. For further details on how the current source and destination addresses are calculated (see Addressing from the Related Links). The arbitration procedure is performed after each transfer. If the current DMA channel is granted access again, the block transfer counter (BTCNT) of the internal transfer descriptor will be decremented by the number of beats in a transfer, the optional output event Beat will be generated if configured and enabled, and the active channel will perform a new transfer. If a different DMA channel than the current active channel is granted access, the block transfer counter value will be written to the write-back section before the transfer descriptor of the newly granted DMA channel is fetched into the internal memory of the active channel. When a block transfer has come to its end (BTCNT is zero), the Valid bit in the Block Transfer Control register will be cleared (BTCTRL.VALID=0) before the entire transfer descriptor is written to the write-back memory. The optional interrupts, Channel Transfer Complete and Channel Suspend, and the optional output event Block, will be generated if configured and enabled. After the last block transfer in a transaction, the Next Descriptor Address register
(DESCADDR) will hold the value 0x00000000, and the DMA channel will either be suspended or disabled, depending on the configuration in the Block Action bit group in the Block Transfer Control register (BTCTRL.BLOCKACT). If the transaction has further block transfers pending, DESCADDR will hold the SRAM address to the next transfer descriptor to be fetched. The DMAC will fetch the next descriptor into the internal memory of the active channel and write its content to the write-back section for the channel, before the arbiter gets to choose the next active channel. Related Links 22.6.2.7. Addressing 22.3. Block Diagram 22.6.2.6 Transfer Triggers and Actions A DMA transfer through a DMA channel can be started only when a DMA transfer request is detected, and the DMA channel has been granted access to the DMA. A transfer request can be triggered from software, from a peripheral, or from an event. There are dedicated Trigger Source selections for each DMA Channel n Control A
(CHCTRLAn.TRIGSRC). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 356 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) The trigger actions are available in the Trigger Action bit group in the Channel n Control A register
(CHCTRLAn.TRIGACT). By default, a trigger generates a request for a block transfer operation. If a single descriptor is defined for a channel, the channel is automatically disabled when a block transfer has been completed. If a list of linked descriptors is defined for a channel, the channel is automatically disabled when the last descriptor in the list is executed. As long as the list still has descriptors to execute, the channel will be waiting for the next block transfer trigger. When enabled again, the channel will wait for the next block transfer trigger. The trigger actions can also be configured to generate a request for a burst transfer (CHCTRLAn.TRIGACT=0x2) or transaction transfer
(CHCTRLAn.TRIGACT=0x3) instead of a block transfer (CHCTRLAn.TRIGACT=0x0). The following figure shows an example where triggers are used with two linked block descriptors. Figure 22-7. Trigger Action and Transfers Beat Trigger Action Trigger Lost CHENn Trigger PENDCHn BUSYCHn Data Transfer BEAT BEAT BEAT BEAT BEAT BEAT Block Transfer Block Transfer Block Trigger Action CHENn Trigger PENDCHn BUSYCHn Trigger Lost Data Transfer BEAT BEAT BEAT BEAT BEAT BEAT Block Transfer Block Transfer Transaction Trigger Action Trigger Lost CHENn Trigger PENDCHn BUSYCHn Data Transfer BEAT BEAT BEAT BEAT BEAT BEAT Block Transfer Block Transfer If the trigger source generates a transfer request for a channel during an ongoing transfer, the new transfer request will be kept pending (CHSTATUSn.PEND=1), and the new transfer can start after the ongoing one is done. Only one pending transfer can be kept per channel. If the trigger source generates more transfer requests while one is already pending, the additional ones will be lost. All channels pending status flags are also available in the Pending Channels register (PENDCH). When the transfer starts, the corresponding Channel Busy status flag is set in Channel n Status register
(CHSTATUSn.BUSY). When the trigger action is complete, the Channel Busy status flag is cleared. All channel busy status flags are also available in the Busy Channels register (BUSYCH) in DMAC. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 357 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.6.2.7 Addressing Each block transfer needs to have both a source address and a destination address defined. The source address is set by writing the Transfer Source Address (SRCADDR) register, the destination address is set by writing the Transfer Destination Address (SRCADDR) register. The addressing of this DMAC module can be static or incremental, for either source or destination of a block transfer, or both. Incrementation for the source address of a block transfer is enabled by writing the Source Address Incrementation Enable bit in the Block Transfer Control register (BTCTRL.SRCINC=1). The step size of the incrementation is configurable and can be chosen by writing the Step Selection bit in the Block Transfer Control register
(BTCTRL.STEPSEL=1) and writing the desired step size in the Address Increment Step Size bit group in the Block Transfer Control register (BTCTRL.STEPSIZE). If BTCTRL.STEPSEL=0, the step size for the source incrementation will be the size of one beat. When source address incrementation is configured (BTCTRL.SRCINC=1), SRCADDR is calculated as follows:
If BTCTRL.STEPSEL=1:
If BTCTRL.STEPSEL=0:
SRCADDR = SRCADDRSTART + BTCNT BEATSIZE + 1 2 STEPSIZE SRCADDR = SRCADDRSTART + BTCNT BEATSIZE + 1 SRCADDRSTART is the source address of the first beat transfer in the block transfer BTCNT is the initial number of beats remaining in the block transfer BEATSIZE is the configured number of bytes in a beat STEPSIZE is the configured number of beats for each incrementation The following figure shows an example where DMA channel 0 is configured to increment the source address by one beat after each beat transfer (BTCTRL.SRCINC=1), and DMA channel 1 is configured to increment the source address by two beats (BTCTRL.SRCINC=1, BTCTRL.STEPSEL=1, and BTCTRL.STEPSIZE=0x1). As the destination address for both channels are peripherals, destination incrementation is disabled (BTCTRL.DSTINC=0). Figure 22-8. Source Address Increment SRC Data Buffer a b c d e f Incrementation for the destination address of a block transfer is enabled by setting the Destination Address Incrementation Enable bit in the Block Transfer Control register (BTCTRL.DSTINC=1). The step size of the incrementation is configurable by clearing BTCTRL.STEPSEL=0 and writing BTCTRL.STEPSIZE to the desired step size. If BTCTRL.STEPSEL=1, the step size for the destination incrementation will be the size of one beat. When the destination address incrementation is configured (BTCTRL.DSTINC=1), DSTADDR must be set and calculated as follows:
where BTCTRL.STEPSEL is zero DSTADDR = DSTADDRSTART + BTCNT BEATSIZE + 1 2 STEPSIZE 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 358 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) where BTCTRL.STEPSEL is one DSTADDR = DSTADDRSTART + BTCNT BEATSIZE + 1 DSTADDRSTART is the destination address of the first beat transfer in the block transfer BTCNT is the initial number of beats remaining in the block transfer BEATSIZE is the configured number of bytes in a beat STEPSIZE is the configured number of beats for each incrementation The following figure shows an example where DMA channel 0 is configured to increment destination address by one beat (BTCTRL.DSTINC=1) and DMA channel 1 is configured to increment destination address by two beats (BTCTRL.DSTINC=1, BTCTRL.STEPSEL=0, and BTCTRL.STEPSIZE=0x1). As the source address for both channels are peripherals, source incrementation is disabled (BTCTRL.SRCINC=0). Figure 22-9. Destination Address Increment DST Data Buffer a b c d 22.6.2.8 Internal FIFO To improve the bandwidth, the DMAC can support FIFO operation. When single-beat burst configuration is selected
(CHCTRALx.BURSTLEN = SINGLE), the channel waits until the FIFO can transmit or accept a single beat transfer before it requests a bus access to write to the destination address. In all other cases, the channel waits until the FIFO threshold is reached before it requests a bus access to write to the destination address. The threshold is configurable and can be set by writing the THRESHOLD bits in the Channel x Control A register. If the DMAC completes the read operations before the threshold is reached, the write to the destination is automatically enabled. If the FIFO is empty and the read from source is ongoing, the DMA will wait again until the FIFO threshold is reached before it requests a bus access to write the destination. 22.6.2.9 Error Handling If a bus error is received from an AHB subordinate during a DMA data transfer, the corresponding active channel is disabled and the corresponding Channel Transfer Error Interrupt flag in the Channel Interrupt Status and Clear register (CHINTFLAG.TERR) is set. If enabled, the optional transfer error interrupt is generated. The transfer counter will not be decremented and its current value is written-back in the write-back memory section before the channel is disabled. When the DMAC fetches an invalid descriptor (BTCTRL.VALID=0) or when the channel is resumed and the DMA fetches the next descriptor with null address (DESCADDR=0x00000000), the corresponding channel operation is suspended, the Channel Suspend Interrupt Flag in the Channel Interrupt Flag Status and Clear register
(CHINTFLAG.SUSP) is set, and the Channel Fetch Error bit in the Channel Status register (CHSTATUS.FERR) is set. If enabled, the optional suspend interrupt is generated. 22.6.3 Additional Features 22.6.3.1 Linked Descriptors A transaction can consist of either a single block transfer or of several block transfers. When a transaction consists of several block transfers it is done with the help of linked descriptors. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 359 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Memory Sections illustrates how linked descriptors work (see Memory Sections figure in the Transfer Descriptors from Related Links). When the first block transfer is completed on DMA channel 0, the DMAC fetches the next transfer descriptor, which is pointed to by the value stored in the Next Descriptor Address (DESCADDR) register of the first transfer descriptor. Fetching the next transfer descriptor (DESCADDR) is continued until the last transfer descriptor. When the block transfer for the last transfer descriptor is executed and DESCADDR = 0x00000000, the transaction is terminated. For further details on how the next descriptor is fetched from SRAM (see Data Transmission from Related Links). Related Links 22.6.2.3. Transfer Descriptors 22.6.2.5. Data Transmission 22.6.3.1.1 Adding Descriptor to the End of a List To add a new descriptor at the end of the descriptor list, create the descriptor in SRAM, with DESCADDR =
0x00000000 indicating that it is the new last descriptor in the list, and modify the DESCADDR value of the current last descriptor to the address of the newly created descriptor. 22.6.3.1.2 Modifying a Descriptor in a List In order to add descriptors to a linked list, the following actions must be performed:
Enable the Suspend interrupt for the DMA channel. Enable the DMA channel. 1. 2. 3. Reserve memory space in SRAM to configure a new descriptor. 4. Configure the new descriptor:
Set the next descriptor address (DESCADDR) Set the destination address (DESCADDR) Set the source address (SRCADDR) Configure the block transfer control (BTCTRL) including Optionally enable the suspend block action Set the descriptor VALID bit 5. Clear the VALID bit for the existing list and for the descriptor which has to be updated. 6. Read DESCADDR from the write-back memory. If the DMA has not already fetched the descriptor that requires changes (in other words, DESCADDR is wrong):
Update the DESCADDR location of the descriptor from the list Optionally clear the suspend block action Set the descriptor VALID bit to 1 Optionally enable the Resume Software command If the DMA is executing the same descriptor as the one that requires changes:
Set the Channel Suspend Software command and wait for the suspend interrupt Update the next descriptor address (DESCADDR) in the write-back memory Clear the interrupt sources and set the Resume Software command Update the DESCADDR location of the descriptor from the list Optionally clear the suspend block action Set the descriptor VALID bit to 1 7. Go to step 4 if needed. 22.6.3.1.3 Adding a Descriptor Between Existing Descriptors To insert a new descriptor 'C' between two existing descriptors ('A' and 'B'), the descriptor currently executed by the DMA must be identified. 1. 2. If DMA is executing descriptor B, descriptor C cannot be inserted. If DMA has not started to execute descriptor A, follow the steps:
a. Set the descriptor A VALID bit to 0. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 360 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) b. c. d. Set the DESCADDR value of descriptor A to point to descriptor C instead of descriptor B (see DESCADDR in the DMAC Register Summary from Related Links). Set the DESCADDR value of descriptor C to point to descriptor B (see DESCADDR in the DMAC Register Summary from Related Links). Set the descriptor A VALID bit to 1. 3. If DMA is executing descriptor A:
a. b. c. Apply the software suspend command to the channel and Perform steps 2.1 through 2.4. Apply the software resume command to the channel. Related Links 22.9. DMAC Register Summary (SRAM) 22.6.3.2 Transfer Quality of Service Each priority level group has dedicated quality of service settings. The setting can be written in the corresponding Quality of Service bit group in the Priority Control x register (PRICTRL0.QOSn). Figure 22-10. Quality of Service Transfer Trigger Channel 0 Transfer Trigger Channel 1 Fetch Operation CH0 CH1 CH0 CH1 Data Transfer Active CH0 Active CH1 Active CH0 Active CH1 Quality of Service Value
( QOS CH0 < QOS CH1) QOS CH0 QOS CH1 QOS CH0 QOS CH1 When a channel is stored in the Pre-Fetch or Active Channel, the corresponding PRICTRLx.QOS bits value is stored in the respective channel. As shown in Quality of Service, the DMAC will select the highest QOS value between Active and Pre-Fetch channels. This value will apply to all DMAC buses. 22.6.3.3 Channel Suspend The channel operation can be suspended at any time by software by writing a 1 to the Suspend command in the Command bit field of Channel Control B register (CHCTRLB.CMD). After the ongoing burst transfer is completed, the channel operation is suspended and the suspend command is automatically cleared. When suspended, the Channel Suspend Interrupt flag in the Channel Interrupt Status and Clear register is set
(CHINTFLAG.SUSP=1) and the optional suspend interrupt is generated. By configuring the block action to suspend by writing Block Action bit group in the Block Transfer Control register
(BTCTRL.BLOCKACT is 0x2 or 0x3), the DMA channel will be suspended after it has completed a block transfer. The DMA channel will be kept enabled and will be able to receive transfer triggers, but it will be removed from the arbitration scheme. If an invalid transfer descriptor (BTCTRL.VALID=0) is fetched from SRAM, the DMA channel will be suspended, and the Channel Fetch Error bit in the Channel Status register (CHASTATUS.FERR) will be set. Note:Only enabled DMA channels can be suspended. If a channel is disabled when it is attempted to be suspended, the internal suspend command will be ignored. For more details on transfer descriptors (see Transfer Descriptors from Related Links). Related Links 22.6.2.3. Transfer Descriptors 22.6.3.4 Channel Resume and Next Suspend Skip A channel operation can be resumed by software by setting the Resume command in the Command bit field of the Channel Control B register (CHCTRLB.CMD). If the channel is already suspended, the channel operation 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 361 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) resumes from where it previously stopped when the Resume command is detected. When the Resume command is issued before the channel is suspended, the next suspend action is skipped and the channel continues the normal operation. Figure 22-11. Channel Suspend/Resume Operation CHENn Memory Descriptor Descriptor 0
(suspend disabled) Descriptor 1
(suspend enabled) Descriptor 2
(suspend enabled) Descriptor 3
(last) Channel suspended Block Transfer 0 Block Transfer 1 Block Transfer 2 Block Transfer 3 Suspend skipped Transfer Fetch Resume Command 22.6.3.5 Event Input Actions The event input actions are available only on the least significant DMA channels. For more details on channels with event input support (see Event System (EVSYS) from Related Links). Before using event input actions, the event controller must be configured first according to the following table, and the Channel Event Input Enable bit in the Channel Event Control register (CHEVCTRL.EVIE) must be written to 1. See Events from Related Links. Table 22-1. Event Input Action Action None Normal Transfer Conditional Transfer on Strobe Conditional Transfer Conditional Block Transfer Channel Suspend Channel Resume Skip Next Block Suspend Increase priority CHEVCTRL.EVACT CHCTRLA.TRIGSRC DISABLE Any peripheral NOACT TRIG TRIG CTRIG CBLOCK SUSPEND RESUME SSKIP INCPRI Normal Transfer The event input is used to trigger a beat or burst transfer on peripherals. The event is acknowledged as soon as the event is received. When received, both the Channel Pending status bit in the Channel Status register (CHSTATUS.PEND) and the corresponding Channel n bit in the Pending Channels register (PENDCH.PENDCHn) are set. If the event is received while the channel is pending, the event trigger is lost. The following figure shows an example where beat transfers are enabled by internal events. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 362 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Figure 22-12. Burst Event Trigger Action Peripheral Trigger Trigger Lost Event PENDCHn BUSYCHn Data Transfer Block Transfer Block Transfer BURST BURST BURST BURST BURST BURST Conditional Transfer on Strobe The event input is used to trigger a transfer on peripherals with pending transfer requests. This event action is intended to be used with peripheral triggers, for example, for timed communication protocols or periodic transfers between peripherals: only when the peripheral trigger coincides with the occurrence of a (possibly cyclic) event the transfer is issued. The event is acknowledged as soon as the event is received. The peripheral trigger request is stored internally when the previous trigger action is completed (in other words, the channel is not pending) and when an active event is received. If the peripheral trigger is active, the DMA waits for an event before the peripheral trigger is internally registered. When both event and peripheral transfer trigger are active, both CHSTATUS.PEND and PENDCH.PENDCHn are set. A software trigger will now trigger a transfer. The following figure shows an example where the peripheral beat transfer is started by a conditional strobe event action. Figure 22-13. Periodic Event with Burst Peripheral Triggers Trigger Lost Trigger Lost Event Peripheral Trigger PENDCHn Data Transfer Block Transfer BURST Conditional Transfer The event input is used to trigger a conditional transfer on peripherals with pending transfer requests. As example, this type of event can be used for peripheral-to-peripheral transfers, where one peripheral is the source of event and the second peripheral is the source of the trigger. Each peripheral trigger is stored internally when the event is received. When the peripheral trigger is stored internally, the Channel Pending status bit is set (CHSTATUS.PEND), the respective Pending Channel n Bit in the Pending Channels register is set (PENDCH.PENDCHn), and the event is acknowledged. A software trigger will now trigger a transfer. The following figure shows an example where conditional event is enabled with peripheral beat trigger requests. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 363 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Figure 22-14. Conditional Event with Burst Peripheral Triggers Event Peripheral Trigger PENDCHn Data Transfer Block Transfer BURST BURST Conditional Block Transfer The event input is used to trigger a conditional block transfer on peripherals. Before starting transfers within a block, an event must be received. When received, the event is acknowledged when the block transfer is completed. A software trigger will trigger a transfer. The following figure shows an example where conditional event block transfer is started with peripheral beat trigger requests. Figure 22-15. Conditional Block Transfer with Burst Peripheral Triggers Event Peripheral Trigger PENDCHn Data Transfer Block Transfer Block Transfer BURST BURST BURST BURST Channel Suspend The event input is used to suspend an ongoing channel operation. The event is acknowledged when the current AHB access is completed. For more details on Channel Suspend (see Channel Suspend from Related Links). Channel Resume The event input is used to resume a suspended channel operation. The event is acknowledged as soon as the event is received and the Channel Suspend Interrupt Flag (CHINTFLAG.SUSP) is cleared. See Channel Suspend from Related Links. Skip Next Block Suspend This event can be used to skip the next block suspend action. If the channel is suspended before the event rises, the channel operation is resumed and the event is acknowledged. If the event rises before a suspend block action is detected, the event is kept until the next block suspend detection. When the block transfer is completed, the channel continues the operation (not suspended) and the event is acknowledged. Increase priority This event can be used to increase a channel priority and to request higher quality of service (QOS), when critical transfers must be done. When the event is detected, the channel will have the highest priority and the output Quality of Service value is internally forced to the maximum value. The event is acknowledged when the trigger action execution is completed. When acknowledged, the channel will recover its initial priority level and quality of service settings. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 364 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Related Links 22.6.3.3. Channel Suspend 22.6.6. Events 28. Event System (EVSYS) 22.6.3.6 Event Output Selection The event output selections are available only for channels supporting event outputs. The Channel Event Output Enable can be set in the corresponding Channel n Event Control register
(CHEVCTRL.EVOE). The Event Output Mode bits in the Channel n Event Control register (CHEVCTRL.EVOMODE) selects the event type the channel will generate. The transfer events (CHEVCTRL.EVOMODE = DEFAULT) are strobe events and their duration is one CLK_DMAC_AHB clock period. The transfer event type selection is available in each Descriptor Block Control location (BTCTRL.EVOSEL). Block or burst event output generation is supported. The trigger action event (CHEVCTRL.EVOMODE = TRIGACT) is a level, active while the trigger action execution is not completed. Block Event Output When the block event output is selected, an event strobe is generated when the block transfer is completed. The pulse width of a block event output from a channel is one AHB clock cycle. It is also possible to use this event type to generate an event when the transaction is complete. For this type of application, the block event selection must be set in the last transfer descriptor only, as shown below. Figure 22-16. Block Event Output Generation Block Transfer Block Transfer BURST BURST BURST BURST Data Transfer Event Output Burst Event Output When the burst event output is selected, an event strobe is generated when each burst transfer within the corresponding block is completed. The pulse width of a burst event output from a channel is one AHB clock cycle. The figure below shows an example where the burst event output is set in the second descriptor of a linked list. Figure 22-17. Burst Event Output Generation Block Transfer Block Transfer BURST BURST BURST BURST Data Transfer Event Output Trigger Action Event Output When the trigger action event output is selected, an event level is generated. The event output is set when the transfer trigger occurred, and cleared when the corresponding trigger action is completed. The following figure shows an example for each trigger action type. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 365 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Figure 22-18. Trigger Action Event Output Generation Burst Trigger Action Event Output Transfer Trigger Data Transfer Event Output Block Transfer BURST BURST BURST Block Trigger Action Event Output Transfer Trigger Data Transfer Event Output Block Transfer Block Transfer BURST BURST BURST BURST Transaction Trigger Action Event Output Transfer Trigger Data Transfer Event Output 22.6.3.7 Aborting Transfers Block Transfer Block Transfer BURST BURST BURST BURST Transfers on any channel can be aborted gracefully by software by disabling the corresponding DMA channel. It is also possible to abort all ongoing or pending transfers by disabling the DMAC. When a DMA channel disable request or DMAC disable request is detected:
Ongoing transfers of the active channel will be disabled when the ongoing beat transfer is completed and the write-back memory section is updated. This prevents transfer corruption before the channel is disabled. All other enabled channels will be disabled in the next clock cycle. The corresponding Channel Enable bit in the Channel Control A register is cleared (CHCTRLA.ENABLE=0) when the channel is disabled. The corresponding DMAC Enable bit in the Control register is cleared (CTRL.DMAENABLE=0) when the entire DMAC module is disabled. 22.6.3.8 CRC Operation A Cyclic Redundancy Check (CRC) is an error detection technique used to find errors in data. It is commonly used to determine whether the data during a transmission, or data present in data and program memories has been corrupted or not. A CRC takes a data stream or a block of data as input and generates a 16- or 32-bit output that can be appended to the data and used as a checksum. When the data is received, the device or application repeats the calculation: If the new CRC result does not match the one calculated earlier, the block contains a data error. The application will, then, detect this and may take a corrective action, such as requesting the data to be sent again or simply not using the incorrect data. The CRC engine in DMAC supports two commonly used CRC polynomials: CRC-16 (CRC-CCITT) and CRC-32
(IEEE 802.3). Typically, applying CRC-n (CRC-16 or CRC-32) to a data block of arbitrary length will detect any single alteration that is n bits in length, and will detect the fraction 1-2-n of all longer error bursts. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 366 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) CRC-16:
Polynomial: x16+ x12+ x5+ 1 Hex value: 0x1021 CRC-32:
Polynomial: x32+x26+ x23+ x22+x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x + 1 Hex value: 0x04C11DB7 The data source for the CRC engine can either be one of the DMA channels or the APB bus interface, and must be selected by writing to the CRC Input Source bits in the CRC Control register (CRCCTRL.CRCSRC). The CRC engine then takes data input from the selected source and generates a checksum based on these data. The checksum is available in the CRC Checksum register (CRCCHKSUM). When the CRC-32 polynomial is used, the final checksum read is bit reversed and complemented, as shown in the following figure. The CRC polynomial is selected by writing to the CRC Polynomial Type bit in the CRC Control register
(CRCCTRL.CRCPOLY); the default is CRC-16. The CRC engine operates on byte only. When the DMA is used as a data source for the CRC engine, the DMA channel beat size setting will be used. When used with the APB bus interface, the application must select the CRC Beat Size bit field of the CRC Control register
(CRCCTRL.CRCBEATSIZE). 8-, 16- or 32-bit bus transfer access type is supported. The corresponding number of bytes will be written in the CRCDATAIN register and the CRC engine will operate on the input data in a byte-by-byte manner. Figure 22-19. CRC Generator Block Diagram DMAC Channels CRCDATAIN CRCCTRL 8 16 8 32 CRC-16 CRC-32 crc32 CHECKSUM bit-reverse +
complement Checksum read CRC on DMA Data CRC-16 or CRC-32 calculations can be performed on data passing through any DMA channel. Once a DMA channel is selected as the source, the CRC engine will continuously generate the CRC on the data passing through the DMA channel. The checksum is available for readout once the DMA transaction is completed or aborted. A CRC can also be generated on SRAM, Flash or I/O memory by passing these 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 367 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) data through a DMA channel. If the latter is done, the destination register for the DMA data can be the data input (CRCDATAIN) register in the CRC engine. CRC Using the I/O Interface Before using the CRC engine with the I/O interface, the application must set the CRC Beat Size bits in the CRC Control register (CRCCTRL.CRCBEATSIZE). 8/16/32-bit bus transfer type can be selected. CRC can be performed on any data by loading them into the CRC engine using the CPU and writing the data to the CRCDATAIN register. Using this method, an arbitrary number of bytes can be written to the register by the CPU, and CRC is done continuously for each byte. This means if a 32-bit data is written to the CRCDATAIN register, the CRC engine takes four cycles to calculate the CRC. The CRC complete is signaled by a set CRCBUSY bit in the CRCSTATUS register. New data can be written only when the CRCBUSY flag is not set. 22.6.3.9 Memory CRC Generation When enabled, it is possible to automatically calculate a memory block checksum. When the channel is enabled and the descriptor is fetched, the CRC Checksum register (CRCCHKSUM) is reloaded with the initial checksum value (CHKINIT) stored in the Block Transfer Destination Address register (DSTADDR). The DMA read and calculate the checksum over the data from the source address.When the checksum calculation is completed, the CRC value is stored in the CRC Checksum register (CRCCHKSUM), the Transfer Complete interrupt flag is set
(CHINTFLAGn.TCMPL) and optional interrupt is generated. If the linked descriptor is in the list (DESCADDR !=0), the DMA will fetch the next descriptor and CRC calculation continues as described above. When the last list descriptor is executed, the channel is automatically disabled. In order to enable the memory CRC generation, the following actions must be performed:
The CRC module must be set to be used with a DMA channel (CRCCTRL.CRCSRC) 1. 2. Reserve memory space addresses to configure a descriptor or a list of descriptors 3. Configure each descriptor:
Set the next descriptor address (DESCADDR) Set the destination address with the initial checksum value (DSTADDR = CHKINIT) in the first descriptior in a list Set the transfer source address (SRCADDR) Set the block transfer count (BTCNT) Set the memory CRC generation operation mode (CRCCTRL.CRCMODE = CRCGEN) Enable optional interrupts 4. Enable the corresponding DMA channel (CHCTRLAn.ENABLE) The figure below shows the CRC computation slots and descriptor configuration when single or linked-descriptors transfers are enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 368 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Figure 22-20. CRC Computation with Single Linked Transfers List with Single Descriptor List with Multiple Linked Descriptors Source Memory Source Memory Descriptor 0 0x0 0x2 0x4 0x8 0xc BTCTRL BTCNT = N SRCADDR =
ADDR 1 CHKINIT DESCADDR=
0x00000000 Transfer start address: ADDR1 - N Data 0 Data 1 Descriptor 0 Transfer start address: ADDR1 - N Data 0 Data 1 Desc of this buffer 0x0 0x2 0x4 0x8 0xc BTCTRL BTCNT = N SRCADDR =
ADDR 1 CHKINIT DESCADDR = next desc Desc of this buffer n o i t a t u p m o C C R C ADDR1 Data N-1 outside ADDR1 Data N-1 outside Data N Data N+ 1 Transfer start address: ADDR2 - M Descriptor n (last) 0x0 0x2 0x4 BTCTRL BTCNT = M SRCADDR =
ADDR 2 0x8 DONT CARE 0xc DESCADDR=
0x00000000 Desc of this buffer n o i t a t u p m o C C R C Notes :
Figures assumes that STEPSIZE is 0 (X1) T o ease understanding (buffer base address is SRCADDR minus BTCNT items). ADDR2 Data M-1 outside 22.6.3.10 Memory CRC Monitor When enabled, it is possible to continuously check a a memory block data integrity by calculating and checking the CRC checksum. The expected CRC checksum value must be located in the last memory block location, as shown in the table below:
CRCCTRL.CRCPOLY CRCCTRL.CRCBEATSIZE Last Memory Block Byte CHECKSUM Result Locations Value (MSB Byte First) CRC-16 CRC-32 Byte Half-word Word Byte Half-word Word Expected CRC[7:0]
Expected CRC[15:8]
0x00 0x00 Expected CRC[7:0]
Expected CRC[15:8]
Expected CRC[31:24]
Expected CRC[23:16]
Expected CRC[15:8]
Expected CRC[7:0]
0x00000000 CRC Magic Number
(0x2144DF1C) When the channel is enabled and the descriptor is fetched, the CRC Checksum register (CRCCHKSUM) is reloaded with the initial checksum value (CHKINIT), stored in the DSTADDR location of the first descriptor. The DMA read and calculate the checksum over the entire data from the source address.When the checksum calculation is completed the DMA read the last beat from the memory, the calculated CRC value from the CRC Checksum register is compared to zero or CRC magic number, depending on CRC polynomial selection. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 369 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) If the CHECKSUM does not match the comparison value the DMA channel is disabled, and both and the CRC Error bit in the Channel n Status register (CHSTATUSn.CRCERR) and Transfer Error interrupt flag (CHINTFLAGn.TERR) are set. If enabled, the Transfer Error interrupt is generated. If the calculated checksum value matches the compare value, the Transfer Complete interrupt flag
(CHINTFLAGn.TCMPL) is set, optional interrupt is generated and the DMA will perform the following actions, depending on the descriptor list settings:
If the list has only one descriptor, the DMA will re-fetch the descriptor If the current descriptor is the last descriptor from the list, the DMA will fetch the first descriptor from the list When the fetch is completed, the DMA restarts the operations described above when new triggers are detected. In order to enable the memory CRC monitor, the following actions must be performed:
The CRC module must be set to be used with a DMA channel (CRCCTRL.CRCSRC) 1. 2. Reserve memory space addresses to configure a descriptor or a list of descriptors 3. Configure each descriptor Set the next descriptor address (DESCADDR) In the first list descriptor, set the destination address with the initial checksum value (DSTADDR =
CHKINIT) Set the transfer source address (SRCADDR) Set the block transfer count (BTCNT) Set the memory CRC monitor operation mode (CRCCTRL.CRCMODE = CRCMON) Enable optional interrupts 4. Enable the corresponding DMA channel (CHCTRLAn.ENABLE) Figure 22-21. CRC Computation and Check with Single or Linked Transfers List with Single Descriptor List with Multiple Linked Descriptors Source Memory Source Memory Transfer start address: ADDR1 - N Data 0 Data 1 Descriptor 0 Transfer start address: ADDR1 - N Data 0 Data 1 Descriptor 0 0x0 0x2 0x4 0x8 0xc BTCTRL BTCNT = N SRCADDR =
ADDR 1 CHKINIT DESCADDR=
0x00000000 Desc of this buffer n o i t a t u p m o C C R C Data N-2 Expected CRC ADDR1 outside 0x0 0x2 0x4 0x8 0xc BTCTRL BTCNT = N SRCADDR =
ADDR 1 CHKINIT DESCADDR
= next desc address Desc of this buffer n o i t a t u p m o C C R C Data N-1 ADDR1 outside Data N Data N+ 1 Transfer start address: ADDR2 - M Descriptor n (last) 0x0 0x2 0x4 BTCTRL BTCNT = M SRCADDR =
ADDR 2 0x8 DONT CARE 0xc DESCADDR=
0x00000000 Desc of this buffer n o i t a t u p m o C C R C Data M-2 Expected CRC ADDR2 outside Notes :
Figures assumes that STEPSIZE is 0 (X1). T o ease understanding, buffer base address is SRCADDR minus BTCNT items. 22.6.4 DMA Operation Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 370 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.6.5 Interrupts The DMAC channels have the following interrupt sources:
Transfer Complete (TCMPL): Indicates that a block transfer is completed on the corresponding channel. See Data Transmission from Related Links. Transfer Error (TERR): Indicates that a bus error has occurred during a burst transfer, or that an invalid descriptor has been fetched. See Error Handling from Related Links. Channel Suspend (SUSP): Indicates that the corresponding channel has been suspended. See Channel Suspend and Data Transmission from Related Links. Each interrupt source has an Interrupt flag associated with it. The Interrupt flag in the Channel Interrupt Flag Status and Clear (CHINTFLAG) register is set when the Interrupt condition occurs. Each interrupt can be individually enabled by setting the corresponding bit in the Channel Interrupt Enable Set register (CHINTENSET=1), and disabled by setting the corresponding bit in the Channel Interrupt Enable Clear register (CHINTENCLR=1). The status of enabled interrupts can be read from either INTENSET or INTENCLR. An interrupt request is generated when the Interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the Interrupt flag is cleared, the interrupt is disabled, the DMAC is reset or the corresponding DMA channel is reset. See CHINTFLAG for details on how to clear Interrupt flags. All interrupt requests are ORed together on system level to generate one combined interrupt request to the NVIC. See Nested Vector Interrupt Controller (NVIC) from Related Links. The user must read the Channel Interrupt Status (INTSTATUS) register to identify the channels with pending interrupts and must read the Channel Interrupt Flag Status and Clear (CHINTFLAG) register to determine which Interrupt condition is present for the corresponding channel. It is also possible to read the Interrupt Pending register
(INTPEND), which provides the lowest channel number with pending interrupt and the respective Interrupt flags. Note:Interrupts must be globally enabled for interrupt requests to be generated. Related Links 22.6.2.5. Data Transmission 22.6.3.3. Channel Suspend 10.2. Nested Vector Interrupt Controller (NVIC) 22.6.6 Events The DMAC can generate the following output events:
Channel (CH): Generated when a block transfer for a given channel has been completed, or when a beat transfer within a block transfer for a given channel has been completed. See Event Output Selection from Related Links. Setting the Channel Event Output Enable bit (CHEVCTRLx.EVOE = 1) enables the corresponding output event configured in the Event Output Selection bit group in the Block Transfer Control register (BTCTRL.EVOSEL). Clearing CHEVCTRLx.EVOE = 0 disables the corresponding output event. The DMAC can take the following actions on an input event:
Transfer and Periodic Transfer Trigger (TRIG): normal transfer or periodic transfers on peripherals are enabled Conditional Transfer Trigger (CTRIG): conditional transfers on peripherals are enabled Conditional Block Transfer Trigger (CBLOCK): conditional block transfers on peripherals are enabled Channel Suspend Operation (SUSPEND): suspend a channel operation Channel Resume Operation (RESUME): resume a suspended channel operation Skip Next Block Suspend Action (SSKIP): skip the next block suspend transfer condition Increase Priority (INCPRI): increase channel priority Setting the Channel Event Input Enable bit (CHEVCTRLx.EVIE = 1) enables the corresponding action on input event. Clearing this bit disables the corresponding action on input event. Note that several actions can be enabled for incoming events. If several events are connected to the peripheral, any enabled action will be taken for any of the incoming events. See Event Input Actions from Related Links for more details on event input actions. Note:Event input and outputs are not available for every channel. See Features from Related Links. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 371 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Related Links 22.6.3.6. Event Output Selection 22.6.3.5. Event Input Actions 22.2. Features 22.6.7 Sleep Mode Operation 22.6.8 Synchronization Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 372 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.7 DMAC Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CTRL 0x02 CRCCTRL 0x04 CRCDATAIN 0x08 CRCCHKSUM 0x0C 0x0D 0x0E
... 0x0F CRCSTATUS DBGCTRL Reserved 0x10 SWTRIGCTRL 0x14 PRICTRL0 0x18
... 0x1F 0x20 0x22
... 0x23 Reserved INTPEND Reserved 0x24 INTSTATUS 0x28 BUSYCH 0x2C PENDCH 0x30 ACTIVE 0x34 BASEADDR 7:0 15:8 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 CRCMODE[1:0]
LVLENx3 LVLENx2 LVLENx1 LVLENx0 DMAENABLE SWRST CRCPOLY[1:0]
CRCSRC[5:0]
CRCBEATSIZE[1:0]
CRCDATAIN[7:0]
CRCDATAIN[15:8]
CRCDATAIN[23:16]
CRCDATAIN[31:24]
CRCCHKSUM[7:0]
CRCCHKSUM[15:8]
CRCCHKSUM[23:16]
CRCCHKSUM[31:24]
SWTRIGn[7:0]
SWTRIGn[15:8]
CRCERR CRCZERO CRCBUSY DBGRUN RRLVLEN0 RRLVLEN1 RRLVLEN2 RRLVLEN3 QOS00[1:0]
QOS01[1:0]
QOS02[1:0]
QOS03[1:0]
LVLPRI0[4:0]
LVLPRI1[4:0]
LVLPRI2[4:0]
LVLPRI3[4:0]
PEND BUSY FERR CRCERR ID[4:0]
SUSP TCMPL TERR ABUSY BTCNT[7:0]
BTCNT[15:8]
BASEADDR[7:0]
BASEADDR[15:8]
BASEADDR[23:16]
BASEADDR[31:24]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 373 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 0x38 WRBADDR 0x3C
... 0x3F Reserved 0x40 CHCTRLA0 0x44 0x45 0x46 0x47
... 0x4B 0x4C 0x4D 0x4E 0x4F CHCTRLB0 CHPRILVL0 CHEVCTRL0 Reserved CHINTENCLR0 CHINTENSET0 CHINTFLAG0 CHSTATUS0 0x50 CHCTRLA1 0x54 0x55 0x56 0x57
... 0x5B 0x5C 0x5D 0x5E 0x5F CHCTRLB1 CHPRILVL1 CHEVCTRL1 Reserved CHINTENCLR1 CHINTENSET1 CHINTFLAG1 CHSTATUS1 0x60 CHCTRLA2 0x64 0x65 0x66 0x67
... 0x6B 0x6C 0x6D 0x6E 0x6F CHCTRLB2 CHPRILVL2 CHEVCTRL2 Reserved CHINTENCLR2 CHINTENSET2 CHINTFLAG2 CHSTATUS2 0x70 CHCTRLA3 0x74 0x75 0x76 0x77
... 0x7B CHCTRLB3 CHPRILVL3 CHEVCTRL3 Reserved WRBADDR[7:0]
WRBADDR[15:8]
WRBADDR[23:16]
WRBADDR[31:24]
RUNSTDBY ENABLE SWRST TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 374 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC)
...........continued Offset Name Bit Pos. 7 6 5 4 3 RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
2 SUSP SUSP SUSP FERR 1 TCMPL TCMPL TCMPL BUSY 0 TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 0x7C 0x7D 0x7E 0x7F CHINTENCLR3 CHINTENSET3 CHINTFLAG3 CHSTATUS3 0x80 CHCTRLA4 0x84 0x85 0x86 0x87
... 0x8B 0x8C 0x8D 0x8E 0x8F CHCTRLB4 CHPRILVL4 CHEVCTRL4 Reserved CHINTENCLR4 CHINTENSET4 CHINTFLAG4 CHSTATUS4 0x90 CHCTRLA5 0x94 0x95 0x96 0x97
... 0x9B 0x9C 0x9D 0x9E 0x9F CHCTRLB5 CHPRILVL5 CHEVCTRL5 Reserved CHINTENCLR5 CHINTENSET5 CHINTFLAG5 CHSTATUS5 0xA0 CHCTRLA6 0xA4 0xA5 0xA6 0xA7
... 0xAB 0xAC 0xAD 0xAE 0xAF CHCTRLB6 CHPRILVL6 CHEVCTRL6 Reserved CHINTENCLR6 CHINTENSET6 CHINTFLAG6 CHSTATUS6 0xB0 CHCTRLA7 CHCTRLB7 CHPRILVL7 CHEVCTRL7 Reserved 0xB4 0xB5 0xB6 0xB7
... 0xBB 0xBC 0xBD 0xBE CHINTENCLR7 CHINTENSET7 CHINTFLAG7 7:0 7:0 7:0 SUSP SUSP SUSP TCMPL TCMPL TCMPL TERR TERR TERR 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 375 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 RUNSTDBY CRCERR FERR BUSY ENABLE PEND SWRST TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
0xBF CHSTATUS7 0xC0 CHCTRLA8 0xC4 0xC5 0xC6 0xC7
... 0xCB 0xCC 0xCD 0xCE 0xCF CHCTRLB8 CHPRILVL8 CHEVCTRL8 Reserved CHINTENCLR8 CHINTENSET8 CHINTFLAG8 CHSTATUS8 0xD0 CHCTRLA9 0xD4 0xD5 0xD6 0xD7
... 0xDB 0xDC 0xDD 0xDE 0xDF CHCTRLB9 CHPRILVL9 CHEVCTRL9 Reserved CHINTENCLR9 CHINTENSET9 CHINTFLAG9 CHSTATUS9 0xE0 CHCTRLA10 0xE4 0xE5 0xE6 0xE7
... 0xEB 0xEC 0xED 0xEE 0xEF CHCTRLB10 CHPRILVL10 CHEVCTRL10 Reserved CHINTENCLR10 CHINTENSET10 CHINTFLAG10 CHSTATUS10 0xF0 CHCTRLA11 CHCTRLB11 CHPRILVL11 CHEVCTRL11 Reserved 0xF4 0xF5 0xF6 0xF7
... 0xFB 0xFC 0xFD 0xFE 0xFF CHINTENCLR11 CHINTENSET11 CHINTFLAG11 CHSTATUS11 7:0 7:0 7:0 7:0 SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND CRCERR 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 376 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 RUNSTDBY ENABLE SWRST TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
RUNSTDBY CRCERR TRIGSRC[7:0]
TRIGACT[1:0]
THRESHOLD[1:0]
SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND ENABLE SWRST BURSTLEN[3:0]
CMD[1:0]
EVOE EVIE EVOMODE[1:0]
EVACT[2:0]
0x0100 CHCTRLA12 0x0104 0x0105 0x0106 0x0107
... 0x010B 0x010C 0x010D 0x010E 0x010F CHCTRLB12 CHPRILVL12 CHEVCTRL12 Reserved CHINTENCLR12 CHINTENSET12 CHINTFLAG12 CHSTATUS12 0x0110 CHCTRLA13 0x0114 0x0115 0x0116 0x0117
... 0x011B 0x011C 0x011D 0x011E 0x011F CHCTRLB13 CHPRILVL13 CHEVCTRL13 Reserved CHINTENCLR13 CHINTENSET13 CHINTFLAG13 CHSTATUS13 0x0120 CHCTRLA14 0x0124 0x0125 0x0126 0x0127
... 0x012B 0x012C 0x012D 0x012E 0x012F CHCTRLB14 CHPRILVL14 CHEVCTRL14 Reserved CHINTENCLR14 CHINTENSET14 CHINTFLAG14 CHSTATUS14 0x0130 CHCTRLA15 CHCTRLB15 CHPRILVL15 CHEVCTRL15 Reserved 0x0134 0x0135 0x0136 0x0137
... 0x013B 0x013C 0x013D 0x013E 0x013F CHINTENCLR15 CHINTENSET15 CHINTFLAG15 CHSTATUS15 7:0 7:0 7:0 7:0 SUSP SUSP SUSP FERR TCMPL TCMPL TCMPL BUSY TERR TERR TERR PEND CRCERR 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 377 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8 Register Description Registers can be 8, 16, or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description. See Register Access Protection from Related Links. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable-
protection is denoted by the "Enable-Protected" property in each individual register description. Related Links 22.5.7. Register Access Protection 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 378 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.1 Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected CTRL 0x00 0x0000 Bit 15 14 13 12 Access Reset 11 LVLENx3 R/W 0 10 LVLENx2 R/W 0 9 LVLENx1 R/W 0 Bit 7 6 5 4 3 2 Access Reset Bits 8, 9, 10, 11 LVLENxxPriority Level x Enable 1 DMAENABLE R/W 0 8 LVLENx0 R/W 0 0 SWRST R/W 0 When this bit is set, all requests with the corresponding level will be fed into the arbiter block. When cleared, all requests with the corresponding level will be ignored. For details on arbitration schemes, see Arbitration from Related Links. These bits are not enable-protected. Value 0 1 Description Transfer requests for Priority level x will not be handled. Transfer requests for Priority level x will be handled. Bit 1 DMAENABLEDMA Enable Setting this bit will enable the DMA module. Writing a 0 to this bit will disable the DMA module. When writing a 0 during an ongoing transfer, the bit will not be cleared until the internal data transfer buffer is empty and the DMA transfer is aborted. The internal data transfer buffer will be empty once the ongoing burst transfer is completed. This bit is not enable-protected. Value 0 1 Description The peripheral is disabled. The peripheral is enabled. Bit 0 SWRSTSoftware Reset Writing a 0 to this bit has no effect. Writing a 1 to this bit when the DMAC module is disabled (DMAENABLE bit set to 0 ), resets all registers in the DMAC (except DBGCTRL) to their initial state. If either the DMAC or CRC module is enabled, the Reset request will be ignored and the DMAC will return an access error. Value 0 1 Description There is no Reset operation ongoing. A Reset operation is ongoing. Related Links 22.6.2.4. Arbitration 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 379 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.2 CRC Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected CRCCTRL 0x02 0x0000 Bit 15 14 CRCMODE[1:0]
Access Reset R/W 0 Bit 7 Access Reset R/W 0 6 13 R/W 0 5 12 R/W 0 4 11 10 CRCSRC[5:0]
R/W 0 3 R/W 0 2 9 R/W 0 1 8 R/W 0 0 CRCPOLY[1:0]
R/W 0 R/W 0 CRCBEATSIZE[1:0]
R/W R/W 0 0 Bits 15:14 CRCMODE[1:0]CRC Operating Mode These bits define the block transfer mode. Value 0x0 0x1 0x2 0x3 Name DEFAULT
CRCMON CRCGEN Description Default operating mode Reserved Memory CRC monitor operating mode Memory CRC generation operating mode Bits 13:8 CRCSRC[5:0]CRC Input Source Name DISABLE IO
Description No action I/O interface Reserved These bits select the input source for generating the CRC. The selected source is locked until either the CRC generation is completed or the CRC module is disabled. This means the CRCSRC cannot be modified when the CRC operation is ongoing. The lock is signaled by the CRCBUSY status bit. CRC generation complete is generated and signaled from the selected source when used with the DMA channel. Value 0x00 0x01 0x02 -
0x1F 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2A 0x2B 0x2C 0x2D 0x2E 0x2F 0x30 0x31 0x32 0x33 DMA channel 0 DMA channel 1 DMA channel 2 DMA channel 3 DMA channel 4 DMA channel 5 DMA channel 6 DMA channel 7 DMA channel 8 DMA channel 9 DMA channel 10 DMA channel 11 DMA channel 12 DMA channel 13 DMA channel 14 DMA channel 15 DMA channel 16 DMA channel 17 DMA channel 18 DMA channel 19 CH0 CH1 CH2 CH3 CH4 CH5 CH6 CH7 CH8 CH9 CH10 CH11 CH12 CH13 CH14 CH15 CH16 CH17 CH18 CH19 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 380 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Value 0x34 0x35 0x36 0x37 0x38 0x39 0x3A 0x3B 0x3C 0x3D 0x3E 0x3F Name CH20 CH21 CH22 CH23 CH24 CH25 CH26 CH27 CH28 CH29 CH30 CH31 Description DMA channel 20 DMA channel 21 DMA channel 22 DMA channel 23 DMA channel 24 DMA channel 25 DMA channel 26 DMA channel 27 DMA channel 28 DMA channel 29 DMA channel 30 DMA channel 31 Bits 3:2 CRCPOLY[1:0]CRC Polynomial Type These bits select the CRC polynomial type. Value 0x0 0x1 0x2-0x3 Name CRC16 CRC32
Description CRC-16 (CRC-CCITT) CRC32 (IEEE 802.3) Reserved Bits 1:0 CRCBEATSIZE[1:0]CRC Beat Size These bits define the size of the data transfer for each bus access when the CRC is used with I/O interface. Value 0x0 0x1 0x2 0x3 Description 8-bit bus transfer 16-bit bus transfer 32-bit bus transfer Reserved Name BYTE HWORD WORD
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 381 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.3 CRC Data Input Name:
Offset:
Reset:
Property: PAC Write Protection CRCDATAIN 0x04 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 CRCDATAIN[31:24]
R/W R/W 0 0 20 19 CRCDATAIN[23:16]
R/W R/W 0 0 11 12 CRCDATAIN[15:8]
R/W 0 R/W 0 4 3 CRCDATAIN[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 CRCDATAIN[31:0]CRC Data Input These bits store the data for which the CRC checksum is computed. A new CRC checksum is ready (CRCBEAT+ 1) clock cycles after the CRCDATAIN register is written. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 382 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.4 CRC Checksum Name:
Offset:
Reset:
Property: PAC Write Protection, Enable-Protected CRCCHKSUM 0x08 0x00000000 The CRCCHKSUM represents the 16- or 32-bit checksum value and the generated CRC. The register is reset to zero by default, but it is possible to reset all bits to one by writing the CRCCHKSUM register directly. It is possible to write this register only when the CRC module is disabled. If CRC-32 is selected and the CRC Status Busy flag is cleared
(i.e., CRC generation is completed or aborted), the bit reversed (bit 31 is swapped with bit 0, bit 30 with bit 1, etc.) and complemented result will be read from CRCCHKSUM. If CRC-16 is selected or the CRC Status Busy flag is set
(i.e., CRC generation is ongoing), CRCCHKSUM will contain the actual content. Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 CRCCHKSUM[31:24]
R/W R/W 0 0 20 19 CRCCHKSUM[23:16]
R/W R/W 0 0 12 11 CRCCHKSUM[15:8]
R/W R/W 0 0 4 3 CRCCHKSUM[7:0]
R/W R/W 0 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 CRCCHKSUM[31:0]CRC Checksum These bits store the generated CRC result. The 16 MSB bits are always read zero when CRC-16 is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 383 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.5 CRC Status Name:
Offset:
Reset:
Property: PAC Write-Protection CRCSTATUS 0x0C 0x00 Bit 7 6 5 4 3 Access Reset 2 CRCERR R 0 1 CRCZERO R 0 0 CRCBUSY R/W 0 Bit 2 CRCERRCRC Error This bit is read '1' when the memory CRC monitor detects data corruption. Bit 1 CRCZEROCRC Zero This bit is cleared when a new CRC source is selected. This bit is set when the CRC generation is complete and the CRC Checksum is zero. Bit 0 CRCBUSYCRC Module Busy When used with an I/O interface (CRCCTRL.CRCSRC=0x1):
This bit is cleared by writing a '1' to it This bit is set when the CRC Data Input (CRCDATAIN) register is written Writing a '1' to this bit will clear the CRC Module Busy bit Writing a '0' to this bit has no effect When used with a DMA channel (CRCCTRL.CRCSRC=0x20..,0x3F):
This bit is cleared when the corresponding DMA channel is disabled This bit is set when the corresponding DMA channel is enabled Writing a '1' to this bit has no effect Writing a '0' to this bit has no effect Related Links 22.7. DMAC Register Summary 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 384 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.6 Debug Control DBGCTRL Name:
0x0D Offset:
Reset:
0x00 Property: PAC Write Protection Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGRUNDebug Run This bit is not reset by a Software Reset. This bit controls the functionality when the CPU is halted by an external debugger. Value 0 1 Description The DMAC is halted when the CPU is halted by an external debugger. The DMAC continues normal operation when the CPU is halted by an external debugger. DBGRUN R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 385 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.7 Software Trigger Control Name:
Offset:
Reset:
Property: PAC Write-Protection SWTRIGCTRL 0x10 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 12 11 SWTRIGn[15:8]
R/W 0 4 R/W 0 3 SWTRIGn[7:0]
R/W 0 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 SWTRIGn[15:0]Channel n Software Trigger [n = 15..0]
This bit is cleared when the Channel Pending bit in the Channel Status register (CHSTATUS.PEND) for the corresponding channel is either set, or by writing a 1 to it. See CHSTATUS in the DMAC Register Summary from Related Links. This bit is set if CHSTATUS.PEND is already 1 when writing a 1 to that bit. See CHSTATUS in the DMAC Register Summary from Related Links. Writing a 0 to this bit will clear the bit. Writing a 1 to this bit will generate a DMA software trigger on channel x, if CHSTATUS.PEND=0 for channel x. CHSTATUS.PEND will be set and SWTRIGn will remain cleared. See CHSTATUS in the DMAC Register Summary from Related Links. Related Links 22.7. DMAC Register Summary 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 386 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.8 Priority Control 0 Name:
Offset:
Reset:
Property: PAC Write-Protection PRICTRL0 0x14 0x40404040 Bit 31 RRLVLEN3 Access Reset R/W 0 Bit 23 RRLVLEN2 Access Reset R/W 0 Bit 15 RRLVLEN1 Access Reset R/W 0 Bit 7 RRLVLEN0 Access Reset R/W 0 QOS03[1:0]
QOS02[1:0]
QOS01[1:0]
QOS00[1:0]
30 R/W 1 22 R/W 1 14 R/W 1 6 R/W 1 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 27 R/W 0 19 R/W 0 11 R/W 0 3 R/W 0 26 LVLPRI3[4:0]
R/W 0 18 LVLPRI2[4:0]
R/W 0 10 LVLPRI1[4:0]
R/W 0 2 LVLPRI0[4:0]
R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 7, 15, 23, 31 RRLVLENLevel Round-Robin Scheduling Enable For details on arbitration schemes, see Arbitration from Related Links. Value 0 1 Description Static arbitration scheme for channels with level 0 priority. Round-robin arbitration scheme for channels with level 0 priority. Bits 5:6, 13:14, 21:22, 29:30 QOSLevel Quality of Service 0x0 0x1 0x2 0x3 DISABLE Background (no sensitive operation) LOW Sensitive to bandwidth MEDIUM Sensitive to latency Critical Latency Bits 0:4, 8:12, 16:20, 24:28 LVLPRILevel Channel Priority Number When round-robin arbitration is enabled (PRICTRL0.RRLVLEN0=1) for priority level 0, this register holds the channel number of the last DMA channel being granted access as the active channel with priority level 0. When static arbitration is enabled (PRICTRL0.RRLVLEN0=0) for priority level 0, and the value of this bit group is non-zero, it will not affect the static priority scheme. This bit group is not reset when round-robin arbitration gets disabled (PRICTRL0.RRLVLEN0 written to 0). Related Links 22.6.2.4. Arbitration 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 387 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.9 Interrupt Pending Name:
Offset:
Reset:
Property:
INTPEND 0x20 0x0000
This register allows the user to identify the lowest DMA channel with pending interrupt. An interrupt that handles several channels must consult the INTPEND register to find out which channel number has priority (ignoring/filtering each channel that has its own interrupt line). An interrupt dedicated to only one channel must not use the INTPEND register. Bit Access Reset 15 PEND R 0 14 BUSY R 0 13 FERR R 0 12 CRCERR R/W 0 Bit 7 6 5 Access Reset Bit 15 PENDPending 4 R/W 0 11 3 R/W 0 10 SUSP R/W 0 2 ID[4:0]
R/W 0 9 TCMPL R/W 0 1 R/W 0 8 TERR R/W 0 0 R/W 0 This bit will read 1 when the channel selected by Channel ID field (ID) is pending. Bit 14 BUSYBusy This bit will read 1 when the channel selected by Channel ID field (ID) is busy. Bit 13 FERRFetch Error This bit will read 1 when the channel selected by Channel ID field (ID) fetched an invalid descriptor. Bit 12 CRCERRCRC Error This bit will read 1 when the channel selected by Channel ID field (ID) has a CRC Error Status Flag bit set, and is set when the CRC monitor detects data corruption. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear it. It will also clear the corresponding flag in the Channel n Interrupt Flag Status and Clear register (CHINTFLAGn), where n is determined by the Channel ID bit field (ID). Bit 10 SUSPChannel Suspend This bit will read 1 when the channel selected by Channel ID field (ID) has pending Suspend interrupt. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear it. It will also clear the corresponding flag in the Channel n Interrupt Flag Status and Clear register (CHINTFLAGn), where n is determined by the Channel ID bit field (ID). Bit 9 TCMPLTransfer Complete This bit will read 1 when the channel selected by Channel ID field (ID) has pending Transfer Complete interrupt. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear it. It will also clear the corresponding flag in the Channel n Interrupt Flag Status and Clear register (CHINTFLAGn), where n is determined by the Channel ID bit field (ID). Bit 8 TERRTransfer Error This bit will read 1 when the channel selected by Channel ID field (ID) has pending Transfer Error interrupt. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear it. It will also clear the corresponding flag in the Channel n Interrupt Flag Status and Clear register (CHINTFLAGn), where n is determined by the Channel ID bit field (ID). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 388 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Bits 4:0 ID[4:0]Channel ID These bits store the lowest channel number with pending interrupts. The number is valid if Suspend (SUSP), Transfer Complete (TCMPL) or Transfer Error (TERR) bits are set. The Channel ID field is refreshed when a new channel
(with channel number less than the current one) with pending interrupts is detected, or when the application clears the corresponding channel interrupt sources. When no pending channels interrupts are available, these bits will always return zero value when read. When the bits are written, indirect access to the corresponding Channel Interrupt Flag register is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 389 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.10 Interrupt Status Name:
Offset:
Reset:
Property:
INTSTATUS 0x24 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 390 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.11 Busy Channels Name:
Offset:
Reset:
Property:
BUSYCH 0x28 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 391 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.12 Pending Channels Name:
Offset:
Reset:
Property:
PENDCH 0x2C 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 392 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.13 Active Channel and Levels Name:
Offset:
Reset:
Property:
ACTIVE 0x30 0x00000000
Bit Access Reset Bit Access Reset Bit Access Reset 31 R 0 23 R 0 15 ABUSY R 0 30 R 0 22 R 0 14 29 R 0 21 R 0 13 BTCNT[15:8]
BTCNT[7:0]
28 R 0 20 R 0 12 27 R 0 19 R 0 11 26 R 0 18 R 0 10 25 R 0 17 R 0 9 24 R 0 16 R 0 8 Bit 7 6 5 4 3 2 1 0 Access Reset Bits 31:16 BTCNT[15:0]Active Channel Block Transfer Count These bits hold the 16-bit block transfer count of the ongoing transfer. This value is stored in the active channel and written back in the corresponding Write-Back channel memory location when the arbiter grants a new channel access. The value is valid only when the active channel Active Busy flag (ABUSY) is set. Bit 15 ABUSYActive Channel Busy This bit is cleared when the active transfer count is written back in the write-back memory section. This bit is set when the next descriptor transfer count is read from the write-back memory section. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 393 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.14 Descriptor Memory Section Base Address Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected BASEADDR 0x34 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 BASEADDR[31:24]
R/W R/W 0 0 20 19 BASEADDR[23:16]
R/W R/W 0 0 11 12 BASEADDR[15:8]
R/W 0 R/W 0 4 3 BASEADDR[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 BASEADDR[31:0]Descriptor Memory Base Address These bits store the Descriptor memory section base address. The value must be 64-bit aligned. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 394 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.15 Write-Back Memory Section Base Address Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected WRBADDR 0x38 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 WRBADDR[31:24]
R/W 0 R/W 0 20 19 WRBADDR[23:16]
R/W 0 R/W 0 11 12 WRBADDR[15:8]
R/W 0 R/W 0 4 3 WRBADDR[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 WRBADDR[31:0]Write-Back Memory Base Address These bits store the Write-Back memory base address. The value must be 64-bit aligned. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 395 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.16 Channel Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected CHCTRLA 0x40 + n*0x10 [n=0..15]
0x00000000 Bit 31 30 Access Reset Bit 23 22 29 28 THRESHOLD[1:0]
R/W 0 21 R/W 0 20 TRIGACT[1:0]
Access Reset Bit 15 Access Reset R/W 0 Bit 7 Access Reset 14 R/W 0 6 RUNSTDBY R/W 0 R/W 0 13 R/W 0 5 Bits 29:28 THRESHOLD[1:0]FIFO Threshold 26 25 BURSTLEN[3:0]
27 R/W 0 19 11 R/W 0 12 TRIGSRC[7:0]
R/W 0 4 R/W 0 3 R/W 0 18 10 R/W 0 2 24 R/W 0 16 8 R/W 0 R/W 0 17 9 R/W 0 1 ENABLE R/W 0 0 SWRST R/W 0 These bits define the threshold from which the DMA starts to write to the destination. These bits have no effect in the case of single beat transfers. These bits are not enable-protected. Value 0x0 0x1 0x2 0x3 Description Destination write starts after each beat source addess read Destination write starts after 2-beats source address read Destination write starts after 4-beats source address read Destination write starts after 8-beats source address read Name 1BEAT 2BEATS 4BEATS 8BEATS Bits 27:24 BURSTLEN[3:0]Burst Length These bits define the burst mode. These bits are not enable-protected. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC 0xD Name SINGLE 2BEAT 3BEAT 4BEAT 5BEAT 6BEAT 7BEAT 8BEAT 9BEAT 10BEAT 11BEAT 12BEAT 13BEAT 14BEAT Description Single-beat burst 2-beats burst length 3-beats burst length 4-beats burst length 5-beats burst length 6-beats burst length 7-beats burst length 8-beats burst length 9-beats burst length 10-beats burst length 11-beats burst length 12-beats burst length 13-beats burst length 14-beats burst length 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 396 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) Value 0xE 0xF Name 15BEAT 16BEAT Description 15-beats burst length 16-beats burst length Bits 21:20 TRIGACT[1:0]Trigger Action These bits define the trigger action used for a transfer. These bits are not enable-protected. Value 0x0 0x1 0x2 0x3 BURST TRANSACTION Name BLOCK Description One trigger required for each block transfer Reserved One trigger required for each burst transfer One trigger required for each transaction Bits 15:8 TRIGSRC[7:0]Trigger Source These bits define the peripheral that will be the source of a trigger. Table 22-2. Triggers Map Number Name 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 Unused (Tied to 1'b0) RTC_DMAC_ID_TIMESTAMP DSU_DMAC_ID_DCC0 DSU_DMAC_ID_DCC1 SERCOM0_DMAC_ID_RX SERCOM0_DMAC_ID_TX SERCOM1_DMAC_ID_RX SERCOM1_DMAC_ID_TX SERCOM2_DMAC_ID_RX SERCOM2_DMAC_ID_TX SERCOM3_DMAC_ID_RX SERCOM3_DMAC_ID_TX TCC0_DMAC_ID_OVF TCC0_DMAC_ID_MC_0 TCC0_DMAC_ID_MC_1 TCC0_DMAC_ID_MC_2 TCC0_DMAC_ID_MC_3 TCC0_DMAC_ID_MC_4 TCC0_DMAC_ID_MC_5 TCC1_DMAC_ID_OVF TCC1_DMAC_ID_MC_0 TCC1_DMAC_ID_MC_1 TCC1_DMAC_ID_MC_2 TCC1_DMAC_ID_MC_3 TCC1_DMAC_ID_MC_4 TCC1_DMAC_ID_MC_5 TCC2_DMAC_ID_OVF TCC2_DMAC_ID_MC_0 TCC2_DMAC_ID_MC_1 TC0_DMAC_ID_OVF TC0_DMAC_ID_MC_0 TC0_DMAC_ID_MC_1 TC1_DMAC_ID_OVF TC1_DMAC_ID_MC_0 TC1_DMAC_ID_MC_1 TC2_DMAC_ID_OVF TC2_DMAC_ID_MC_0 TC2_DMAC_ID_MC_1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 397 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC)
...........continued Number 38 39 40 41 42 43 44 Name TC3_DMAC_ID_OVF TC3_DMAC_ID_MC_0 TC3_DMAC_ID_MC_1 AES_DMAC_ID_WR AES_DMAC_ID_RD QSPI_DMAC_ID_RX QSPI_DMAC_ID_TX Bit 6 RUNSTDBYChannel run in standby This bit is used to keep the DMAC channel running in standby mode. This bit is not enable-protected. Value 0 1 Description The DMAC channel is halted in standby. The DMAC channel continues to run in standby. Bit 1 ENABLEChannel Enable Writing a 0 to this bit during an ongoing transfer, the bit will not be cleared until the internal data transfer buffer is empty and the DMA transfer is aborted. The internal data transfer buffer will be empty once the ongoing burst transfer is completed. Writing a 1 to this bit will enable the DMA channel. This bit is not enable-protected. Value 0 1 Description DMA channel is disabled. DMA channel is enabled. Bit 0 SWRSTChannel Software Reset Writing a 0 to this bit has no effect. Writing a 1 to this bit resets the channel registers to their initial state. The bit can be set when the channel is disabled (ENABLE=0). Writing a 1 to this bit will be ignored as long as ENABLE=1. This bit is automatically cleared when the reset is completed. Value 0 1 Description There is no reset operation ongoing. The reset operation is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 398 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.17 Channel Control B Name:
Offset:
Reset:
Property: PAC Write-Protection CHCTRLB 0x44 + n*0x10 [n=0..15]
0x00 Bit 7 6 5 4 3 2 Access Reset Bits 1:0 CMD[1:0]Software Command CMD[1:0]
1 R/W 0 0 R/W 0 These bits define the software commands. See Channel Suspend and Channel Resume and Next Suspend Skip from Related Links. These bits are not enable-protected. CMD[1:0]
0x0 0x1 0x2 0x3 Name NOACT SUSPEND RESUME
Description No action Channel suspend operation Channel resume operation Reserved Related Links 22.6.3.3. Channel Suspend 22.6.3.4. Channel Resume and Next Suspend Skip 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 399 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.18 Channel Priority Level Name:
Offset:
Reset:
Property: PAC Write-Protection CHPRILVL 0x45 + n*0x10 [n=0..15]
0x00 Bit 7 6 5 4 3 2 1 0 Access Reset 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 400 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.19 Channel Event Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected CHEVCTRL 0x46 + n*0x10 [n=0..15]
0x00 Bit Access Reset 7 EVOE R/W 0 6 EVIE R/W 0 5 4 EVOMODE[1:0]
R/W 0 R/W 0 3 2 R/W 0 1 EVACT[2:0]
R/W 0 0 R/W 0 Bit 7 EVOEChannel Event Output Enable This bit indicates if the Channel event generation is enabled. The event will be generated for every condition defined in the Channel Event Output Selection bits (CHEVCTRL.EVOMODE). Value 0 1 Description Channel event generation is disabled. Channel event generation is enabled. Bit 6 EVIEChannel Event Input Enable Value 0 1 Description Channel event action will not be executed on any incoming event. Channel event action will be executed on any incoming event. Bits 5:4 EVOMODE[1:0]Channel Event Output Mode These bits define the channel event output selection. For more details on event output generation, see Event Output Selection from Related Links. Value 0x0 0x1 0x2-0x3 Description Block event output selection. See BTCTRL.EVOSEL for available selections. Ongoing trigger action Reserved Name DEFAULT TRIGACT Bits 2:0 EVACT[2:0]Channel Event Input Action These bits define the event input action. The action is executed only if the corresponding EVIE bit in the CHEVCTRL register of the channel is set. For more details on event actions, see Event Input Actions from Related Links. These bits are available only for channels with event input support. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description No action Transfer and periodic transfer trigger Conditional transfer trigger Conditional block transfer Channel suspend operation Channel resume operation Skip next block suspend action Increase priority Name NOACT TRIG CTRIG CBLOCK SUSPEND RESUME SSKIP INCPRI Related Links 22.6.3.5. Event Input Actions 22.6.3.6. Event Output Selection 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 401 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.20 Channel Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection CHINTENCLR 0x4C + n*0x10 [n=0..15]
0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Channel Interrupt Enable Set (CHINTENSET) register. Bit 7 6 5 4 3 Access Reset Bit 2 SUSPChannel Suspend Interrupt Enable 2 SUSP R/W 0 1 TCMPL R/W 0 0 TERR R/W 0 Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Channel Suspend Interrupt Enable bit, which disables the Channel Suspend interrupt. Value 0 1 Description The Channel Suspend interrupt is disabled. The Channel Suspend interrupt is enabled. Bit 1 TCMPLChannel Transfer Complete Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Channel Transfer Complete Interrupt Enable bit, which disables the Channel Transfer Complete interrupt. Value 0 Description The Channel Transfer Complete interrupt is disabled. When block action is set to none, the TCMPL flag will not be set when a block transfer is completed. The Channel Transfer Complete interrupt is enabled. 1 Bit 0 TERRChannel Transfer Error Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Channel Transfer Error Interrupt Enable bit, which disables the Channel Transfer Error interrupt. Value 0 1 Description The Channel Transfer Error interrupt is disabled. The Channel Transfer Error interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 402 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.21 Channel Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection CHINTENSET 0x4D + n*0x10 [n=0..15]
0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Channel Interrupt Enable Clear (CHINTENCLR) register. Bit 7 6 5 4 3 Access Reset Bit 2 SUSPChannel Suspend Interrupt Enable 2 SUSP R/W 0 1 TCMPL R/W 0 0 TERR R/W 0 Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Channel Suspend Interrupt Enable bit, which enables the Channel Suspend interrupt. Value 0 1 Description The Channel Suspend interrupt is disabled. The Channel Suspend interrupt is enabled. Bit 1 TCMPLChannel Transfer Complete Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Channel Transfer Complete Interrupt Enable bit, which enables the Channel Transfer Complete interrupt. Value 0 1 Description The Channel Transfer Complete interrupt is disabled. The Channel Transfer Complete interrupt is enabled. Bit 0 TERRChannel Transfer Error Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Channel Transfer Error Interrupt Enable bit, which enables the Channel Transfer Error interrupt. Value 0 1 Description The Channel Transfer Error interrupt is disabled. The Channel Transfer Error interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 403 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.22 Channel Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
CHINTFLAG 0x4E + n*0x10 [n=0..15]
0x00
Bit 7 6 5 4 3 Access Reset Bit 2 SUSPChannel Suspend 2 SUSP R/W 0 1 TCMPL R/W 0 0 TERR R/W 0 This flag is cleared by writing a 1 to it. This flag is set when a block transfer with suspend block action is completed, when a software suspend command is executed, when a suspend event is received or when an invalid descriptor is fetched by the DMA. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Channel Suspend interrupt flag for the corresponding channel. For details on available software commands, see CHCTRLB in the DMAC Register Summary from Related Links. For details on available event input actions, see CHCTRLB in the DMAC Register Summary from Related Links. For details on available block actions, see BTCTRL in the DMAC Register Summary (SRAM) from Related Links. Bit 1 TCMPLChannel Transfer Complete This flag is cleared by writing a 1 to it. This flag is set when a block transfer is completed and the corresponding interrupt block action is enabled. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Transfer Complete interrupt flag for the corresponding channel. Bit 0 TERRChannel Transfer Error This flag is cleared by writing a 1 to it. This flag is set when a bus error is detected during a beat transfer or when the DMAC fetches an invalid descriptor. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Transfer Error interrupt flag for the corresponding channel. Related Links 22.9. DMAC Register Summary (SRAM) 22.7. DMAC Register Summary 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 404 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.8.23 Channel Status Name:
Offset:
Reset:
Property:
CHSTATUS 0x4F + n*0x10 [n=0..15]
0x00
Bit 7 6 5 4 Access Reset Bit 3 CRCERRChannel CRC Error 3 CRCERR R/W 0 2 FERR R 0 1 BUSY R 0 0 PEND R 0 This bit is set when the CRC monitor detects data corruption. This bit is cleared by writing 1 to it, or by clearing the CRC Error bit in the INTPEND register (INTPEND.CRCERR). See INTPEND in the DMAC Register Summary from Related Links. Bit 2 FERRChannel Fetch Error This bit is cleared when a software resume command is executed. This bit is set when an invalid descriptor is fetched. Bit 1 BUSYChannel Busy This bit is cleared when the channel trigger action is completed, when a bus error is detected or when the channel is disabled. This bit is set when the DMA channel starts a DMA transfer. Bit 0 PENDChannel Pending This bit is cleared when the channel trigger action is started, when a bus error is detected or when the channel is disabled. For details on trigger action settings, see CHCTRLB in the DMAC Register Summary from Related Links. This bit is set when a transfer is pending on the DMA channel, as soon as the transfer request is received. Related Links 22.7. DMAC Register Summary 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 405 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.9 DMAC Register Summary (SRAM) Offset Name Bit Pos. 7 6 5 4 3 2 1 0x00 BTCTRL 0x02 BTCNT 0x04 SRCADDR 0x08 DSTADDR 0x0C DESCADDR 7:0 15:8 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 0 VALID BLOCKACT[1:0]
EVOSEL[1:0]
STEPSIZE[2:0]
STEPSEL DSTINC SRCINC BEATSIZE[1:0]
BTCNT[7:0]
BTCNT[15:8]
SRCADDR[7:0]
SRCADDR[15:8]
SRCADDR[23:16]
SRCADDR[31:24]
DSTADDR[7:0]
DSTADDR[15:8]
DSTADDR[23:16]
DSTADDR[31:24]
DESCADDR[7:0]
DESCADDR[15:8]
DESCADDR[23:16]
DESCADDR[31:24]
22.10 Register Description - SRAM Registers can be 8, 16, or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description. See Register Access Protection from Related Links. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable-
protection is denoted by the "Enable-Protected" property in each individual register description. Related Links 22.5.7. Register Access Protection 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 406 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.10.1 Block Transfer Control Name:
Offset:
Reset:
Property:
BTCTRL 0x00 0x0000
The BTCTRL register offset is relative to (BASEADDR or WRBADDR) + Channel Number * 0x10 Bit 15 Access Reset R/W 0 14 STEPSIZE[2:0]
R/W 0 Bit 7 6 13 R/W 0 5 12 STEPSEL R/W 0 11 DSTINC R/W 0 3 4 BLOCKACT[1:0]
10 SRCINC R/W 0 2 R/W 0 1 EVOSEL[1:0]
Access Reset R/W 0 R/W 0 R/W 0 R/W 0 Bits 15:13 STEPSIZE[2:0]Address Increment Step Size 9 8 BEATSIZE[1:0]
R/W 0 0 VALID R/W 0 These bits select the address increment step size. The setting apply to source or destination address, depending on STEPSEL setting. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description Next ADDR = ADDR + (Beat size in byte) * 1 Next ADDR = ADDR + (Beat size in byte) * 2 Next ADDR = ADDR + (Beat size in byte) * 4 Next ADDR = ADDR + (Beat size in byte) * 8 Next ADDR = ADDR + (Beat size in byte) * 16 Next ADDR = ADDR + (Beat size in byte) * 32 Next ADDR = ADDR + (Beat size in byte) * 64 Next ADDR = ADDR + (Beat size in byte) * 128 Name X1 X2 X4 X8 X16 X32 X64 X128 Bit 12 STEPSELStep Selection This bit selects if source or destination addresses are using the step size settings. Value 0x0 0x1 Description Step size settings apply to the destination address Step size settings apply to the source address Name DST SRC Bit 11 DSTINCDestination Address Increment Enable Writing a '0' to this bit will disable the destination address incrementation. The address will be kept fixed during the data transfer. Writing a '1' to this bit will enable the destination address incrementation. By default, the destination address is incremented by 1. If the STEPSEL bit is cleared, flexible step-size settings are available in the STEPSIZE register. Value 0 1 Description The Destination Address Increment is disabled The Destination Address Increment is enabled Bit 10 SRCINCSource Address Increment Enable Writing a '0' to this bit will disable the source address incrementation. The address will be kept fixed during the data transfer. Writing a '1' to this bit will enable the source address incrementation. By default, the source address is incremented by 1. If the STEPSEL bit is set, flexible step-size settings are available in the STEPSIZE register. Value 0 1 Description The Source Address Increment is disabled The Source Address Increment is enabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 407 Bits 9:8 BEATSIZE[1:0]Beat Size PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) These bits define the size of one beat. A beat is the size of one data transfer bus access, and the setting apply to both read and write accesses. Value 0x0 0x1 0x2 other Description 8-bit bus transfer 16-bit bus transfer 32-bit bus transfer Reserved Name BYTE HWORD WORD Bits 4:3 BLOCKACT[1:0]Block Action These bits define what actions the DMAC must take after a block transfer has completed. BLOCKACT[1:0] Name Description 0x0 0x1 0x2 0x3 NOACT INT Channel will be disabled if it is the last block transfer in the transaction Channel will be disabled if it is the last block transfer in the transaction and block interrupt SUSPEND Channel suspend operation is completed BOTH Both channel suspend operation and block interrupt Bits 2:1 EVOSEL[1:0]Event Output Selection These bits define the event output selection. EVOSEL[1:0]
0x0 0x1 0x2 0x3 Name DISABLE BLOCK BEAT Description Event generation disabled Event strobe when block transfer complete Reserved Event strobe when beat transfer complete Bit 0 VALIDDescriptor Valid Writing a '0' to this bit in the Descriptor or Write-Back memory will suspend the DMA channel operation when fetching the corresponding descriptor. The bit is automatically cleared in the Write-Back memory section when channel is aborted, when an error is detected during the block transfer, or when the block transfer is completed. Value 0 1 Description The descriptor is not valid The descriptor is valid 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 408 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.10.2 Block Transfer Count Name:
Offset:
Property:
BTCNT 0x02
The BTCNT register offset is relative to (BASEADDR or WRBADDR) + Channel Number * 0x10 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 12 11 BTCNT[15:8]
R/W 0 4 R/W 0 R/W 0 3 R/W 0 BTCNT[7:0]
10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 BTCNT[15:0]Block Transfer Count This bit group holds the 16-bit block transfer count. During a transfer, the internal counter value is decremented by one after each beat transfer. The internal counter is written to the corresponding write-back memory section for the DMA channel when the DMA channel loses priority, is suspended or gets disabled. The DMA channel can be disabled by a complete transfer, a transfer error or by software. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 409 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.10.3 Block Transfer Source Address Name:
Offset:
Property:
SRCADDR 0x04
The SRCADDR register offset is relative to (BASEADDR or WRBADDR) + Channel Number * 0x10 Bit 31 Access Reset
0 Bit 23 Access Reset
0 Bit 15 Access Reset Bit Access Reset
0 7
0 30
0 22
0 14
0 6
0 29
0 21
0 13
0 5
0 28 27 SRCADDR[31:24]
0 0 20 19 SRCADDR[23:16]
0 0 11 12 SRCADDR[15:8]
0 0 4 3 SRCADDR[7:0]
0
0 26
0 18
0 10
0 2
0 25
0 17
0 9
0 1
0 24
0 16
0 8
0 0
0 Bits 31:0 SRCADDR[31:0]Transfer Source Address This bit field holds the block transfer source address. When source address incrementation is disabled (BTCTRL.SRCINC=0), SRCADDR corresponds to the last beat transfer address in the block transfer. When source address incrementation is enabled (BTCTRL.SRCINC=1), SRCADDR is calculated as follows:
If BTCTRL.STEPSEL = 1:
If BTCTRL.STEPSEL= 0:
SRCADDR = SRCADDRSTART + BTCNT BEATSIZE + 1 2 STEPSIZE SRCADDR = SRCADDRSTART + BTCNT BEATSIZE + 1 SRCADDRSTART is the source address of the first beat transfer in the block transfer BTCNT is the initial number of beats remaining in the block transfer BEATSIZE is the configured number of bytes in a beat STEPSIZE is the configured number of beats for each incrementation 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 410 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.10.4 Block Transfer Destination Address Name:
Offset:
Property:
DSTADDR 0x08
The DSTADDR register offset is relative to (BASEADDR or WRBADDR) + Channel Number * 0x10 Bit 31 Access Reset
0 Bit 23 Access Reset
0 Bit 15 Access Reset Bit Access Reset
0 7
0 30
0 22
0 14
0 6
0 29
0 21
0 13
0 5
0 28 27 DSTADDR[31:24]
0 0 20 19 DSTADDR[23:16]
0 0 12 11 DSTADDR[15:8]
0 0 DSTADDR[7:0]
4
0 3
0 26
0 18
0 10
0 2
0 25
0 17
0 9
0 1
0 24
0 16
0 8
0 0
0 Bits 31:0 DSTADDR[31:0]Transfer Destination Address This bit field holds the block transfer destination address. When destination address incrementation is disabled (BTCTRL.DSTINC = 0), DSTADDR corresponds to the last beat transfer address in the block transfer. When destination address incrementation is enabled (BTCTRL.DSTINC = 1), DSTADDR is calculated as follows:
If BTCTRL.STEPSEL = 1:
If BTCTRL.STEPSEL = 0:
DSTADDR = DSTADDRSTART + BTCNT BEATSIZE + 1 DSTADDR = DSTADDRSTART + BTCNT BEATSIZE + 1 2 DSTADDRSTART is the destination address of the first beat transfer in the block transfer BTCNT is the initial number of beats remaining in the block transfer BEATSIZE is the configured number of bytes in a beat STEPSIZE is the configured number of beats for each incrementation STEPSIZE 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 411 PIC32CX-BZ2 and WBZ45 Family Direct Memory Access Controller (DMAC) 22.10.5 Next Descriptor Address Name:
Offset:
Property:
DESCADDR 0x0C
The DESCADDR register offset is relative to (BASEADDR or WRBADDR) + Channel Number * 0x10 Bit Access Reset Bit Access Reset 31
23
Bit 15 Access Reset Bit Access Reset
7
30
22
14
6
29
21
13
5
28 27 DESCADDR[31:24]
20 19 DESCADDR[23:16]
11 12 DESCADDR[15:8]
4 3 DESCADDR[7:0]
26
18
10
2
25
17
9
1
24
16
8
0
Bits 31:0 DESCADDR[31:0]Next Descriptor Address This bit group holds the SRAM address of the next descriptor. The value must be 128-bit aligned. If the value of this SRAM register is 0x00000000, the transaction will be terminated when the DMAC tries to load the next transfer descriptor. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 412 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23. External Interrupt Controller (EIC) 23.1 Overview The External Interrupt Controller (EIC) allows external pins to be configured as interrupt lines. Each interrupt line can be individually masked and can generate an interrupt on rising, falling, both edges, or on high or low levels. Each external pin has a configurable filter to remove spikes. Also, each external pin can be configured to be asynchronous in order to wake-up the device from Sleep modes where all clocks have been disabled. External pins can generate an event. A separate Non-Maskable Interrupt (NMI) is supported. It has properties similar to the other external interrupts, but is connected to the NMI request of the CPU, enabling it to interrupt any other Interrupt mode. 23.2 Features Interrupt on Rising, Falling, or Both Edges Interrupt on High or Low Levels Up to four external pins (EXTINTx), plus one non-maskable pin (NMI) Dedicated, Individually Maskable Interrupt for Each Pin Asynchronous Interrupts for Sleep Modes Without Clock Filtering of External Pins Event Generation from EXTINTx 23.3 Block Diagram Figure 23-1. EIC Block Diagram EXTINTx NMI FILTENx SENSEx[2:0]
Filter Edge/Level Detection NMIFILTEN NMISENSE[2:0]
Filter Edge/Level Detection intreq_extint Interrupt inwake_extint evt_extint Wake Event intreq_nmi Interrupt inwake_nmi Wake 23.4 Signal Description Signal Name EXTINT[3..0]
Type Description Digital Input External interrupt pin 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 413 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC)
...........continued Signal Name Type Description NMI Digital Input Non-maskable interrupt pin One signal may be available on several pins. 23.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 23.5.1 I/O Lines Using the EICs I/O lines requires the I/O pins to be configured. 23.5.2 Power Management All interrupts are available down to STANDBY Sleep mode, but the EIC can be configured to automatically mask some interrupts in order to prevent device wake-up. The EIC will continue to operate in any Sleep mode where the selected source clock is running. The EICs interrupts can be used to wake up the device from Sleep modes. Events connected to the Event System can trigger other operations in the system without exiting Sleep modes. 23.5.3 Clocks The EIC bus clock (PB1_CLK) can be enabled and disabled by the CRU, the default state of PB1_CLK can be found in the CRU and PMD registers. Some optional functions need a peripheral clock, which can either be a generic clock (GCLK_EIC, for wider frequency selection) or a Ultra Low-Power 32 KHz clock (CLK_ULP32K, for highest power efficiency). One of the clock sources must be configured and enabled before using the peripheral. GCLK_EIC is configured and enabled in the CRU registers (see Clock and Reset (CRU) from Related Links). CLK_ULP32K is provided by the internal Ultra Low-Power (OSCULP32K) Oscillator in the CRU module. Both GCLK_EIC and CLK_ULP32K are asynchronous to the user interface clock (PB1_CLK). Due to this asynchronicity, writes to certain registers will require synchronization between the clock domains. Related Links 13. Clock and Reset Unit (CRU) 23.5.4 DMA Not applicable. 23.5.5 Interrupts There are several interrupt request lines, some (the number depends on the product variant) for the external interrupts (EXTINT) and one for Non-Maskable Interrupt (NMI). Each EXTINT interrupt request line is connected to the interrupt controller. Using the EIC interrupt requires the interrupt controller to be configured first. The NMI interrupt request line is connected to the interrupt controller, but does not require the interrupt to be configured. 23.5.6 Events The events are connected to the Event System. Using the events requires the Event System to be configured first. Related Links 28. Event System (EVSYS) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 414 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.5.7 Debug Operation When the CPU is halted in Debug mode, the EIC continues normal operation. If the EIC is configured in a way that requires it to be periodically serviced by the CPU through interrupts or similar, improper operation or data loss may result during debugging. 23.5.8 Register Access Protection All registers with write access can be write-protected optionally by the Peripheral Access Controller (PAC), except for the following registers:
Interrupt Flag Status and Clear register (INTFLAG) Non-Maskable Interrupt Flag Status and Clear register (NMIFLAG) Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. PAC write protection does not apply to accesses through an external debugger. 23.5.9 Analog Connections Not applicable. 23.6 Functional Description 23.6.1 Principle of Operation The EIC detects edge or level condition to generate interrupts to the CPU interrupt controller or events to the Event System. Each external interrupt pin (EXTINT) can be filtered using majority vote filtering, clocked by GCLK_EIC or by CLK_ULP32K. 23.6.2 Basic Operation 23.6.2.1 Initialization The EIC must be initialized in the following order:
1. 2. If required, configure the NMI by writing the Non-Maskable Interrupt Control register (NMICTRL). Enable GCLK_EIC or CLK_ULP32K when one of the following configurations is selected:
The NMI uses edge detection or filtering One EXTINT uses filtering One EXTINT uses edge detection One EXTINT uses debouncing GCLK_EIC is used when a frequency higher than 32 KHz is required for filtering. CLK_ULP32K is recommended when power consumption is the priority. For CLK_ULP32K, write a 1 to the Clock Selection bit in the Control A register (CTRLA.CKSEL). 3. Configure the EIC input sense and filtering by writing the Configuration register (CONFIG). 4. Enable the EIC by writing a 1 to CTRLA.ENABLE. The following bits are enable-protected, meaning that it can only be written when the EIC is disabled
(CTRLA.ENABLE=0):
Clock Selection bit in Control A register (CTRLA.CKSEL) The following registers are enable-protected:
Event Control register (EVCTRL) Configuration register (CONFIG) External Interrupt Asynchronous Mode register (ASYNCH) Debouncer Enable register (DEBOUNCEN) Debounce Prescaler register (DPRESCALER) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 415 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) Enable-protected bits in the CTRLA register can be written at the same time when setting CTRLA.ENABLE to 1, but not at the same time as CTRLA.ENABLE is being cleared. Enable-protection is denoted by the Enable-Protected property in the register description. See NMICTRL, CTRLA, CONFIG, ASYNCH, DEBOUNCEN, DPRESCALER, EVCTRL registers in the EIC Register Summary from Related Links. Related Links 23.7. EIC Register Summary 23.6.2.2 Enabling, Disabling and Resetting The EIC is enabled by writing a 1 to the Enable bit in the Control A register (CTRLA.ENABLE). The EIC is disabled by writing CTRLA.ENABLE to 0. The EIC is reset by setting the Software Reset bit in the Control register (CTRLA.SWRST). All registers in the EIC will be reset to their initial state, and the EIC will be disabled. 23.6.3 External Pin Processing Each external pin can be configured to generate an interrupt/event on edge detection (rising, falling or both edges) or level detection (high or low). The sense of external interrupt pins is configured by writing the Input Sense x bits in the Config n register (CONFIG.SENSEx). The corresponding interrupt flag (INTFLAG.EXTINT[x]) in the Interrupt Flag Status and Clear register (INTFLAG) is set when the interrupt condition is met. When the interrupt flag has been cleared in edge-sensitive mode, INTFLAG.EXTINT[x] will only be set if a new interrupt condition is met. In level-sensitive mode, when the interrupt has been cleared, INTFLAG.EXTINT[x] will be set immediately if the EXTINTx pin still matches the interrupt condition. Each external pin can be filtered by a majority vote filtering, clocked by GCLK_EIC or CLK_ULP32K. Filtering is enabled if the bit Filter Enable x in the Configuration n register (CONFIG.FILTENx) is written to 1. The majority vote filter samples the external pin three times with GCLK_EIC or CLK_ULP32K and outputs the value when two or more samples are equal. Table 23-1. Majority Vote Filter Samples [0, 1, 2]
Filter Output
[0,0,0]
[0,0,1]
[0,1,0]
[0,1,1]
[1,0,0]
[1,0,1]
[1,1,0]
[1,1,1]
0 0 0 1 0 1 1 1 When an external interrupt is configured for level detection and when filtering is disabled, detection is done asynchronously. Level detection does not require GCLK_EIC or CLK_ULP32K, but interrupt and events can still be generated. If filtering or edge detection is enabled, the EIC automatically requests GCLK_EIC or CLK_ULP32K to operate. The selection between these two clocks is done by writing the Clock Selection bits in the Control A register
(CTRLA.CKSEL). GCLK_EIC must be enabled in the CRU. In these modes the external pin is sampled at the EIC clock rate, thus pulses with duration lower than two EIC clock periods may not be properly detected. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 416 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) Figure 23-2. Interrupt Detection Latency by Modes (Rising Edge) The detection latency depends on the detection mode. Table 23-2. Detection Latency Detection Mode Latency (Worst Case) Level without filter Five PB1_CLK periods Level with filter Four GCLK_EIC/CLK_ULP32K periods + five PB1_CLK periods Edge without filter Four GCLK_EIC/CLK_ULP32K periods + five PB1_CLK periods Edge with filter Six GCLK_EIC/CLK_ULP32K periods + five PB1_CLK periods 23.6.4 Additional Features 23.6.4.1 Non-Maskable Interrupt (NMI) The non-maskable interrupt pin can also generate an interrupt on edge or level detection, but it is configured with the dedicated NMI Control register (NMICTRL). To select the sense for NMI, write to the NMISENSE bit group in the NMI Control register (NMICTRL.NMISENSE). NMI filtering is enabled by writing a '1' to the NMI Filter Enable bit
(NMICTRL.NMIFILTEN). If edge detection or filtering is required, enable GCLK_EIC or CLK_ULP32K. NMI detection is enabled only by the NMICTRL.NMISENSE value, and the EIC module is not required to be enabled. When an NMI is detected, the Non-maskable Interrupt flag in the NMI Flag Status and Clear register is set
(NMIFLAG.NMI). NMI interrupt generation is always enabled, and NMIFLAG.NMI generates an interrupt request when set. 23.6.4.2 Asynchronous Edge Detection Mode The EXTINT edge detection operates synchronously or asynchronously, as selected by the Asynchronous Control Mode bit for external pin x in the External Interrupt Asynchronous Mode register (ASYNCH.ASYNCH[x]). The EIC edge detection is operated synchronously when the Asynchronous Control Mode bit (ASYNCH.ASYNCH[x]) is 0
(default value). It is operated asynchronously when ASYNCH.ASYNCH[x] is written to 1. In Synchronous Edge Detection Mode, the external interrupt (EXTINT) or the non-maskable interrupt (NMI) pins are sampled using the EIC clock as defined by the Clock Selection bit in the Control A register (CTRLA.CKSEL). The External Interrupt flag (INTFLAG.EXTINT[x]) or Non-Maskable Interrupt flag (NMIFLAG.NMI) is set when the last sampled state of the pin differs from the previously sampled state. The EIC clock is needed in this mode. The Synchronous Edge Detection Mode can be used in Idle and Standby sleep modes. In Asynchronous Edge Detection Mode, the external interrupt (EXTINT) pins or the non-maskable interrupt (NMI) pins set the External Interrupt flag or Non-Maskable Interrupt flag (INTFLAG.EXTINT[x] or NMIFLAG) directly. The EIC clock is not needed in this mode. Note:The asynchronous edge detection mode can be used in Idle and Standby sleep modes. 23.6.4.3 Interrupt Pin Debouncing The external interrupt pin (EXTINT) edge detection can use a debouncer to improve input noise immunity. When selected, the debouncer can work in the synchronous mode or the asynchronous mode, depending on the 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 417 intreq_extint[x](edge detection / filter)intreq_extint[x](edge detection / no filter)intreq_extint[x](level detection / filter)intreq_extint[x](level detection / no filter)EXTINTxPB1_CLKGCLK_EICclear INTFLAG.EXTINT[x]No interruptNo interrupt PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) configuration of the ASYNCH.ASYNCH[x] bit for the pin. The debouncer uses the EIC clock as defined by the bit CTRLA.CKSEL to clock the debouncing circuitry. The debouncing time frame is set with the debouncer prescaler DPRESCALER.PRESCALERn, which provides the low frequency clock tick that is used to reject higher frequency signals. The debouncing mode for pin EXTINT x can be selected only if the Sense bits in the Configuration y register
(CONFIG.SENSEx) are set to RISE, FALL or BOTH. If the debouncing mode for pin EXTINT x is selected, the filter mode for that pin (CONFIG.FILTENx) can not be selected. The debouncer manages an internal valid pin state that depends on the external interrupt (EXTINT) pin transitions, the debouncing mode and the debouncer prescaler frequency. The valid pin state reflects the pin value after debouncing. The external interrupt pin (EXTINT) is sampled continously on EIC clock. The sampled value is evaluated on each low frequency clock tick to detect a transitional edge when the sampled value is different of the current valid pin state. The sampled value is evaluated on each EIC clock when DPRESCALER.TICKON=0 or on each low frequency clock tick when DPRESCALER.TICKON=1, to detect a bounce when the sampled value is equal to the current valid pin state. Transitional edge detection increments the transition counter of the EXTINT pin, while bounce detection resets the transition counter. The transition counter must exceed the transition count threshold as defined by the DPRESCALER.STATESn bitfield. In the synchronous mode the threshold is 4 when DPRESCALER.STATESn=0 or 8 when DPRESCALER.STATESn=1. In the asynchronous mode the threshold is 4. The valid pin state for the pins can be accessed by reading the register PINSTATE for both synchronous or asynchronous debouncing mode. Synchronous edge detection In this mode the external interrupt (EXTINT) pin is sampled continously on EIC clock. 1. 2. 3. A pin edge transition will be validated when the sampled value is consistently different of the current valid pin state for 4 (or 8 depending on bit DPRESCALER.STATESn) consecutive ticks of the low frequency clock. Any pin sample, at the low frequency clock tick rate, with a value opposite to the current valid pin state will increment the transition counter. Any pin sample, at EIC clock rate (when DPRESCALER.TICKON=0) or the low frequency clock tick (when DPRESCALER.TICKON=1), with a value identical to the current valid pin state will return the transition counter to zero. 4. When the transition counter meets the count threshold, the pin edge transition is validated and the pin state PINSTATE.PINSTATE[x] is changed to the detected level. The external interrupt flag (INTFLAG.EXTINT[x]) is set when the pin state PINSTATE.PINSTATE[x] is changed. 5. Figure 23-3. EXTINT Pin Synchronous Debouncing (Rising Edge) In the synchronous edge detection mode, the EIC clock is required. The synchronous edge detection mode can be used in Idle and Standby sleep modes. Asynchronous edge detection In this mode, the external interrupt (EXTINT) pin directly drives an asynchronous edges detector which triggers any rising or falling edge on the pin:
1. 2. 3. 4. 5. Any edge detected that indicates a transition from the current valid pin state will immediately set the valid pin state PINSTATE.PINSTATE[x] to the detected level. The external interrupt flag (INTFLAG.EXTINT[x] is immediately changed. The edge detector will then be idle until no other rising or falling edge transition is detected during 4 consecutive ticks of the low frequency clock. Any rising or falling edge transition detected during the idle state will return the transition counter to 0. After 4 consecutive ticks of the low frequency clock without bounce detected, the edge detector is ready for a new detection. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 418 CLK_EICCLK_PRESCALEREXTINTxPIN_STATEINTGLAGTRANSITIONLOWHIGHSet INTFLAG PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) Figure 23-4. EXTINT Pin Asynchronous Debouncing (Rising Edge) In this mode, the EIC clock is requested. The asynchronous edge detection mode can be used in Idle and Standby sleep modes. 23.6.5 DMA Operation Not applicable. 23.6.6 Interrupts The EIC has the following interrupt sources:
External interrupt (EXTINTx) pins. See Basic Operation from Related Links. Non-maskable interrupt (NMI) pin. See Non-Maskable Interrupt (NMI) from Related Links Each interrupt source has an associated Interrupt flag. The interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG) is set when an Interrupt condition occurs (NMIFLAG for NMI). Each interrupt, except NMI, can be individually enabled by setting the corresponding bit in the Interrupt Enable Set register (INTENSET = 1), and disabled by setting the corresponding bit in the Interrupt Enable Clear register (INTENCLR = 1). The status of enabled interrupts can be read from either INTENSET or INTENCLR. An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled, or the EIC is reset. See the INTFLAG register for details on how to clear Interrupt flags. The EIC has one interrupt request line for each external interrupt (EXTINTx) and one line for NMI. The user must read the INTFLAG (or NMIFLAG) register to determine which Interrupt condition is present. Notes:
1. 2. Interrupts must be globally enabled for interrupt requests to be generated. If an external interrupt (EXTINT) is common on two or more I/O pins, only one will be active (the first one programmed). Related Links 23.6.2. Basic Operation 23.6.4.1. Non-Maskable Interrupt (NMI) 23.6.7 Events The EIC can generate the following output events:
External event from pin (EXTINT0-3) Setting an Event Output Control register (EVCTRL.EXTINTEO) enables the corresponding output event. Clearing this bit disables the corresponding output event. For more details on configuring the event system, see Event System
(EVSYS) from Related Links. When the condition on pin EXTINTx matches the configuration in the CONFIG register, the corresponding event is generated, if enabled. Related Links 28. Event System (EVSYS) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 419 CLK_EICCLK_PRESCALEREXTINTxPIN_STATEINTGLAGTRANSITIONLOWHIGHSet INTFLAG PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.6.8 Sleep Mode Operation In sleep modes, an EXTINTx pin can wake up the device if the corresponding condition matches the configuration in the CONFIG register, and the corresponding bit in the Interrupt Enable Set register (INTENSET) is written to 1. Figure 23-5. Wake-up Operation Example (High-Level Detection, No Filter, Interrupt Enable Set) PB1_CLK EXTINTx intwake_extint[x]
intreq_extint[x]
wake from sleep mode clear INTFLAG.EXTINT[x]
23.6.9 Synchronization Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be synchronized when written or read. The following bits are synchronized when written:
Software Reset bit in control register (CTRLA.SWRST) Enable bit in control register (CTRLA.ENABLE) Required write synchronization is denoted by the "Write-Synchronized" property in the register description. See CTRLA from Related Links. Related Links 23.8.1. CTRLA 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 420 23.7 EIC Register Summary Offset Name Bit Pos. 7 6 5 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 4 CKSEL 3 2 1 0 ENABLE SWRST NMIASYNCH NMIFILTEN NMISENSE[2:0]
NMI ENABLE SWRST 0x00 0x01 0x02 0x03 CTRLA NMICTRL NMIFLAG Reserved 0x04 SYNCBUSY 0x08 EVCTRL 0x0C INTENCLR 0x10 INTENSET 0x14 INTFLAG 0x18 ASYNCH 0x1C CONFIG 0x20
... 0x2F Reserved 0x30 DEBOUNCEN 0x34 DPRESCALER 0x38 PINSTATE 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 FILTEN1 FILTEN3 SENSE1[2:0]
SENSE3[2:0]
FILTEN0 FILTEN2 SENSE0[2:0]
SENSE2[2:0]
TICKON 23.8 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers require synchronization when read and/or written. Synchronization is denoted by the Read-
Synchronized and/or Write-Synchronized property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 421 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) Some registers are enable-protected, meaning they can only be written when the module is disabled. Enable-
protection is denoted by the Enable-Protected property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 422 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Write-Synchronized CTRLA 0x00 0x00 Bit 7 6 5 Access Reset Bit 4 CKSELClock Selection 4 CKSEL RW 0 3 2 1 ENABLE RW 0 0 SWRST W 0 The EIC can be clocked either by GCLK_EIC (when a frequency higher than 32.768 KHz is required for filtering) or by CLK_ULP32K (when power consumption is the priority). This bit is not Write-Synchronized. Value 0 1 Description The EIC is clocked by GCLK_EIC. The EIC is clocked by CLK_ULP32K. Bit 1 ENABLEEnable Due to synchronization there is a delay between writing to CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRLA.ENABLE will read back immediately and the Enable bit in the Synchronization Busy register will be set (SYNCBUSY.ENABLE=1). SYNCBUSY.ENABLE will be cleared when the operation is complete. This bit is not Enable-Protected. This bit is Write-Synchronized. Value 0 1 Description The EIC is disabled. The EIC is enabled. Bit 0 SWRSTSoftware Reset Writing a 0 to this bit has no effect. Writing a 1 to this bit resets all registers in the EIC to their initial state, and the EIC will be disabled. Writing a 1 to CTRLA.SWRST will always take precedence, meaning that all other writes in the same write operation will be discarded. Due to synchronization there is a delay from writing CTRLA.SWRST until the Reset is complete. CTRLA.SWRST and SYNCBUSY.SWRST will both be cleared when the Reset is complete. This bit is not Enable-Protected. This bit is Write-Synchronized. Value 0 1 Description There is no ongoing reset operation. The reset operation is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 423 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.2 Non-Maskable Interrupt Control Name:
Offset:
Reset:
Property: PAC Write-Protection NMICTRL 0x01 0x00 Bit 7 6 5 Access Reset 4 NMIASYNCH R/W 0 3 NMIFILTEN R/W 0 2 R/W 0 1 NMISENSE[2:0]
R/W 0 0 R/W 0 Bit 4 NMIASYNCHNMI Asynchronous Edge Detection Mode The NMI edge detection can be operated synchronously or asynchronously to the EIC clock. Value 0 1 Description The NMI edge detection is synchronously operated. The NMI edge detection is asynchronously operated. Bit 3 NMIFILTENNon-Maskable Interrupt Filter Enable Value 0 1 Description NMI filter is disabled. NMI filter is enabled. Bits 2:0 NMISENSE[2:0]Non-Maskable Interrupt Sense Configuration These bits define on which edge or level the NMI triggers. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 -
0x7 Description No detection Rising-edge detection Falling-edge detection Both-edge detection High-level detection Low-level detection Reserved Name NONE RISE FALL BOTH HIGH LOW
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 424 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.3 Non-Maskable Interrupt Flag Status and Clear Name:
Offset:
Reset:
NMIFLAG 0x2 0x00 Bit 7 6 5 4 3 2 1 Access Reset Bit 0 NMINon-Maskable Interrupt 0 NMI RW 0 This flag is cleared by writing a '1' to it. This flag is set when the NMI pin matches the NMI sense configuration, and will generate an interrupt request. Writing a '0' to this bit has no effect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 425 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.4 Synchronization Busy Name:
Offset:
Reset:
SYNCBUSY 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 1 ENABLEEnable Synchronization Busy Status Value 0 1 Description Write synchronization for CTRLA.ENABLE bit is complete. Write synchronization for CTRLA.ENABLE bit is ongoing. 1 ENABLE R 0 0 SWRST R 0 Bit 0 SWRSTSoftware Reset Synchronization Busy Status Note: During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description Write synchronization for CTRLA.SWRST bit is complete. Write synchronization for CTRLA.SWRST bit is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 426 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.5 Event Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected EVCTRL 0x08 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 427 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.6 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x0C 0x00000000 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENSET). Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 428 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.7 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x10 0x00000000 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear (INTENCLR) register. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 429 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.8 Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
INTFLAG 0x14 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 430 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.9 External Interrupt Asynchronous Mode Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected ASYNCH 0x18 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 431 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.10 External Interrupt Sense Configuration Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected CONFIG 0x1C 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset Bit Access Reset 15 FILTEN3 RW 0 7 FILTEN1 RW 0 14 RW 0 6 RW 0 13 SENSE3[2:0]
RW 0 5 SENSE1[2:0]
RW 0 12 RW 0 4 RW 0 11 FILTEN2 RW 0 3 FILTEN0 RW 0 10 RW 0 2 RW 0 9 SENSE2[2:0]
RW 0 1 SENSE0[2:0]
RW 0 8 RW 0 0 RW 0 Bits 3, 7, 11, 15 FILTENxFilter Enable x [x=3..0]
Note: The filter must be disabled if the asynchronous detection is enabled. Value 0 1 Description Filter is disabled for EXTINT[x] input. Filter is enabled for EXTINT[x] input. Bits 0:2, 4:6, 8:10, 12:14 SENSExInput Sense Configuration x [x=3..0]
These bits define on which edge or level the interrupt or event for EXTINT[x] will be generated. Description Value No detection 0x0 Rising-edge detection 0x1 Falling-edge detection 0x2 Both-edge detection 0x3 High-level detection 0x4 Low-level detection 0x5 Reserved 0x6 -
0x7 Name NONE RISE FALL BOTH HIGH LOW
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 432 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.11 Debouncer Enable Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected DEBOUNCEN 0x30 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 433 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.12 Debouncer Prescaler Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected DPRESCALER 0x34 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 16 TICKONPin Sampler frequency selection This bit selects the clock used for the sampling of bounce during transition detection. Value 0 1 Description The bounce sampler is using GCLK_EIC. The bounce sampler is using the low frequency clock. 9 1 16 TICKON RW 0 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 434 PIC32CX-BZ2 and WBZ45 Family External Interrupt Controller (EIC) 23.8.13 Pin State Name:
Offset:
Reset:
PINSTATE 0x38 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 435 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24. Flash Memory 24.1 Overview The PIC32CX-BZ2 devices contain a single bank of Flash memory with their Program Flash Memory (PFM) partition and Boot Flash Memory (BFM) partition for storing user code or non-volatile data. The Flash controller is used to access the Flash memory. The peripheral bus interface is used for commands and configuration of the Flash controller. 24.2 Features Flash Controller PB-Bridge-D interface that provides access to the Flash controller registers AHB Initiator for bus hosted reads the row programming data from SRAM Write Protect for Program Flash (PFM) Single page protection resolution Protect Less Than Address Protect Greater Than or Equal to Address Individual page write protection for boot Flash (BFM) Error-correction code (ECC) support Supports chip and page erase Supports Single Word, Quad Word and row program options Supports flash Erase/Retry to increase Retention and Endurance Flash Memory 128-bit wide Flash Memory Access 4 Kbytes page size Row size is 1 KB (256 IW) Flash-based OTP (one-time-programmable) page The Flash controller allows the Flash memory to be accessed through the following methods:
1. Run-Time Self-Programming (RTSP) 2. Serial Wire Debug (SWD) programming using DSU (See Device Service Unit (DSU) from Related Links and PIC32CX-BZ2 Programming Specification.) Related Links 12. Device Service Unit (DSU) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 436 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.3 Functional Block Diagram Figure 24-1. Flash Memory Block Diagram NVMDATA3[31:0]
NVMDATA2[31:0]
NVMDATA1[31:0]
NVMDATA0[31:0]
r e f f u B B H A AHB Initiator Flash Controller Flash Wrapper Word/Quad word:0 Row:1 0 1 0 1 0 1 0 1 FC Program Data Buffer pgm data 3 pgm data 2 pgm data 1 pgm data 0 Row/Quad word 0:NVMADDR[3:2]
Word:2'b0 ECC Parity/Control NVMADDR[3:2]
NVMADDR[31:4]
11 10 01 00 Flash Memory Word 3 Word 2 Word 1 Word 0 24.4 Flash Memory Addressing Flash memory addressing uses physical addresses only. For more information on addressing, see Product Memory Mapping Overview from Related Links. Related Links 8. Product Memory Mapping Overview 24.5 Memory Configuration 24.5.1 Flash Memory Construction Flash memory is divided into pages. A page is the smallest unit of memory that can be erased at one time. Each page of memory is segmented into four rows. A row is the largest unit of memory that can be programmed at one 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 437 PIC32CX-BZ2 and WBZ45 Family Flash Memory time. A row consists of 64 Quad (128-bit) Word. Each Quad Word consists of a four instruction (32-bit) Word. Flash memory can be programmed in rows, Quad Word (128-bit) or Single Word (32-bit) units. Figure 24-2. Flash Construction Flash Bank consisting of n pages Flash Bank Page n Page 3 Page 2 Page 1 Page 0 Each page consists of 4 rows Each Quad Word consists of 4 instruction (32-bit) word Row 3 Row 2 Row 1 Row 0 Word 3 Word 1 Word 0 QW 63 QW 1 QW 0 Each row consists of 64 quad (128-bit) words 24.5.2 Flash Memory Organization The Device Flash memory is divided into two logical Flash partitions:
1. Main Program Flash Memory (PFM) 2. Boot Flash Boot/Configuration Flash Memory (BFM) a. b. Device/Boot Configuration Device and boot configuration data c. OTP (One Time Programmable) User system calibration data Each Flash section has a different protection status; refer to the following table. Table 24-1. Protection Status Flash Partition Memory Region Write Protection Erase Protection Chip Erase through DSU BFM Boot Flash Device/Boot Configuration OTP (One-Time-
Programmable) Yes. Page-wise Configurable Yes. Page-wise Configurable Erased Yes. Configurable Yes. Configurable Erased Yes. Configurable Always Erase protected. Can not be erased Not Erased PFM Program Flash Yes. Configurable Yes. Configurable Erased 24.6 Boot Flash Memory (BFM) Partitions 24.6.1 BFM Write Protection Pages in the BFM regions can be protected individually using bits in the NVMLBWP register. At Reset, all pages are in a write-protected state and must be disabled prior to performing any programming operations on the BFM regions. There is also an unlock bit, ULOCK(NVMLBWP[31]), that is set at Reset and can be cleared by the user software. When cleared, changes to write protection for that region can no longer be made. Once cleared, the ULOCK bit can only be set by a Reset. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 438 PIC32CX-BZ2 and WBZ45 Family Flash Memory The NVMLBWP write-protect register can only be changed when the unlock sequence is followed. See NVMKEY Register Unlocking Sequence from Related Links. Related Links 24.11. NVMKEY Register Unlocking Sequence 24.7 Program Flash Memory (PFM) Partitions 24.7.1 PFM Write Protection Write protection for the PFM region is implemented by pages, defined by the NVMPWPLT and NVMPWPGTE registers. The NVMPWP* registers define an area within the program space (PFM) that is write-protected. This write-protected address resolves to Flash page boundaries; therefore, the 12 LSBs for a 4 KB page Flash of any address written to the NVMPWP* registers are ignored. The width of each NVMPWP* address register is determined by the size of the Flash. The NVMPWPLT register is used to set the Program Flash pages lower than the provided address as write-protected. The NVMPWPGTE register is used to set the Program Flash pages greater than or equal to the provided address as write-protected. Therefore, a value of all 0s in the NVMPWPLT register and all 1s in the NVMPWPGTE register results in no region of Flash being write-protected (default state at Reset). There is also an unlock bit, ULOCK (NVMPWPLT [31] and NVMPWPGTE[31]), that is set at Reset and can be cleared by the user software. When cleared, changes to the write-protection of the PFM can no longer be made, including the ULOCK bit. The NVMPWPLT and NVMPWPGTE write-protected register can only be changed when the unlock sequence is followed. See NVMKEY Register Unlocking Sequence from Related Links. Related Links 24.11. NVMKEY Register Unlocking Sequence 24.8 Error Correcting Code (ECC) and Flash Programming The PIC32CX-BZ2 devices incorporate Error Correcting Code (ECC) features that detect and correct errors resulting in extended Flash memory life. For more details on this feature, see Prefetch Cache from Related Links. ECC is implemented in 128-bit Quad Flash Words or 32-bit Single Word. As a result, when programming Flash memory on a device where ECC is employed, the programming operation must be, at minimum, four instruction Words or in groups of four instruction Words. This is the reason that the Quad Word programming command exists and why row programming always programs multiples of four Words. For a given software application, ECC can be enabled at all times, disabled at all times or dynamically enabled using the ECCCTL Configuration bits in the CFGCON0 register. When ECC is enabled at all times, the Single Word NVMOP programming command does not function and the Quad Word is the smallest unit of memory that can be programmed. When ECC is disabled or enabled dynamically, both the Single Word and Quad Word programming NVMOP commands are functional and the programming method used determines how ECC is handled. In the case of dynamic ECC, if the memory was programmed with the Singe Word command, ECC is turned off for that Word, and, when it is read, no error correction is performed. If the memory was programmed with the Quad Word or Row Programming commands, ECC data is written and tested for errors (and corrected if needed) when read. The following table describes the different ECC scenarios. Table 24-2. ECC Programming Summary ECCCTL Setting Programming Operation Data Read Single Word Write Quad Word Write Row Write Disabled Allowed Allowed Allowed Enabled Not allowed Allowed Allowed ECC is never applied on a Flash read ECC is applied on every Flash Word read 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 439 PIC32CX-BZ2 and WBZ45 Family Flash Memory
...........continued ECCCTL Setting Programming Operation Data Read Single Word Write Quad Word Write Row Write Dynamic Allowed but when used, the programmed word is flagged to NOT USE ECC Writes ECC data and flags programmed words to USE ECC Writes ECC data and flags programmed words to USE ECC ECC is only applied on words that are flagged to USE ECC Note:When using dynamic ECC, all non-ECC locations must be programmed with the 32-bit Word programming command, while all ECC-enabled locations must be programmed with a 128-bit Quad Word or Row programming command. Divisions between ECC and non-ECC memory must be on even Quad Word boundaries (address bits 0 through 3 are equal to 0). Related Links 9. Prefetch Cache (PCHE) 24.9 Interrupts An interrupt is generated when the WR bit is cleared by the Flash Controller upon completion of a Flash program or erase operation. The interrupt event will cause a CPU interrupt if it was configured and enabled in the Nested Interrupt Vector Controller. See Nested Vector Interrupt Controller (NVIC) from Related Links for the vector mapping table. The interrupt occurs regardless of the outcome of the program or erase operation, successful or unsuccessful. The only exception is the No Operation (NOP) programming operation (NVMOP = 0), which is used to manually clear the error flags and does not create an interrupt event on completion but does clear the WR bit. The Flash Controller interrupts are not persistent, and, therefore, no additional steps are required to clear the cause or source of the interrupt. Once the Interrupt Controller is configured, the Flash event causes the CPU to jump to the vector assigned to the Flash event. The CPU starts executing the code at the vector address. The user software at this vector address must perform the required operations and, then, exit. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 24.9.1 Interrupts and CPU Stalling Code cannot be fetched by the CPU from the same Flash bank, either BFM or PFM, that is the target of the programming operation. When this operation is attempted, the CPU will cease to execute code (stall) while the programming operation is in progress. CPU code execution does not resume until the programming operation is complete, and, when this occurs, any pending interrupts, including those from the Flash Controller, will be processed in order of priority. Note:Code that is already loaded into the processor cache will continue to execute up to the point where an attempt is made to fetch code or data from the same Flash bank as the active programming operation. At this point the CPU will stall. The stalling of the CPU can also be avoided by placing any needed executable code in SRAM during Flash programming. 24.10 Error Detection The NVMCON register includes two bits for detecting error conditions during a program or erase operation. They are Low-Voltage detect error, LVDERR bit (NVMCON[12]), and Write Error, WRERR bit (NVMCON[13]). The WRERR is set each time the WR bit (NVMCON[15]) is set, initiating a programming operation. When the Flash operation is complete, indicated by hardware clearing the value of the WR bit (i.e., WR bit is set to 0), hardware will update the value in the WRERR bit to indicate if an error occurred. Firmware must check the value of the WR bit to 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 440 PIC32CX-BZ2 and WBZ45 Family Flash Memory see if the Flash operation completed before checking the value of the WRERR bit. When the WRERR bit is set, any future attempt to initiate programming or erase operation is ignored. WRERR must be cleared before commencing Flash program or erase operations. The LVDERR bit is set when a Brown-out Reset (BOR) occurs during a programming operation. The only Reset that clears the LVDERR bit is a Power-on Reset (POR). Other Reset types do not affect the LVDERR bit. When the LVDERR bit is set, any attempt to initiate programming or erase operation is ignored. The LVDERR bit must be cleared before commencing Flash program or erase operations. Both the WRERR and LVDERR bits must be cleared manually in software by initiating a Flash operation (setting WR) referred to as NOP (0x00) (see the NVMOP bit fields). Note:Executing the NVMOP NOP command clears WRERR, LVDERR and WR bits, but does not generate an interrupt event on completion. Table 24-3. Programming Error Cause and Effects Cause of Error Effect on Programming Erase Operation Indication A low-voltage event occurred during a programming sequence. The last programming or erase operation may not have completed. LVDERR = 1, WRERR = 1 A non-POR Reset occurred during programming. Programming or erase operation is aborted. WRERR = 1 Attempt to program or erase a page out of the Flash memory range. Erase or programming operation is not initiated. WRERR = 1 Attempt to erase or program a write-
protected PFM page. Erase or programming operation is not initiated. WRERR = 1 Attempt to erase or program a write-
protected BFM page. Operation occurs, but the page is not programmed or erased. WRERR = 0 Bus host error or row programming data underrun error during programming. Programming or erase operation is aborted. WRERR = 1 24.11 NVMKEY Register Unlocking Sequence Important register settings that could compromise the Flash memory if inadvertently changed are protected by a register unlocking sequence. This feature is implemented using the NVMKEY register. The NVMKEY register is a write-only register that is used to implement an unlock sequence to help prevent accidental writes or erasures of Flash memory. In some instances, the operation is also dependent on the setting of the WREN bit (NVMCON[14]), as shown in the following table. Table 24-4. NVMKEY Register Unlocking and WREN Operation WREN Setting Unlock Sequence Required Changing value of NVMOP[3:0]
(NVMCON[3:0]) Setting WR (NVMCON[15]) to start a write or erase operation Changing any fields in the NVMPWP* register Changing any fields in the NVMLBWP register 0 1 No Yes Yes Yes 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 441 PIC32CX-BZ2 and WBZ45 Family Flash Memory The following steps must be followed in the exact order as shown to enable writes to registers that require this unlock sequence:
1. Write 0x00000000 to NVMKEY. 2. Write 0xAA996655 to NVMKEY. 3. Write 0x556699AA to NVMKEY. 4. Write the value to the register NVMCON, NVMCON2, NVMPWP* or NVMLBWP requiring the unlock sequence. When using the unlock sequence to set or clear bits in the NVMCON register, as shown in Step 4, Steps 2 through 4 must be executed without any other activity on the peripheral bus that is in use by the Flash Controller. Interrupts and DMA transfers that access the same peripheral bus as the Flash Controller must be disabled. In addition, the operation in Step 4 must be atomic. The Set, Clear and Invert registers may be used, where applicable, for the target register in Step 4. The following code shows code written in the C language to initiate a NVM Operation (NVMOP) command. In this particular example, the WR bit is being set in the NVMCON register and, therefore, must include the unlock sequence. Initiate NVM Operation (System Unlock Sequence Example):
void NVMInitiateOperation(void)
// Disable Interrupts asm volatile(di%0 : =r(int_status));
uint32_t globalInterruptState= __get_PRIMASK();
// Disable Interrupts __disable_irq();
NVMKEY = 0x0;
NVMKEY = 0xAA996655;
NVMKEY = 0x556699AA;
NVMCONSET = 1 << 15;// must be an atomic instruction
// Restore Interrupts __set_PRIMASK(globalInterruptState);
Note:Once the unlock codes are written to the NVMKEY register, the next activity on the same peripheral bus as the Flash Controller will Reset the lock. As a result, only atomic operations can be used. Use of the NVMCONSET register sets the WR bit in a single instruction without changing other bits in the register. Using NVMCONbits.WR = 1 will fail, as this line of code compiles to a read-modify-write sequence. 24.12 Word Programming The smallest block of data that can be programmed in a single operation is one Flash write Word (32-bit). The data to be programmed must be written to the NVMDATA0 register, and the address of the Word must be loaded into the NVMADDR register before the programming sequence is initiated. The instruction Word at the physical location pointed to by the NVMADDR register is, then, programmed. Programming occurs on 32-bit Word boundaries;
therefore, bits 0 and 1 of the NVMADDR register are ignored. When a Word is programmed, it must be erased before it can be programmed again, even if changing a bit from an erased 1 state to a 0 state. Word programming will only succeed if the target address is in a page that is not write-protected. Programming to a write-protected PFM page will fail and result in the WRERR bit being set in the NVMCON register. Programming a write-protected BFM page will fail but does not set the WRERR bit. A programming sequence consists of the following steps:
1. Write 32-bit data to be programmed to the NVMDATA0 register. 2. 3. Load the NVMADDR register with the address to be programmed. Set the WREN bit = 1 and NVMOP bits = 1 in the NVMCON register. This defines and enables the programming operation. Initiate the programming operation. (See NVMKEY Register Unlocking Sequence from Related Links.) 4. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 442 PIC32CX-BZ2 and WBZ45 Family Flash Memory 5. Monitor the WR bit of the NVMCON register to flag completion of the operation. 6. Clear the WREN bit in the NVMCON register. 7. Check for errors and process accordingly. The following code shows code for Word programming, where a value of 0x12345678 is programmed into location 0x1008000. Word Programming Code Example:
// Set up Address and Data Registers NVMADDR= 0x1008000; // physical address NVMDATA0 = 0x12345678; // value
// set the operation, assumes WREN = 0 NVMCONbits.NVMOP = 0x1; // NVMOP for Word programming
// Enable Flash for write operation and set the NVMOP NVMCONbits.WREN = 1;
// Start programming NVMInitiateOperation(); // see Initiate NVM Operation (Unlock Sequence Example)
// Wait for WR bit to clear while (NVMCONbits.WR);
// Disable future Flash Write/Erase operations NVMCONbits.WREN = 0;
// Check Error Status if(NVMCON & 0x3000) // mask for WRERR and LVDERR
// process errors
Related Links 24.11. NVMKEY Register Unlocking Sequence 24.13 Quad Word Programming The process for Quad Word programming is identical to Word programming except that all four of the NVMDATAx registers are used. The value of the NVMDATA0 register is programmed at address NVMADDR, NVMDATA1 at NVMADDR + 0x4, NVMDATA2 at NVMADDR + 0x8, and NVMDATA3 at address NVMDATA + 0xC. Quad Word programming is always performed on a Quad Word boundary; therefore, NVMADDR address bits 3 through 0 are ignored. Quad Word programming will only succeed if the target address is in a page that is not write-protected. When a Quad Word is programmed, it must be erased before any Word in it can be programmed again, even if changing a bit from an erased 1 state to a 0 state. Where a value of 0x11111111 is programmed into location 0x1008000, 0x22222222 into 0x1008004, 0x33333333 into 0x1008008, and 0x44444444 into location 0x100800C. Refer to the following code example for details. Quad Word Programming Code Example:
// Set up Address and Data Registers NVMADDR = 0x1008000; // physical address NVMDATA0 = 0x11111111; // value written to 0x1008000 NVMDATA1 = 0x22222222; // value written to 0x1008004 NVMDATA2 = 0x33333333; // value written to 0x1008008 NVMDATA3 = 0x44444444; // value written to 0x100800C
// set the operation, assumes WREN = 0 NVMCONbits.NVMOP = 0x2; // NVMOP for Quad Word programming 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 443 PIC32CX-BZ2 and WBZ45 Family Flash Memory
// Enable Flash for write operation and set the NVMOP NVMCONbits.WREN = 1;
// Start programming NVMInitiateOperation(); // see Initiate NVM Operation (Unlock Sequence Example)
// Wait for WR bit to clear while(NVMCON & NVMCON_WR);
// Disable future Flash Write/Erase operations NVMCONbits.WREN = 0;
// Check Error Status if(NVMCON & 0x3000) // mask for WRERR and LVDERR bits 24.14 Row Programming The largest block of data that can be programmed is a row. Unlike Word and Quad Word Programming where the data source is stored in SFR memory, Row programming source data is stored in SRAM. The NVMSRCADDR register is a pointer to the physical location of the source data for Row programming. Like other Non-Volatile Memory (NVM) programming commands, the NVMADDR register points to the target address of the operation. Row programming always occurs on row boundaries with the row size of 1024, bits 0 through 9 of the NVMADDR register are ignored. Row Word programming will only succeed if the target address is in a page that is not write-protected. When a row is programmed, it must be erased before any Word in it can be programmed again, even if changing a bit from an erased 1 state to a 0 state. Array rowbuff is populated with data and programmed into a row located at physical address 0x1008000. Note:When assigning the value to the NVMSRCADDR register, it must be converted to a physical address. Row Programming Code Example:
unsigned long rowbuff[256]; // example is for a 256 Word row size. int x; // loop counter
// put some data in the source buffer for (x = 0; x < (sizeof(rowbuff) * sizeof (int)); x++)
((char *)rowbuff)[x] = x;
// set destination row address NVMADDR = 0x1008000; // row physical address
// set source address. Must be converted to a physical address. NVMSRCADDR = (unsigned int)((int)rowbuff & 0x1FFFFFF);
// define Flash operation NVMCONbits.NVMOP = 0x3; // NVMOP for Row programming
// Enable Flash Write NVMCONbits.WREN = 1;
// commence programming NVMInitiateOperation(); // see Initiate NVM Operation (Unlock Sequence Example)
// Wait for WR bit to clear while(NVMCONbits.WR);
// Disable future Flash Write/Erase operations NVMCONbits.WREN = 0;
// Check Error Status if(NVMCON & 0x3000) // mask for WRERR and LVDERR bits
// process errors 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 444 PIC32CX-BZ2 and WBZ45 Family Flash Memory
24.15 Page Erase A Page Erase performs an erase of a single page of either PFM or BFM. The page to be erased is selected using the NVMADDR register. Pages are always erased on page boundaries;
therefore, for a device with an instruction Word page size of 4096, bits 0 through 11 of the NVMADDR register are ignored. A Page Erase will only succeed if the target address is a page that is not write-protected. Erasing a write-protected page will fail and result in the WRERR bit being set in the NVMCON register. The following code shows the code for a single Page Erase operation at address 0x1008000. Page Erase Code Example:
// set destination page address NVMADDR = 0x1008000; // page physical address
// define Flash operation NVMCONbits.NVMOP = 0x4; // NVMOP for Page Erase
// Enable Flash Write NVMCONbits.WREN = 1;
// commence programming NVMInitiateOperation(); // see Initiate NVM Operation (Unlock Sequence Example)
// Wait for WR bit to clear while(NVMCONbits.WR);
// Disable future Flash Write/Erase operations NVMCONbits.WREN = 0;
// Check Error Status if(NVMCON & 0x3000) // mask for WRERR and LVDERR bits
// process errors
24.15.1 Page Erase Retry Page Erase Retry is a method to improve the life of a Flash by attempting to erase again if the Page Erase was not successful. Page Erase Retry can only be used for a Page Erase. Page Erase Retry works by increasing the voltage used on the Flash when erasing. Initially, the minimum voltage necessary is applied by setting the RETRY[1:0] bits (NVMCON2[9:8]) = 00. If the page erase is not successful, the voltage may be increased by incrementing the setting of the RETRY[1:0] bits. Note:Each Flash page, as it ages and wears, may have different voltage requirements; therefore, a higher setting on one Flash page does not indicate that the same setting must be used on all pages. The maximum voltage for Page Erase is used when the RETRY[1:0] bits = 11. If Page Erase is not successful after 7 trials, this means that the Flash for that page, or the Words that did not erase, must be considered non-functional. Together with the normal Page Erase controls, Page Erase Retry also uses the WS[4:0], CREAD1, VREAD1 and RETRY[1:0] bits in the NVMCON2 register. The ERS[3:0] bits (NVMCON2[31:28]) are for the benefit of software performing the programming sequence in the event that a drop in power causes a BOR event but not a POR event. Perform the following steps to set up a Page Erase Retry:
1. 2. 3. Set the NVMADDR register with the address of the page to be erased. Execute the write unlock sequence. Save the value of the NVMCON2 register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 445 PIC32CX-BZ2 and WBZ45 Family Flash Memory 4. Do the following in the NVMCON2 register:
a. b. c. d. e. Set the ERS[3:0] bits as desired. Set the WS[4:0] bits per the description. Set the VREAD1 bit to 1. Set the CREAD1 bit to 1. Set the RETRY[1:0] bits to 00. 5. Run the unlock sequence using the Page Erase command to start the sequence. 6. Wait for the WR bit (NVMCON[15]) to be cleared by hardware. 7. Clear the WREN bit (NVMCON[14]). 8. Verify the erase using the CPU. To shorten the verify time, use CREAD1 = 1 to perform a hardware compare to logic 1 of each bit in the Flash Word including ECC. A successful compare yields a read of 0x00000001 in the lowest addressed word in a Flash Word (128 bits). This is the Compare Word. All other Words are 0x00010000. If any bit is logic 0, all Words in the Flash Word read 0x00000000. Remember to increment the address by the number of bytes in a Flash Word between reads. If all Compare Words verify correctly, the Page Erase Retry process is complete. Go to step 11. If a Compare Word yields a read of 0x00000000, perform steps 4 through 9 up to six more times with the following change to step 4:
a. Increment the RETRY[1:0] bits by one if the bit has not already reached the 11 setting. 9. 10. b. Maintain all other fields. 11. Restore the value of the NVMCON2 register, which was saved in step 3. Notes:
1. When the VREAD1 = 1, the Flash uses the WS[3:0] bits for Flash access wait state generation to the panel selected by NVMADDR. Software is responsible for writing the VREAD1 bit back to 0 when both erase and verify is complete. The device configuration boot page (the page containing the DEVCFGx values) does not support Page Erase Retry. 2. The following code provides code for a single page erase operation at address 0x1008000, where Page Erase Retry is used. Page Erase Retry Code Example:
uint32_tsaveNVMCON2;
uint32_t*cmpPtr;
uint8_terased;
uint8_ttryCount;
// set destination page address NVMADDR = 0x1008000; // Page physical address
// define flash operation NVMCONbits.NVMOP = 0x4; // NVMOP for Page Erase
// Unlock sequence NVMKEY = 0x0;
NVMKEY = 0xAA996655;
NVMKEY = 0x556699AA;
// save NVMCON2 saveNVMCON2 = NVMCON2;
// set up Page Erase Retry NVMCON2bits.ERS = 0; // Stage 0 - SW use only NVMCON2bits.VREAD1 = 1;
NVMCON2bits.CREAD1 = 1;
NVMCON2bits.RETRY = 0b00;
tryCount = 0; // Up to 4 attempts do {
tryCount++;
// commence programming 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 446 PIC32CX-BZ2 and WBZ45 Family Flash Memory NVMInitiateOperation();
// Wait for WR bit to clear while(NVMCONbits.WR);
// Turn off WREN NVMCONbits.WREN = 0;
// Check that the page was erased erased = 1;
cmpPtr = (uint32_t *)NVMADDR;
erased &= (*cmpPtr == 0x00000001);
cmpPtr++;
erased &= (*cmpPtr == 0x00010000);
cmpPtr++;
erased &= (*cmpPtr == 0x00010000);
cmpPtr++;
erased &= (*cmpPtr == 0x00010000);
if (!erased) {
// Erase failed. Try with different settings. NVMCON2bits.RETRY++;
NVMCONbits.NVMOP = 0x4;
NVMCONbits.WREN = 1;
} while (!erased && (tryCount < 4));
// Restore settings NVMCON2 = saveNVMCON2;
24.16 Program Flash Memory (PFM) Erase Program Flash memory can be erased entirely. All three discrete NVMOP values, 0111, 0110, 0101, do the same operation of erase of entire Flash. When erasing the entire PFM area, in case of RTSP (Run Time Self Programming), the code must be executing from BFM. When erasing the entire PFM area, PFM write-protection must be completely disabled. The following code shows code for erasing the entire Flash bank. Program Flash Erase Code Example:
// define Flash operation NVMCONbits.NVMOP = 0x7; // NVMOP for entire PFM erase
// Enable Flash Write NVMCONbits.WREN = 1;
// commence programming NVMInitiateOperation(); // see Initiate NVM Operation (Unlock Sequence Example)
// Wait for WR bit to clear while(NVMCONbits.WR);
// Disable future Flash Write/Erase operations NVMCONbits.WREN = 0;
// Check Error Status if(NVMCON & 0x3000) // mask for WRERR and LVDERR bits
// process errors
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 447 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.17 Pre-Program The PIC32CX-BZ2 Flash supports an option to programming that increases endurance and retention. This feature is called Pre-Program, and it requires the user to perform the programming operation twice, first, with NVMCON2.NVMPREPG = 1 and, secondly, with NVMCON2.NVMPREPG = 0. Any of the programming operations
(Single, Quad, Row) can be performed with this method. In all other respects, the SFR setup is identical. To use this feature, set or clear the NVMCON2.NVMPREPG SFR bit prior to setting the NVMWR bit. Pre-Program, typically double, the native Endurance and Retention of the Flash. 24.18 Device Code Protection bit (CP) The PIC32CX-BZ2 family of devices features code protection, which, when enabled, prevents reading of the Flash memory by an external programming device (SWD through DSU). When code protection is enabled, it can only be disabled by erasing the device with the Chip Erase command through an external programmer. See Device Service Unit (DSU) from Related Links. When programming a device that has opted to utilize code protection, the external programming device must perform verification prior to enabling code protection. Enabling code protection must be the last step of the programming process. For the location of the code protection enable bits, refer to PIC32CX-BZ2 Programming Specification and System Configuration Registers (CFG) from Related Links. Related Links 12. Device Service Unit (DSU) 18. System Configuration and Register Locking (CFG) 24.19 Operation in Power-Saving Modes The Flash Controller does not operate in power-saving modes. If a WAIT instruction is encountered when programming, the CPU will stop execution (stall), wait for the programming operation to complete, then enter the Power-Saving mode. 24.20 Operation in Debug Mode Programming operations will continue to completion if the processor execution is halted in Debug mode. 24.21 Effects of Various Resets Device Resets, other than a Power-on Reset (POR), reset the entire contents of the NVMPWP and NVMLBWP registers. All other register content persists through a non-POR reset. All Flash Controller registers are forced to their reset states upon a POR. 24.22 Control Registers Note:The following conventions are used in the following registers:
R = Readable bit W = Writable bit U = Unimplemented bit, read as 0 1= Bit is set 0= Bit is cleared x = Bit is unknown
-n = Value at POR 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 448 PIC32CX-BZ2 and WBZ45 Family Flash Memory HS = Hardware Set HC = Hardware Cleared Note:All registers in this table have corresponding CLR, SET and INV registers at its virtual address, plus an offset of 0x4, 0x8 and 0xC, respectively. See CLR, SET and INV Registers from Related Links. Related Links 6.1.9. CLR, SET and INV Registers 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 449 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.1 Register Summary The following registers provides a brief summary of the Flash programming-related registers. Offset Name Bit Pos. 7 6 5 4 3 2 1 0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 0x00 NVMCON 0x04
... 0x0F Reserved 0x10 NVMCON2 0x14
... 0x1F Reserved 0x20 NVMKEY 0x24
... 0x2F Reserved 0x30 NVMADDR 0x34
... 0x3F Reserved 0x40 NVMDATA0 0x44
... 0x4F Reserved 0x50 NVMDATA1 0x54
... 0x5F Reserved 0x60 NVMDATA2 0x64
... 0x6F Reserved 0x70 NVMDATA3 0x74
... 0xBF Reserved WR WREN WRERR LVDERR HTDPGM NVMOP[3:0]
TEMP CREAD1 VREAD1 ERS[3:0]
WS[4:0]
NVMPREPG RETRY[1:0]
SLEEP NVMKEY[7:0]
NVMKEY[15:8]
NVMKEY[23:16]
NVMKEY[31:24]
NVMADDR[7:0]
NVMADDR[15:8]
NVMADDR[23:16]
NVMADDR[31:24]
NVMDATA[7:0]
NVMDATA[15:8]
NVMDATA[23:16]
NVMDATA[31:24]
NVMDATA[7:0]
NVMDATA[15:8]
NVMDATA[23:16]
NVMDATA[31:24]
NVMDATA[7:0]
NVMDATA[15:8]
NVMDATA[23:16]
NVMDATA[31:24]
NVMDATA[7:0]
NVMDATA[15:8]
NVMDATA[23:16]
NVMDATA[31:24]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 450 PIC32CX-BZ2 and WBZ45 Family Flash Memory
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0xC0 NVMSRCADDR 0xC4
... 0xCF Reserved 0xD0 NVMPWPLT 0xD4
... 0xDF Reserved 0xE0 NVMPWPGTE 0xE4
... 0xEF Reserved 0xF0 NVMLBWP 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 24.22.2 Register Description ULOCK ULOCK ULOCK NVMSRCADDR[7:0]
NVMSRCADDR[15:8]
NVMSRCADDR[23:16]
NVMSRCADDR[31:24]
PWPLT[7:0]
PWPLT[15:8]
PWPLT[23:16]
PWPGTE[7:0]
PWPGTE[15:8]
PWPGTE[23:16]
LBWP[7:0]
LBWP[15:8]
LBWP[23:16]
Flash program, erase, and write protection operations are controlled using the following Non-Volatile Memory (NVM) control registers:
NVMCON: Programming Control Register This register is the control register for Flash program/erase operations. This register is used to select the operation to be performed, initiate the operation, and provide status of the result when the operation is complete. NVMCON2: Programming Control2 Register This register is the control and status register for Flash program/erase operations. NVMKEY: Programming Unlock Register This is a write-only register that is used to implement an unlock sequence to help prevent accidental writes/
erasures of Flash memory and write permission settings. NVMADDR: Flash Address Register This register is used to store the physical target address for row, Quad Double Word and Single Double Word programming as well as page erasing. NVMDATAx: Flash Program Data Register (x = 0-3) These registers hold the data to be programmed during Flash Word program operations. NVMSRCADDR: Source Data Address Register This register is used to point to the physical address of the data to be programmed when executing a row program operation. NVMPWPLT: Flash Program Write Protect Lower Register This register is used to set the program flash pages lower than provided address as a write protected. NVMPWPGTE: Flash Program Write Protect Greater Register This register is used to set the program flash pages greater than provided address as a write protected. NVMLBWP: Flash Boot Write Protect Register This register is used to set the boot flash partition pages as a write protected. Following conventions are used in the register description:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 451 PIC32CX-BZ2 and WBZ45 Family Flash Memory R = Readable bit W = Writable bit U = Unimplemented bit, read as 0
-n = Value at POR 1 = Bit is set 0 = Bit is cleared x = Bit is unknown HS = Hardware Set HC = Hardware Cleared 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 452 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.1 NVMCON Programming Control Register Name:
Offset:
Reset:
Property:
NVMCON 0x00 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset 15 WR R/HS/HC 0 14 WREN R/W 0 13 WRERR R/HS/HC 0 12 LVDERR R/HS/HC 0 11 10 Bit 7 6 5 4 Access Reset Bit 15 WRWrite Control Bit(1) 3 R/W 0 9 1 2 NVMOP[3:0]
R/W 0 R/W 0 8 HTDPGM R/HS/HC 0 0 R/W 0 Note:This field can only be modified when WREN = 1, TEMP = 1 and the NVMKEY unlock sequence is satisfied. Value 1 0 Description Initiate a Flash operation. Hardware clears this bit when the operation completes Flash operation complete or inactive Bit 14 WRENWrite Enable Bit(1) Value 1 0 Description Enables writes to WR Disables writes to WR Bit 13 WRERRWrite Error Bit(1) Note:Cleared by setting NVMOP == 0000b and initiating a Flash operation (WR). Value 1 0 Description Program or erase sequence did not complete successfully Program or erase sequence completed normally Bit 12 LVDERRLow Voltage Detect Error Bit(1) The error is only captured for programming/erase operations (when WR = 1). Note:Cleared by setting NVMOP == 0000b and initiating a Flash operation (WR). Value 1 0 Description Low voltage is detected (possible data corruption if WRERR is set) Normal voltage is detected Bit 8 HTDPGMHigh Temperature Detected during Program/Erase Operation bit This status is only captured for programming/erase operations (when WR = 1). Note:Cleared by setting NVMOP == 0000b and initiating a Flash operation (WR). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 453 PIC32CX-BZ2 and WBZ45 Family Flash Memory Value 1 0 Description High temperature is detected (possible data corruption, verify operation) High temperature is not detected Bits 3:0 NVMOP[3:0]NVM Operation bits These bits are only writable when WREN = 0. Value 1111 1110 Description Reserved Chip Erase Operation: Erases PFM, BFM (except configuration page) when accessed through SWD interface only. .. .. .. 1000 0111 0110 0101 0100 0011 0010 0001 0000 Notes:
Reserved Program erase operation: erase all of program Flash memory (PFM) (all pages must be unprotected) Upper program Flash memory erase operation: erases only the upper mapped region of program Flash
(all pages in that region must be unprotected). It is a single bank Flash in PIC32CX-BZ2; therefore, this NVMOP performs the same as NVMOP = 0111. Lower program Flash memory erase operation: erases only the lower mapped region of program Flash
(all pages in that region must be unprotected). It is a single bank Flash in PIC32CX-BZ2; therefore, this NVMOP performs the same as NVMOP = 0111. Page erase operation: erases the page selected by NVMADDR if it is not write-protected. Row program operation: programs the row selected by NVMADDR if it is not write-protected. Quad Word (128-bit) program operation: programs the 128-bit Flash Word selected by NVMADDR if it is not write-protected. Word program operation: programs the Word selected by NVMADDR if it is not write-protected(2). No operation 1. 2. These bits are reset by a POR only and are not affected by other Reset sources. This operation results in a No Operation (NOP) when the Dynamic Flash ECC Configuration bits = 00
(ECCCTL[1:0](CFGCON0[29:28])), which enables ECC at all times. For all other ECCCTL[1:0] bit settings, this command will execute but will not write the ECC bits for the Word. It can cause DED (Double-bit Error Detected) errors if dynamic Flash ECC is enabled (ECCCTL[1:0] = 01). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 454 24.22.2.2 NVMCON2 Programming Control 2 Register Name:
Offset:
Reset:
Property:
NVMCON2 0x10 0x011F4000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset Bit 15 Access Reset ERS[3:0]
30 R/W 0 22 29 R/W 0 21 28 R/W 0 20 R/W 1 14 TEMP R 1 13 CREAD1 R/W 0 12 VREAD1 R/W 0 PIC32CX-BZ2 and WBZ45 Family Flash Memory 27 26 25 19 R/W 1 11 18 WS[4:0]
R/W 1 10 24 SLEEP R/W 1 16 R/W 1 8 R/W 0 RETRY[1:0]
0 NVMPREPG R/W 0 17 R/W 1 9 R/W 0 1 Bit 7 6 5 4 3 2 Access Reset Bits 31:28 ERS[3:0]Erase Retry State These bits are used by software to track the software state of the erase retry procedure in the event of a system Reset (NMCLR) or Brown-out Reset (BOR) event. Bit 24 SLEEPPower Down in Sleep mode Note:This field can only be modified when the NVMKEY unlock sequence is satisfied. Value 1 0 Description Configures Flash for power-down when the system is in Sleep mode Configures Flash for standby when the system is in Sleep mode Bits 20:16 WS[4:0]Flash Access Wait State Control for VREAD1 = 1 Notes:
1. When VREAD1 = 1, WS[4:0] only affects the memory containing NVMADDR[31:0]. This field can only be modified when the NVMKEY unlock sequence is satisfied. 2. Value 11111 11110
... 00010 00001 00000 Description 31 wait states (32 total system clocks) 30 wait states (31 total system clocks) 2 wait states (3 total system clocks) 1 wait state (2 total system clocks) 0 wait state (1 total system clock) Bit 14 TEMPOperating Temperature Control bit Bit 13 CREAD1Compare Read of Logic 1 bit Compare read 1 causes all bits in a Flash Word (including ECC if it exists) to be evaluated during the read. If all bits are 1, the lowest Word in the Flash Word evaluates to 0x0000_0001, all other Words are 0x0001_0000. If any bit is 0, the read evaluates to 0x0000_0000 for all Words in the Flash Word. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 455 PIC32CX-BZ2 and WBZ45 Family Flash Memory Notes:
1. When using erase retry in an ECC Flash system, CREAD1 = 1 must be used. 2. This field can only be modified when the NVMKEY unlock sequence is satisfied. Value 1 0 Description Compare read enabled only if VREAD1 = 1 Compare read disabled Bit 12 VREAD1Verify Read of logic 1 Control bit Notes:
1. When VREAD1 = 1, the Flash wait state control is from WS[4:0] for the memory containing NVMADDR[31:0]. 2. Using Page Erase Retry and Verify Read procedure increase the life of the Flash memory. 3. This field can only be modified when NVMCON.WR == 0 and the NVMKEY unlock sequence is satisfied. Value 1 0 Description Selects erase retry procedure with verify read Selects single erase without verify read Bits 9:8 RETRY[1:0]Erase Retry Control bit, only used when VREAD1 = 1 Note:This field can only be modified when NVMCON.WR == 0. Value 11 10 01 00 Description Erase strength for last retry cycle Erase strength for third retry cycle Erase strength for second retry cycle Erase strength for first retry cycle Bit 0 NVMPREPGNVM Pre-Program Control Bit Note:This field can only be modified when NVMCON.NVMWR= = 0. Value 1 0 Description Program Operations include the Pre-Program step Program Operations exclude the Pre-Program step 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 456 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.3 NVMKEY Programming Unlock Register Name:
Offset:
Reset:
Property:
NVMKEY 0x20 0x00000000
Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 W 0 23 W 0 15 W 0 7 W 0 30 W 0 22 W 0 14 W 0 6 W 0 29 W 0 21 W 0 13 W 0 5 W 0 28 27 NVMKEY[31:24]
W W 0 0 20 19 NVMKEY[23:16]
W W 0 0 12 11 NVMKEY[15:8]
W 0 4 W 0 W 0 3 W 0 NVMKEY[7:0]
26 W 0 18 W 0 10 W 0 2 W 0 25 W 0 17 W 0 9 W 0 1 W 0 24 W 0 16 W 0 8 W 0 0 W 0 Bits 31:0 NVMKEY[31:0]Unlock Register bits These bits are write-only and read 0 on any read. Note:This register is used as part of the unlock sequence to prevent inadvertent writes to the program Flash. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 457 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.4 NVMADDR Flash Address Register Name:
Offset:
Reset:
Property:
NVMADDR 0x30 0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 NVMADDR[31:24]
R/W 0 R/W 0 20 19 NVMADDR[23:16]
R/W 0 R/W 0 12 11 NVMADDR[15:8]
R/W 0 R/W 0 3 4 NVMADDR[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 NVMADDR[31:0]Flash (Word) Address bits Table 24-5. Flash (Word) Address Bits NVMOP Page Erase Row program Word program Quad Word program Notes:
Flash Address Bits Address identifies the page to erase Any address within a 4 Kbytes page boundary will cause the page to be erased Address identifies the row to program The value of the address must be aligned to a row boundary Address identifies the 32-bit Word to program NVMADDR[1:0] bits are ignored Must be aligned to a Word boundary Address identifies the 128-bit Quad Word to program NVMADDR[3:0] bits are ignored Must be aligned to a Quad Word boundary 1. Hardware prevents writes to this register when NVMCON.WR = 1. 2. For all other NVMOP[3:0] bit settings, the Flash address is ignored. For additional information on these bits, see the NVMCON register from Related Links. The bits in this register are reset by a POR only and are not affected by other Reset sources. 3. Related Links 24.22.2.1. NVMCON 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 458 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.5 NVMDATA0 Flash Program Data Register 0 Name:
Offset:
Reset:
Property:
NVMDATA0 0x40 0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 NVMDATA[31:24]
R/W 0 R/W 0 20 19 NVMDATA[23:16]
R/W 0 12 R/W 0 11 NVMDATA[15:8]
R/W 0 4 R/W 0 3 NVMDATA[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 NVMDATA[31:0]Flash Programming Data bits The value in this register is written to Flash when a program operation is commanded. Single Word program (32-bit) Writes NVMDATA0 to the target Flash address defined in NVMADDR[31:2]. Quad Word program (128-bit) Writes NVMDATA3:NVMDATA2:NVMDATA1:NVMDATA0 to the target Flash address defined in NVMADDR[31:4]. NVMDATA0 contains the Least Significant Instruction Word. Notes:
1. Hardware prevents writes to this register when NVMCON.WR = 1. 2. The bits in this register are reset on a POR only and are unaffected by other Reset sources. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 459 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.6 NVMDATA1 Flash Program Data Register 1 Name:
Offset:
Reset:
Property:
NVMDATA1 0x50 0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 NVMDATA[31:24]
R/W 0 R/W 0 20 19 NVMDATA[23:16]
R/W 0 12 R/W 0 11 NVMDATA[15:8]
R/W 0 4 R/W 0 3 NVMDATA[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 NVMDATA[31:0]Flash Programming Data bits The value in this register is written to Flash when a program operation is commanded. Single Word program (32-bit) Writes NVMDATA0 to the target Flash address defined in NVMADDR[31:2]. Quad Word program (128-bit) Writes NVMDATA3:NVMDATA2:NVMDATA1:NVMDATA0 to the target Flash address defined in NVMADDR[31:4]. NVMDATA0 contains the Least Significant Instruction Word. Notes:
1. Hardware prevents writes to this register when NVMCON.WR = 1. 2. The bits in this register are reset on a POR only and are unaffected by other Reset sources. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 460 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.7 NVMDATA2 Flash Program Data Register 2 Name:
Offset:
Reset:
Property:
NVMDATA2 0x60 0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 NVMDATA[31:24]
R/W 0 R/W 0 20 19 NVMDATA[23:16]
R/W 0 12 R/W 0 11 NVMDATA[15:8]
R/W 0 4 R/W 0 3 NVMDATA[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 NVMDATA[31:0]Flash Programming Data bits The value in this register is written to Flash when a program operation is commanded. Single Word program (32-bit) Writes NVMDATA0 to the target Flash address defined in NVMADDR[31:2]. Quad Word program (128-bit) Writes NVMDATA3:NVMDATA2:NVMDATA1:NVMDATA0 to the target Flash address defined in NVMADDR[31:4]. NVMDATA0 contains the Least Significant Instruction Word. Notes:
1. Hardware prevents writes to this register when NVMCON.WR = 1. 2. The bits in this register are reset on a POR only and are unaffected by other Reset sources. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 461 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.8 NVMDATA3 Flash Program Data Register 3 Name:
Offset:
Reset:
Property:
NVMDATA3 0x70 0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 NVMDATA[31:24]
R/W 0 R/W 0 20 19 NVMDATA[23:16]
R/W 0 12 R/W 0 11 NVMDATA[15:8]
R/W 0 4 R/W 0 3 NVMDATA[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 NVMDATA[31:0]Flash Programming Data bits The value in this register is written to Flash when a program operation is commanded. Single Word program (32-bit) Writes NVMDATA0 to the target Flash address defined in NVMADDR[31:2]. Quad Word program (128-bit) Writes NVMDATA3:NVMDATA2:NVMDATA1:NVMDATA0 to the target Flash address defined in NVMADDR[31:4]. NVMDATA0 contains the Least Significant Instruction Word. Notes:
1. Hardware prevents writes to this register when NVMCON.WR = 1. 2. The bits in this register are reset on a POR only and are unaffected by other Reset sources. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 462 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.9 NVMSRCADDR Source Data Address Register Name:
Offset:
Reset:
Property:
NVMSRCADDR 0xC0 0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 NVMSRCADDR[31:24]
R/W R/W 0 0 20 19 NVMSRCADDR[23:16]
R/W R/W 0 0 12 11 NVMSRCADDR[15:8]
R/W R/W 0 0 4 3 NVMSRCADDR[7:0]
R/W R/W 0 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 NVMSRCADDR[31:0]Source Data (Word) Address bits This is the system physical Word address of the data (in DRM) to be programmed into the Flash when NVMCON.NVMOP is set to row programming. Notes:
1. Hardware prevents writes to this register when NVMCON.WR = 1. 2. The bits in this register are reset on a POR only and are unaffected by other reset sources. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 463 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.10 NVMPWPLT Flash Program Write Protect Lower Register Name:
Offset:
Reset:
Property:
NVMPWPLT 0xD0 0x80000000
Bit Access Reset 31 ULOCK R/C 1 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 29 28 27 26 25 24 22 R/W 0 14 R/W 0 6 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 20 19 PWPLT[23:16]
R/W 0 12 R/W 0 11 PWPLT[15:8]
R/W 0 4 R/W 0 R/W 0 3 R/W 0 PWPLT[7:0]
18 R/W 0 10 R/W 0 2 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bit 31 ULOCKNVMPWPLT Register Unlock bit Notes:
1. 2. This field can only be modified when the NVMKEY unlock sequence is satisfied. This field can be cleared at the same time as writing to PWPLT[23:0]. Value 1 0 Description NVMPWPLT register is not locked and can be modified NVMPWPLT register is locked and cannot be modified Bits 23:0 PWPLT[23:0]Flash Program Write Protect Less Than Address Pages at Flash addresses less than this value are write-protected. Notes:
1. 2. This field can only be modified when the NVMKEY unlock sequence is satisfied, and ULOCK = 1. This is a byte address force to align to page boundaries. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 464 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.11 NVMPWPGTE Flash Program Write Protect Greater Register Name:
Offset:
Reset:
Property:
NVMPWPGTE 0xE0 0x80FFFFFF
Bit Access Reset 31 ULOCK R/C 1 Bit 23 Access Reset R/W 1 Bit 15 Access Reset R/W 1 Bit 7 Access Reset R/W 1 30 29 28 27 26 25 24 22 R/W 1 14 R/W 1 6 R/W 1 21 R/W 1 13 R/W 1 5 R/W 1 20 19 PWPGTE[23:16]
R/W 1 12 R/W 1 11 PWPGTE[15:8]
R/W 1 4 R/W 1 3 PWPGTE[7:0]
R/W 1 R/W 1 18 R/W 1 10 R/W 1 2 R/W 1 17 R/W 1 9 R/W 1 1 R/W 1 16 R/W 1 8 R/W 1 0 R/W 1 Bit 31 ULOCKNVMPWPGTE Register Unlock bit Notes:
1. 2. This field can only be modified when the NVMKEY unlock sequence is satisfied. This field can be cleared at the same time as writing to PWPGTE[23:0]. Value 1 0 Description NVMPWPGTE register is not locked and can be modified NVMPWPGTE register is locked and cannot be modified Bits 23:0 PWPGTE[23:0]Flash Program Write Protect Address Pages at Flash addresses greater than or equal to this value are write-protected. Notes:
1. 2. This field can only be modified when the NVMKEY unlock sequence is satisfied and ULOCK = 1. This is a byte address forced to align to page boundaries. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 465 PIC32CX-BZ2 and WBZ45 Family Flash Memory 24.22.2.12 NVMLBWP Flash Boot Write Protect Register Name:
Offset:
Reset:
Property:
NVMLBWP 0xF0 0x80FFFFFF
Bit Access Reset 31 ULOCK R/C 1 Bit 23 Access Reset R/W 1 Bit 15 Access Reset R/W 1 Bit 7 Access Reset R/W 1 30 29 28 27 26 25 24 22 R/W 1 14 R/W 1 6 R/W 1 21 R/W 1 13 R/W 1 5 R/W 1 20 19 LBWP[23:16]
R/W 1 12 R/W 1 4 R/W 1 LBWP[15:8]
LBWP[7:0]
R/W 1 11 R/W 1 3 R/W 1 18 R/W 1 10 R/W 1 2 R/W 1 17 R/W 1 9 R/W 1 1 R/W 1 16 R/W 1 8 R/W 1 0 R/W 1 Bit 31 ULOCKLower Boot Write Protect (LBWPn) Unlock bit Notes:
1. 2. This field can only be modified when the NVMKEY unlock sequence is satisfied. This field can be cleared at the same time as writing to LBWP[msb:lsb]. Value 1 0 Description LBWPn bits are not locked and can be modified LBWPn bits are locked and cannot be modified Bits 23:0 LBWP[23:0]Boot Pages Write Protect bits Notes:
1. 2. This field can only be modified when the NVMKEY unlock sequence is satisfied and ULOCK = 1. The OTP page is always erase-protected and its associated LBWP bit is only for write-protection. Value 1 0 Description Erase and write-protection for upper boot page n is enabled Erase and write-protection for upper boot page n is disabled 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 466 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25. Integrity Check Monitor (ICM) 25.1 Overview The Integrity Check Monitor (ICM) is a DMA controller that performs hash calculation over multiple memory regions using transfer descriptors located in memory (ICM Descriptor Area). The Hash function is based on the Secure Hash Algorithm (SHA). The ICM controller integrates two modes of operation. The first mode is used to hash a list of memory regions and save the digests to memory (ICM Hash Area). The second mode is an active monitoring of the memory. In this mode, the hash function is evaluated and compared to the digest located at a predefined memory address (ICM Hash Area). If a mismatch occurs, an interrupt is raised. 25.2 Features DMA AHB manager interface Supports monitoring of up to four non-contiguous memory regions Supports block gathering using a linked list Supports Secure Hash Algorithm (SHA1, SHA256) Compliant with FIPS Publication 180-2 Configurable processing period:
When SHA1 algorithm is processed, the run-time period is either 85 or 209 clock cycles When SHA256 algorithm is processed, the run-time period is either 72 or 194 clock cycles Programmable bus burden 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 467 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.3 Block Diagram Figure 25-1. Integrity Check Monitor Block Diagram APB Host Interface Configuration Registers SHA Hash Engine Context Registers Monitoring FSM Integrity Scheduler Host DMA Interface Bus Layer 25.4 Signal Description Not applicable. 25.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 25.5.1 Power Management 25.5.2 Clocks The ICM bus clocks (PB2_CLK) can be enabled and disabled in the CRU module or the PMD2.ICMMD bit. For more details, see Peripheral Module Disable Register (PMD) from Related Links. Related Links 20. Peripheral Module Disable Register (PMD) 25.5.3 DMA Not applicable. 25.5.4 Events Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 468 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.5.5 Debug Operation Not applicable. 25.6 Functional Description 25.6.1 Overview The Integrity Check Monitor (ICM) is a DMA controller that performs SHA-based memory hashing over memory regions. As shown in the Block Diagram (see Block Diagram from Related Links), it integrates a DMA interface, a Monitoring Finite State Machine (FSM), an integrity scheduler, a set of context registers, a SHA engine, an interface for configuration and status registers. The SHA engine requires a message padded according to FIPS180-4 specification when used as a SHA calculation unit only. Otherwise, if the ICM is used as an integrated check for memory content, the padding is not mandatory. The SHA module produces an N-bit message digest each time a block is read and a processing period ends. N is 160 for SHA1, 256 for SHA256. When the ICM module is enabled, it sequentially retrieves a circular list of region descriptors from the memory (Main List described in the following figure). Up to four regions may be monitored. Each region descriptor is composed of four words indicating the layout of the memory region (see Region Descriptor Structure from Related Links). It also contains the hashing engine configuration on a per region basis. As soon as the descriptor is loaded from the memory and context registers are updated with the data structure, the hashing operation starts. A programmable number of blocks (see TRSIZE field of the RCTRL structure member) is transferred from the memory to the SHA engine. When the desired number of blocks have transferred, the digest is either moved to memory (Write Back function) or compared with a digest reference located in the system memory (Compare function). If a digest mismatch occurs, an interrupt is triggered if enabled. The ICM module parses through the region descriptor list until the end of the list, marked by an end of list bit set to one. To continuously monitor the list of regions, the WRAP bit must be set to one in the last data structure, and EOM must be cleared. Figure 25-2. ICM Region Descriptor and Hash Areas Main List infinite loop when wrap bit is set WRAP=1 Region N Descriptor End of Region N Secondary List End of Region 1 List End of Region 0 ICM Descriptor Area - Contiguous Read-only Memory ICM Hash Area -
Contiguous Read-write once Memory WRAP=0 Region 1 Descriptor WRAP=0 Region 0 Descriptor Region N Hash Region 1 Hash Region 0 Hash 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 469 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) Each region descriptor supports gathering of data through the use of the Secondary List. Unlike the Main List, the Secondary List cannot modify the configuration attributes of the region. When the end of the Secondary List is encountered, the ICM returns to the Main List. Memory integrity monitoring can be considered a background service, and the mandatory bandwidth is very limited. To limit the ICM memory bandwidth, use the BBC field of the CFG register to control the ICM memory load. Figure 25-3. Region Descriptor Main List Region 3 Descriptor Region 2 Descriptor Region 1 Descriptor Region 0 Descriptor DSCR Optional Region 0 Secondary List End of Region 0 0x00C Region NEXT 0x00C Region NEXT 0x008 Region CTRL 0x008 Region CTRL 0x004 Region CFG 0x004 Unused 0x000 Region ADDR 0x000 Region ADDR Related Links 25.3. Block Diagram 25.6.3. Region Descriptor Structure 25.6.2 ICM Hash Area The ICM Hash Area is a contiguous area of system memory that the controller and the processor can access. The physical location is configured in the ICM hash area start address register. This address is a multiple of bytes. If the CDWBN bit of the context register is cleared (i.e., Write Back activated), the ICM controller performs a digest write operation at the following starting location: *(HASH) + (RID<<), where RID is the current region context identifier. If the CDWBN bit of the context register is set (i.e., Digest Comparison activated), the ICM controller performs a digest read operation at the same address. 25.6.2.1 Message Digest Example Considering the following 512 bits message (example given in FIPS 180-4):
61626380000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000018 The message is written to memory in a Little Endian (LE) system architecture. Memory Address Address Offset / Byte Lane 0x3 / 31:24 0x2 / 23:16 0x1 / 15:8 0x0 / 7:0 0x000 0x0040x038 0x03C 80 00 18 63 00 00 62 00 00 61 00 00 The digest is stored at the memory location pointed at by the ICM_HASH pointer with a Region Offset. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 470 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) Memory Address Address Offset / Byte Lane 0x000 0x004 0x008 0x00C 0x010 0x3 / 31:24 0x2 / 23:16 0x1 / 15:8 0x0 / 7:0 36 6a 71 6c 9d 3e 81 25 c2 d8 99 06 3e 50 d0 a9 47 ba 78 9c Memory Address Address Offset / Byte Lane 0x3 / 31:24 0x2 / 23:16 0x1 / 15:8 0x0 / 7:0 0x000 0x004 0x008 0x00C 0x010 0x014 0x018 22 22 77 b3 e4 f7 a7 7d d8 a4 55 bc b3 9d 09 05 42 a2 ad a0 6c 23 34 86 bd 2a bd e3 Memory Address Address Offset / Byte Lane 0x3 / 31:24 0x2 / 23:16 0x1 / 15:8 0x0 / 7:0 0x000 0x004 0x008 0x00C 0x010 0x014 0x018 0x01C bf ea de 23 a3 9c 61 ad 16 cf 40 22 61 7a ff 15 78 01 41 ae 03 17 10 00 ba 8f 41 5d b0 96 b4 f2 Considering the following 1024 bits message (example given in FIPS 180-4):
6162638000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000018 The message is written to memory in a Little Endian (LE) system architecture. Memory Address Address Offset / Byte Lane 0x3 / 31:24 0x2 / 23:16 0x1 / 15:8 0x0 / 7:0 0x000 0x0040x078 80 00 63 00 62 00 61 00 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 471 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM)
...........continued Memory Address Address Offset / Byte Lane 0x07C 18 00 00 00 0x3 / 31:24 0x2 / 23:16 0x1 / 15:8 0x0 / 7:0 25.6.3 Region Descriptor Structure The ICM Region Descriptor Area is a contiguous area of system memory that the controller and the processor can access. When the ICM controller is activated, the controller performs a descriptor fetch operation at the DSCR address. If the Main List contains more than one descriptor (i.e., more than one region is to be moderated), the fetch address is DSCR + RID<<4, where RID is the region identifier. Table 25-1. Region Descriptor Structure (Main List) Offset Structure Member DSCR+0x00+RID*(0x10) ICM Region Start Address DSCR+0x04+RID*(0x10) ICM Region Configuration DSCR+0x08+RID*(0x10) ICM Region Control DSCR+0x0C+RID*(0x10) ICM Region Next Address Name RADDR RCFG RCTRL RNEXT Example 25-1.ICM Monitoring of 3 Memory Data Blocks (Defined as 2 Regions) The following figure shows the mandatory ICM settings to monitor three memory data blocks of the system memory (defined as two regions), with one region being not contiguous (two separate areas) and one contiguous memory area. For each said region, the SHA algorithm may be independently selected (different for each region). The wrap allows continuous monitoring. Figure 25-4. Example Monitoring of 3 Memory Data Blocks (Defined as 2 Regions) System Memory, data areas System Memory, region descriptor structure Size of region1 block (S1) Size of region0 block 1
(S0B1) Size of region0 block 0
(S0B0) wrap=1 effect
@r1d 3 2 1 1
@r0db1 3 2 Single D ata R egion 1 Block D ata Block 1 R egion 0 D ata Block 0 R egion 0
@r0db0 NEXT=0 S1
@md+28
@md+24 wrap=1, etc
@r1d
@md+20
@md+16 NEXT=@sd S0B0 wrap=0, etc
@r0db0
@md+12
@md+8
@md+4
@md NEXT=0
@sd+12 S0B1
@sd+8 dont care
@sd+4
@r0db1
@sd Region 1 Single Descriptor Region 0 Main Descriptor Region 0 Second Descriptor 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 472 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.6.3.1 Region Descriptor Structure Overview Offset Name Bit Pos. 7 6 5 4 3 2 1 0 RADDR[7:0]
RADDR[15:8]
RADDR[23:16]
RADDR[31:24]
WCIEN BEIEN DMIEN RHIEN ALGO[2:0]
EOM PROCDLY WRAP SUIEN CDWBN ECIEN TRSIZE[7:0]
TRSIZE[15:8]
0x00 RADDR 0x04 RCFG 0x08 RCTRL 0x0C RNEXT 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 473 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.6.3.1.1 Region Start Address Structure Member Name:
Offset:
Reset:
Property: Read/Write RADDR 0x00 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 RADDR[31:24]
R/W 0 20 R/W 0 19 RADDR[23:16]
R/W 0 12 R/W 0 11 RADDR[15:8]
R/W 0 4 R/W 0 3 RADDR[7:0]
R/W 0 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 RADDR[31:0]Region Start Address This field indicates the first byte address of the region 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 474 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.6.3.1.2 Region Configuration Structure Member Name:
Offset:
Reset:
Property: Read/Write RCFG 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 Access Reset Bit Access Reset 7 WCIEN R/W 1 14 R/W 0 6 BEIEN R/W 1 13 ALGO[2:0]
R/W 0 5 DMIEN R/W 1 12 R/W 0 4 RHIEN R/W 1 11 3 10 PROCDLY R/W 0 2 EOM R/W 0 9 SUIEN R/W 1 1 WRAP R/W 0 8 ECIEN R/W 1 0 CDWBN R/W 0 Bits 14:12 ALGO[2:0]User SHA Algorithm Value 0 1 Other Name SHA1 SHA256
Description SHA1 algorithm processed SHA256 algorithm processed Reserved Bit 10 PROCDLYProcessing Delay For a given SHA algorithm, the runtime period has two possible lengths:
Table 25-2. SHA Processing Runtime Periods Algorithm SHA1 SHA256 SHORTEST [number of cycles]
LONGEST [number of cycles]
85 72 209 194 Value 0 1 Name SHORTEST LONGEST Description SHA processing runtime is the shortest one SHA processing runtime is the longest one Bit 9 SUIENMonitoring Status Updated Condition Interrupt Enable 0: The RSU flag is set when the corresponding descriptor is loaded from memory to ICM. 1: The RSU flag remains cleared even if the condition is met. Bit 8 ECIENEnd Bit Condition Interrupt Enable 0: The REC flag is set when the descriptor having the EOM bit set is processed. 1: The REC flag remains cleared even if the setting condition is met. Bit 7 WCIENWrap Condition Interrupt Disable 0: The RWC flag is set when the WRAP 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 475 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 1: The RWC flag remains cleared even if the setting condition is met. Bit 6 BEIENBus Error Interrupt Disable 0: The flag is set when an error is reported on the system bus by the bus MATRIX. 1: The flag remains cleared even if the setting condition is met. Bit 5 DMIENDigest Mismatch Interrupt Disable 0: The RBE flag is set when the hash value just calculated from the processed region dffers from expected hash value. 1: The RBE flag remains cleared even if the setting condition is met. Bit 4 RHIENRegion Hash Completed Interrupt Disable 0: The RHC flag is set when the field NEXT = 0 in a descriptor of the main or second list. 1: The RHC flag remains cleared even if the setting condition is met. Bit 2 EOMEnd of Monitoring 0: The current descriptor does not terminate the monitoring. 1: The current descriptor terminates the Main List. WRAP bit value has no effect. Bit 1 WRAPWrap Command 0: The next region descriptor address loaded is the current region identifier descriptor address incremented by 0x10. 1: The next region descriptor address loaded is DSCR. Bit 0 CDWBNCompare Digest or Write Back Digest 0: The digest is written to the Hash area. 1: The digest value is compared to the digest stored in the Hash area. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 476 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.6.3.1.3 Region Control Structure Member Name:
Offset:
Reset:
Property: R/W RCTRL 0x08 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 12 11 TRSIZE[15:8]
R/W 0 4 R/W 0 3 TRSIZE[7:0]
R/W 0 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 TRSIZE[15:0]Transfer Size for the Current Chunk of Data 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 477 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.6.3.1.4 Region Next Address Structure Member Name:
Offset:
Reset:
Property: Read/Write RNEXT 0x0C 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 25.6.4 Using ICM as an SHA Engine The ICM can be configured to only calculate a SHA1, SHA256 digest value. 25.6.4.1 Settings for Simple SHA Calculation 9 1 8 0 The start address of the system memory containing the data to hash must be configured in the transfer descriptor of the DMA embedded in the ICM. The transfer descriptor is a system memory area integer multiple of 4 x 32-bit word and the start address of the descriptor must be configured in DSCR (the start address must be aligned on 64-bytes; six LSB must be cleared). If the data to hash is already padded according to SHA standards, only a single descriptor is required, and the EOM bit of RCFGn must be written to 1. If the data to hash does not contain a padding area, it is possible to define the padding area in another system memory location, the ICM can be configured to automatically jump from a memory area to another one by writing the descriptor register RNEXT with a value that differs from 0. Writing the RNEXT register with the start address of the padding area forces the ICM to concatenate both areas, thus providing the SHA result from the start address of the hash area configured in HASH. Whether the system memory is configured as a single or multiple data block area, the bits CDWBN and WRAP must be cleared in the region descriptor structure member RCFGn. The bits WBDIS, EOMDIS, SLBDIS must be cleared in CFG. Write the bits RHIEN and ECIEN in the Region Configuration Structure Member (RCFGn) to 0:
The flag RHC[i], i being the region index, is set (if RHIEN is 0) when the hash result is available at address defined in HASH. The flag REC[i], i being the region index, is set (if ECIEN is 0) when the hash result is available at the address defined in HASH. An interrupt is generated if the bit RHC[i] is written to 1 in the IER (if RHC[i] is set in RCTRL of region i) or if the bit REC[i] is written to 1 in the IER (if REC[i] is set in RCTRL of region i). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 478 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.6.4.2 Processing Period The SHA engine processing period can be configured by writing to the Region Configuration Structure Member register (RCFGn). The short processing period allows to allocate bandwidth to the SHA module whereas the long processing period allocates more bandwidth on the system bus to other applications. In SHA mode, the shortest processing period is 85 clock cycles + 2 clock cycles for start command synchronization. The longest period is 209 clock cycles + 2 clock cycles. In SHA256 mode, the shortest processing period is 72 clock cycles + 2 clock cycles for start command synchronization. The longest period is 194 clock cycles + 2 clock cycles. 25.6.5 ICM Automatic Monitoring Mode The ASCD bit of the CFG register is used to activate the ICM Automatic Mode. When CFG.ASCD is set, the ICM performs the following actions:
The ICM controller passes through the Main List once with CDWBN bit in RCFGn at 0 (in other words, Write Back activated) and EOM bit in the RCFGn context register at 0. When RCFGn.WRAP=1, the ICM controller enters active monitoring, with CDWBN bit in context register now set, and EOM bit in context register cleared. Writing to the CDWBN and EOM bits in RCFGn has no effect. 25.6.6 ICM Configuration Parameters Transfer Type Main List RCFG RNEXT Comments CDWBN WRAP EOM NEXT Single Region Contiguous list of blocks 1 item 0 0 1 0 Digest written to memory Monitoring disabled Non-contiguous list of blocks 1 item 0 0 Digest written to memory Monitoring disabled Contiguous list of blocks Digest comparison enabled Monitoring enabled 1 item 1 1 The Main List contains only one descriptor. The Secondary List is empty for that descriptor. The digest is computed and saved to memory. 1 0 Secondary List address of the current region identifier The Main List contains only one descriptor. The Secondary List describes the layout of the non-
contiguous region. 0 When the hash computation is terminated, the digest is compared with the one saved in memory. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 479 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) RCFG RNEXT Comments CDWBN WRAP EOM NEXT 0 1 0 1 0 1 for the last, 0 otherwise 1 for the last, 0 otherwise 0 1 0 1 0 0 0 ICM passes through the list once. ICM performs active monitoring of the regions. If a mismatch occurs, an interrupt is raised. Secondary List address ICM performs hashing and saves digests to the Hash area. Secondary List address ICM performs data gathering on a per region basis. ..........continued Transfer Type Multiple Regions Contiguous list of blocks Digest written to memory Monitoring disabled Contiguous list of blocks Digest comparison is enabled Monitoring is enabled Main List More than one item More than one item Non-contiguous list of blocks Digest is written to memory Monitoring is disabled More than one item Non-contiguous list of blocks Digest comparison is enabled More than one item Monitoring is enabled 25.6.7 Security Features When an undefined register access occurs, the URAD bit in the Interrupt Status Register (ISR) is set if unmasked. Its source is then reported in the Undefined Access Status Register (UASR). Only the first undefined register access is available through the UASR.URAT field. Several kinds of unspecified register accesses can occur:
Unspecified structure member set to one detected when the descriptor is loaded Configuration register (CFG) modified during active monitoring Descriptor register (DSCR) modified during active monitoring Hash register (HASH) modified during active monitoring Write-only register read access The URAD bit and the URAT field can only be reset by writing a 1 to the CTRL.SWRST bit. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 480 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.7 Register Summary - ICM Offset Name Bit Pos. 7 6 5 4 3 2 1 BBC[3:0]
UALGO[2:0]
UIHASH SLBDIS EOMDIS DUALBUFF 0 WBDIS ASCD 0x00 CFG 0x04 CTRL 0x08 SR 0x0C
... 0x0F Reserved 0x10 IER 0x14 IDR 0x18 IMR 0x1C ISR 0x20 UASR 0x24
... 0x2F Reserved 0x30 DSCR 0x34 HASH 0x38 UIHVALx0 0x3C UIHVALx1 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 REHASH[3:0]
RMEN[3:0]
SWRST DISABLE ENABLE RMDIS[3:0]
RMDIS[3:0]
RAWRMDIS[3:0]
ENABLE RDM[3:0]
RWC[3:0]
RSU[3:0]
RDM[3:0]
RWC[3:0]
RSU[3:0]
RDM[3:0]
RWC[3:0]
RSU[3:0]
RDM[3:0]
RWC[3:0]
RSU[3:0]
DASA[1:0]
RHC[3:0]
RBE[3:0]
REC[3:0]
RHC[3:0]
RBE[3:0]
REC[3:0]
RHC[3:0]
RBE[3:0]
REC[3:0]
RHC[3:0]
RBE[3:0]
REC[3:0]
URAT[2:0]
URAD URAD URAD URAD DASA[9:2]
DASA[17:10]
DASA[25:18]
VAL[7:0]
VAL[15:8]
VAL[23:16]
VAL[31:24]
VAL[7:0]
VAL[15:8]
VAL[23:16]
VAL[31:24]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 481 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x40 UIHVALx2 0x44 UIHVALx3 0x48 UIHVALx4 0x4C UIHVALx5 0x50 UIHVALx6 0x54 UIHVALx7 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 VAL[7:0]
VAL[15:8]
VAL[23:16]
VAL[31:24]
VAL[7:0]
VAL[15:8]
VAL[23:16]
VAL[31:24]
VAL[7:0]
VAL[15:8]
VAL[23:16]
VAL[31:24]
VAL[7:0]
VAL[15:8]
VAL[23:16]
VAL[31:24]
VAL[7:0]
VAL[15:8]
VAL[23:16]
VAL[31:24]
VAL[7:0]
VAL[15:8]
VAL[23:16]
VAL[31:24]
25.8 Register Description Registers can be 8, 16, or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the "PAC Write-Protection" property in each individual register description. For details, refer to 22.5.7. Register Access Protection. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable-
protection is denoted by the "Enable-Protected" property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 482 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.8.1 Configuration Register Name:
Offset:
Reset:
Property:
CFG 0x00 0x0
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 Access Reset Bit
0 7 Access Reset R/W 0 14 UALGO[2:0]
0 BBC[3:0]
6 R/W 0 13
0 5 R/W 0 12 UIHASH
0 4 R/W 0 11 10 3 2 SLBDIS R/W 0 9 DUALBUFF
0 1 EOMDIS R/W 0 8 ASCD R/W 0 0 WBDIS R/W 0 Bits 15:13 UALGO[2:0]User SHA Algorithm Value 0 1 Other Name SHA1 SHA256
Description SHA1 algorithm processed SHA256 algorithm processed Reserved Bit 12 UIHASHUser Initial Hash Value Value 0 1 Description The secure hash standard provides the initial hash value. The initial hash value is programmable. Field UALGO provides the SHA algorithm. The ALGO field of the RCFGn structure member has no effect. Bit 9 DUALBUFFDual Input Buffer Value 0 1 Description Dual Input buffer mode is disabled. Dual Input buffer mode is enabled (Better performances, higher bandwidth required on system bus). Bit 8 ASCDAutomatic Switch To Compare Digest Value 0 1 Description Automatic mode is disabled. When this mode is enabled, the ICM controller automatically switches to active monitoring after the first Main List pass. Both CDWBN and WBDIS bits have no effect. A 1 must be written to the End of Monitoring bit in the Region Configuration register (RCFG.EOM) to terminate the monitoring. Bits 7:4 BBC[3:0]Bus Burden Control This field is used to control the burden of the ICM system bus. The number of system clock cycles between the end of the current processing and the next block transfer is set to 2BBC. Up to 32768 cycles can be inserted. Bit 2 SLBDISSecondary List Branching Disable 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 483 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) Value 0 1 Description Branching to the Secondary List is permitted. Branching to the Secondary List is forbidden. The NEXT field of the RNEXT structure member has no effect and is always considered as zero. Bit 1 EOMDISEnd of Monitoring Disable Value 0 1 Description End of Monitoring is permitted. End of Monitoring is forbidden. The EOM bit of the RCFG structure member has no effect. Bit 0 WBDISWrite Back Disable When the Automatic Switch to Compare Digest bit of this register (CFG.ASCD) is written to 1, this bit value has no effect. Value 0 1 Description Write Back Operations are permitted. Write Back Operations are forbidden: Context register CDWBN bit is internally set to 1 and cannot be modified by a linked list element. The CDWBN bit of the RCFG structure member has no effect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 484 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.8.2 Control Register Name:
Offset:
Property:
CTRL 0x04
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit Access Reset Bit Access Reset 15 W 7 W 14 W 6 W RMEN[3:0]
REHASH[3:0]
13 W 5 W 12 W 4 W 11 W 3 10 W RMDIS[3:0]
9 W 8 W 2 SWRST W 1 DISABLE W 0 0 ENABLE W 0 Bits 15:12 RMEN[3:0]Region Monitoring Enable Value 0 1 Description No effect. When bit RMEN[i] is written to '1', the monitoring of region with identifier i is activated. Bits 11:8 RMDIS[3:0]Region Monitoring Disable Value 0 1 Description No effect. When REHASH[i] is written to '1', Region i digest is re-computed. This bit is only available when region monitoring is disabled. Bits 7:4 REHASH[3:0]Recompute Internal Hash Value 0 1 Description No effect. When REHASH[i] is written to '1', Region i digest is re-computed. This bit is only available when region monitoring is disabled. Bit 2 SWRSTSoftware Reset Value 0 1 Description No effect. Resets the ICM controller. Bit 1 DISABLEECM Disable Value 0 1 Description No effect. The ICM controller is disabled. If a region is activated, the region is terminated. Bit 0 ENABLEICM Enable Value 0 Description No effect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 485 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) Value 1 Description The ICM controller is activated. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 486 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.8.3 Status Register Name:
Offset:
Property: Read-Only SR 0x08 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 R 0 7 Access Reset Bit Access Reset RMDIS[3:0]
14 R 0 6 13 R 0 5 12 R 0 4 11 R 0 3 10 9 RAWRMDIS[3:0]
R R 0 0 2 1 8 R 0 0 ENABLE R 0 Bits 15:12 RMDIS[3:0]Region Monitoring Disabled Status Description Region i is being monitored (occurs after integrity check value has been calculated and written to Hash area). Region i is not being monitored. Value 0 1 Bits 11:8 RAWRMDIS[3:0]Region Monitoring Disabled Raw Status Value 0 1 Description Region i monitoring has been activated by writing a 1 in RMEN[i] of CTRL Region i monitoring has been deactivated by writing a 1 in RMDIS[i] of CTRL Bit 0 ENABLEICM Controller Enable Register Value 0 1 Description ICM controller is disabled. ICM controller is activated. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 487 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.8.4 Interrupt Enable Register Name:
Offset:
Reset:
Property: Write-Only IER 0x10 0x00000000 Bit 31 30 29 28 27 26 25 Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 23 W 0 15 W 0 7 W 0 RSU[3:0]
RWC[3:0]
RDM[3:0]
22 W 0 14 W 0 6 W 0 21 W 0 13 W 0 5 W 0 20 W 0 12 W 0 4 W 0 19 W 0 11 W 0 3 W 0 REC[3:0]
RBE[3:0]
RHC[3:0]
18 W 0 10 W 0 2 W 0 17 W 0 9 W 0 1 W 0 24 URAD W 0 16 W 0 8 W 0 0 W 0 Bit 24 URADUndefined Register Access Detection Interrupt Enable 0: No effect 1: The Undefined Register Access interrupt is enabled. Bits 23:20 RSU[3:0]Region Status Updated Interrupt Enable 0: No effect 1: When RSU[i] is written to 1, the region i Status Updated interrupt is enabled. Bits 19:16 REC[3:0]Region End bit Condition Detected Interrupt Enable 0: No effect 1: When REC[i] is written to 1, the region i End bit Condition interrupt is enabled. Bits 15:12 RWC[3:0]Region Wrap Condition detected Interrupt Enable 0: No effect 1: When RWC[i] is written to 1, the Region i Wrap Condition interrupt is enabled. Bits 11:8 RBE[3:0]Region Bus Error Interrupt Enable Value 0 1 Description No effect. When RBE[i] is written to '1', the Region i Bus Error interrupt is enabled. Bits 7:4 RDM[3:0]Region Digest Mismatch Interrupt Enable Value 0 1 Description No effect. When RDM[i] is written to '1', the Region i Digest Mismatch interrupt is enabled. Bits 3:0 RHC[3:0]Region Hash Completed Interrupt Enable Value 0 Description No effect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 488 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) Value 1 Description When RHC[i] is written to '1', the Region i Hash Completed interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 489 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.8.5 Interrupt Disable Register Name:
Offset:
Property: Write-Only IDR 0x14 Bit 31 30 29 28 27 26 25 Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 23 W 15 W 7 W 22 W 14 W 6 W RSU[3:0]
RWC[3:0]
RDM[3:0]
21 W 13 W 5 W 20 W 12 W 4 W 19 W 11 W 3 W 18 W 10 W 2 W REC[3:0]
RBE[3:0]
RHC[3:0]
17 W 9 W 1 W 24 URAD W 16 W 8 W 0 W Bit 24 URADUndefined Register Access Detection Interrupt Disable Value 0 1 Description No effect. Undefined Register Access Detection interrupt is disabled. Bits 23:20 RSU[3:0]Region Status Updated Interrupt Disable Value 0 1 Description No effect. When RSU[i] is written to '1', the region i Status Updated interrupt is disabled. Bits 19:16 REC[3:0]Region End bit Condition detected Interrupt Disable Value 0 1 Description No effect. When REC[i] is written to '1', the region i End bit Condition interrupt is disabled. Bits 15:12 RWC[3:0]Region Wrap Condition Detected Interrupt Disable Value 0 1 Description No effect. When RWC[i] is written to '1', the Region i Wrap Condition interrupt is disabled. Bits 11:8 RBE[3:0]Region Bus Error Interrupt Disable Value 0 1 Description No effect. When RBE[i] is written to '1', the Region i Bus Error interrupt is disabled. Bits 7:4 RDM[3:0]Region Digest Mismatch Interrupt Disable Value 0 1 Description No effect. When RDM[i] is written to '1', the Region i Digest Mismatch interrupt is disabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 490 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) Bits 3:0 RHC[3:0]Region Hash Completed Interrupt Disable Value 0 1 Description No effect. When RHC[i] is written to '1', the Region i Hash Completed interrupt is disabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 491 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.8.6 Interrupt Mask Register Name:
Offset:
Reset:
Property: Read-Only IMR 0x18 0x00000000 Bit 31 30 29 28 27 26 25 Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 23 R 0 15 R 0 7 R 0 24 URAD R 0 RSU[3:0]
RWC[3:0]
RDM[3:0]
22 R 0 14 R 0 6 R 0 21 R 0 13 R 0 5 R 0 20 R 0 12 R 0 4 R 0 19 R 0 11 R 0 3 R 0 18 R 0 10 R 0 2 R 0 17 16 REC[3:0]
R 0 9 R 0 1 R 0 RBE[3:0]
RHC[3:0]
R 0 8 R 0 0 R 0 Bit 24 URADUndefined Register Access Detection Interrupt Mask Value 0 1 Description The interrupt is disabled. The interrupt is enabled. Bits 23:20 RSU[3:0]Region Status Updated Interrupt Mask Description When RSU[i] is reading '0', the interrupt is disabled for region i. When RSU[i] is reading '1', the interrupt is enabled for region i. Value 0 1 Bits 19:16 REC[3:0]Region End bit Condition Detected Interrupt Mask Value 0 1 Description When REC[i] is reading '0', the interrupt is disabled for region i. When REC[i] is reading '1', the interrupt is enabled for region i. Bits 15:12 RWC[3:0]Region Wrap Condition Detected Interrupt Mask Value 0 1 Description When RWC[i] is reading '0', the interrupt is disabled for region i. When RWC[i] is reading '1', the interrupt is enabled for region i. Bits 11:8 RBE[3:0]Region Bus Error Interrupt Mask Value 0 1 Description When RBE[i] is reading '0', the interrupt is disabled for region i. When RBE[i] is reading '1', the interrupt is enabled for region i. Bits 7:4 RDM[3:0]Region Digest Mismatch Interrupt Mask Description When RDM[i] is reading '0', the interrupt is disabled for region i. Value 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 492 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) Value 1 Description When RDM[i] is reading '1', the interrupt is enabled for region i. Bits 3:0 RHC[3:0]Region Hash Completed Interrupt Mask Description When RHC[i] is reading '0', the interrupt is disabled for region i. When RHC[i] is reading '1', the interrupt is enabled for region i. Value 0 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 493 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.8.7 Interrupt Status Register Name:
Offset:
Reset:
Property: Read-Only ISR 0x1C 0x0 Bit 31 30 29 28 27 26 25 Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 23 R 0 15 R 0 7 R 0 24 URAD R 0 RSU[3:0]
RWC[3:0]
RDM[3:0]
22 R 0 14 R 0 6 R 0 21 R 0 13 R 0 5 R 0 20 R 0 12 R 0 4 R 0 19 R 0 11 R 0 3 R 0 18 R 0 10 R 0 2 R 0 17 16 REC[3:0]
R 0 9 R 0 1 R 0 RBE[3:0]
RHC[3:0]
R 0 8 R 0 0 R 0 Bit 24 URADUndefined Register Access Detection Status The URAD bit is only reset by the SWRST bit in the CTRL register. The Undefined Register Access Trace bit field in the Undefined Access Status Register (UASR.URAT) indicates the unspecified access type. Description Value No undefined register access has been detected since the last SWRST. 0 At least one undefined register access has been detected since the last SWRST. 1 Bits 23:20 RSU[3:0]Region Status Updated Detected RSU[i] is set when a region status updated condition is detected. Bits 19:16 REC[3:0]Region End bit Condition Detected REC[i] is set when an end bit condition is detected. Bits 15:12 RWC[3:0]Region Wrap Condition Detected RWC[i] is set when a wrap condition is detected. Bits 11:8 RBE[3:0]Region Bus Error RBE[i] is set when a bus error is detected while hashing memory region i. Bits 7:4 RDM[3:0]Region Digest Mismatch RDM[i] is set when there is a digest comparison mismatch between the hash value of region i and the reference value located in the Hash Area. Bits 3:0 RHC[3:0]Region Hash Completed RHC[i] is set when the ICM has completed the region with identifier i. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 494 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.8.8 Undefined Access Status Register Name:
Offset:
Reset:
Property: Read-Only UASR 0x20 0x0 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 Access Reset Bit 7 6 5 4 3 Access Reset Bits 2:0 URAT[2:0]Undefined Register Access Trace 2 R 0 1 URAT[2:0]
R 0 8 0 R 0 Only the first Undefined Register Access Trace is available through the URAT field. The URAT field is only reset by the Software Reset bit in the Control register (CTRL.SWRST). Value 0 Name UNSPEC_STRUCT_MEMBER Unspecified structure member set to '1' detected when the descriptor Description 1 2 3 4 ICM_CFG_MODIFIED ICM_DSCR_MODIFIED ICM_HASH_MODIFIED READ_ACCESS is loaded. CFG modified during active monitoring. DSCR modified during active monitoring. HASH modified during active monitoring Write-only register read access Only the first Undefined Register Access Trace is available through the URAT field. The URAT field is only reset by the SWRST bit in the CTRL register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 495 25.8.9 Descriptor Area Start Address Register PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) Name:
Offset:
Reset:
Property:
DSCR 0x30 0x0
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 DASA[1:0]
Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 28 27 DASA[25:18]
R/W 0 20 R/W 0 19 DASA[17:10]
R/W 0 12 R/W 0 4 DASA[9:2]
R/W 0 11 R/W 0 3 26 R/W 0 18 R/W 0 10 R/W 0 2 25 R/W 0 17 R/W 0 9 R/W 0 1 24 R/W 0 16 R/W 0 8 R/W 0 0 Bits 31:6 DASA[25:0]Descriptor Area Start Address The start address is a multiple of the total size of the data structure (64 bytes). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 496 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.8.10 Hash Area Start Address Register Name:
Offset:
Reset:
Property:
HASH 0x34 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 497 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) 25.8.11 User Initial Hash Value Register Name:
Offset:
Reset:
Property:
UIHVALx 0x38 + x*0x04 [x=0..7]
0
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 VAL[31:24]
VAL[23:16]
VAL[15:8]
VAL[7:0]
28 R/W 0 20 R/W 0 12 R/W 0 4 R/W 0 27 R/W 0 19 R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 VAL[31:0]Initial Hash Value When UIHASH bit of CFG register is set, the Initial Hash Value is user-programmable. To meet the desired standard, use the following example values. For UIHVAL0 field:
Example 0x67452301 0x6A09E667 For UIHVAL1 field:
Example 0xEFCDAB89 0xBB67AE85 For UIHVAL2 field:
Example 0x98BADCFE 0x3C6EF372 For UIHVAL3 field:
Example 0x10325476 0xA54FF53A For UIHVAL4 field:
Comment SHA1 algorithm SHA256 algorithm Comment SHA1 algorithm SHA256 algorithm Comment SHA1 algorithm SHA256 algorithm Comment SHA1 algorithm SHA256 algorithm 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 498 PIC32CX-BZ2 and WBZ45 Family Integrity Check Monitor (ICM) Example 0xC3D2E1F0 0x510E527F For UIHVAL5 field:
Example 0x9B05688C For UIHVAL6 field:
Example 0x1F83D9AB For UIHVAL7 field:
Example 0x5BE0CD19 Comment SHA1 algorithm SHA256 algorithm Comment SHA256 algorithm Comment SHA256 algorithm Comment SHA256 algorithm Example of Initial Value for SHA-1 Algorithm Register Address Address Offset / Byte Lane 0x3 / 31:24 0x2 / 23:16 0x1 / 15:8 0x0 / 7:0 0x000 UIHVAL0 0x004 UIHVAL1 0x008 UIHVAL2 0x00C UIHVAL3 0x010 UIHVAL4 01 89 fe 76 f0 23 ab dc 54 e1 45 cd ba 32 d2 67 ef 98 10 c3 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 499 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26. Peripheral Access Controller (PAC) 26.1 Overview The Peripheral Access Controller provides an interface for the locking and unlocking of peripheral registers within the device. It reports all violations that could happen when accessing a peripheral: write protected access, illegal access, enable protected access, access when clock synchronization or software reset is on-going. These errors are reported in a unique interrupt flag for a peripheral. The PAC module also reports errors occurring at the client bus level, when an access to a non-existing address is detected. Notes:
1. 2. The modules attached to the PB-PIC bridge and wireless subsystem as well as RTCC, DSCON, PUKCC and ICM are excluded from the PAC. The protection mechanism described in the System Configuration Registers
(CFG) protects critical system registers (see System Configuration Registers (CFG) from Related Links). Traditional Peripheral Access Controller (PAC) documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Host and Client, respectively. Related Links 18. System Configuration and Register Locking (CFG) 26.2 Features Manages write protection access and reports access errors for the peripheral modules or bridges. 26.3 Block Diagram Figure 26-1. PAC Block Diagram IRQ APB PAC INTFLAG PAC CONTROL Client ERROR CLIENTs Peripheral ERROR BUSn WRITE CONTROL Peripheral ERROR BUS0 PERIPHERAL m PERIPHERAL 0 PERIPHERAL m WRITE CONTROL PERIPHERAL 0 26.4 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 500 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.4.1 IO Lines Not applicable. 26.4.2 Power Management The PAC can continue to operate in any Sleep mode where the selected source clock is running. The PAC interrupts can be used to wake up the device from Sleep modes. The events can trigger other operations in the system without exiting sleep modes. 26.4.3 DMA Not applicable. 26.4.4 Interrupts The interrupt request line is connected to the Interrupt Controller (NVIC). Using the PAC interrupt requires the Interrupt Controller to be configured first. Table 26-1. Interrupt Lines Instances PAC 26.4.5 Events NVIC Line PACERR The events are connected to the Event System, which may need configuration. See Event System (EVSYS) from Related Links. Related Links 28. Event System (EVSYS) 26.4.6 Debug Operation When the CPU is halted in Debug mode, write protection of all peripherals is disabled and the PAC continues normal operation. 26.4.7 Register Access Protection All registers with write access can be write-protected optionally by the Peripheral Access Controller (PAC), except for the following PAC registers:
Write Control (WRCTRL) register AHB Subordinate Bus Interrupt Flag Status and Clear (INTFLAGAHB) register Peripheral Interrupt Flag Status and Clear n (INTFLAG A/B/C...) registers Optional write protection by the Peripheral Access Controller (PAC) is denoted by the PAC Write Protection property in each individual register description. Note:PAC write protection does not apply to accesses through an external debugger. 26.5 Functional Description 26.5.1 Principle of Operation The Peripheral Access Control module allows the user to set a write protection on peripheral modules and generate an interrupt in case of a peripheral access violation. The peripherals protection can be set, cleared or locked at the user discretion. A set of Interrupt Flag and Status registers informs the user on the status of the violation in the peripherals. In addition, client bus errors can be also reported in the cases where reserved area is accessed by the application. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 501 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.5.2 Basic Operation 26.5.2.1 Initialization, Enabling and Resetting The PAC is always enabled after reset. Only a hardware reset will reset the PAC module. 26.5.2.2 Operations The PAC module allows the user to set, clear or lock the write protection status of all peripherals on all Peripheral Bridges, except the peripherals on PB-PIC bus. If a peripheral register violation occurs, the Peripheral Interrupt Flag n registers (INTFLAGn) are updated to inform the user on the status of the violation in the peripherals connected to the Peripheral Bridge n (n = A,B,C ...). The corresponding Peripheral Write Control Status n register (STATUSn) gives the state of the write protection for all peripherals connected to the corresponding Peripheral Bridge n. See Peripheral Access Errors from Related Links. The PAC module also report the errors occurring at client bus level when an access to reserved area is detected. AHB Subordinate Bus Interrupt Flag register (INTFLAGAHB) informs the user on the status of the violation in the corresponding client. See AHB Subordinate Bus Errors from Related Links. Related Links 26.5.2.3. Peripheral Access Errors 26.5.2.6. AHB Subordinate Bus Errors 26.5.2.3 Peripheral Access Errors The following events will generate a Peripheral Access Error:
Protected write: To avoid unexpected writes to a peripheral's registers, each peripheral can be write protected. Only the registers denoted as PAC Write-Protection in the modules datasheet can be protected. If a peripheral is not write protected, write data accesses are performed normally. If a peripheral is write protected and if a write access is attempted, data will not be written and peripheral returns an access error. The corresponding interrupt flag bit in the INTFLAGn register will be set. Illegal access: Access to an unimplemented register within the module. Synchronized write error: For write-synchronized registers an error will be reported if the register is written while a synchronization is ongoing. When any of the INTFLAGn registers bit are set, an interrupt will be requested if the PAC interrupt enable bit is set. 26.5.2.4 Write Access Protection Management Peripheral access control can be enabled or disabled by writing to the WRCTRL register. The data written to the WRCTRL register is composed of two fields; WRCTRL.PERID and WRCTRL.KEY. The WRCTRL.PERID is an unique identifier corresponding to a peripheral. The WRCTRL.KEY is a key value that defines the operation to be done on the control access bit. These operations can be clear protection, set protection and set and lock protection bit. The clear protection operation will remove the write access protection for the peripheral selected by WRCTRL.PERID. Write accesses are allowed for the registers in this peripheral. The set protection operation will set the write access protection for the peripheral selected by WRCTRL.PERID. Write accesses are not allowed for the registers with write protection property in this peripheral. The set and lock protection operation will set the write access protection for the peripheral selected by WRCTRL.PERID and locks the access rights of the selected peripheral registers. The write access protection will only be cleared by a hardware reset. The peripheral access control status can be read from the corresponding STATUSn register. 26.5.2.5 Write Access Protection Management Errors Only word-wise writes to the WRCTRL register will effectively change the access protection. Other type of accesses will have no effect and will cause a PAC write access error. This error is reported in the INTFLAGA.PAC bit. PAC also offers an additional safety feature for correct program execution with an interrupt generated on double write clear protection or double write set protection. If a peripheral is write protected and a subsequent set protection operation is detected then the PAC returns an error, and similarly for a double clear protection operation. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 502 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) In addition, an error is generated when writing a set and lock protection to a write-protected peripheral or when a write access is done to a locked set protection. This can be used to ensure that the application follows the intended program flow by always following a write protect with an unprotect and conversely. However in applications where a write protected peripheral is used in several contexts, for example, interrupt, care must be taken so that either the interrupt can not happen while the main application or other interrupt levels manipulates the write protection status or when the interrupt handler needs to unprotect the peripheral based on the current protection status by reading the STATUS register. The errors generated while accessing the PAC module registers (for example, key error, double protect error and so on) will set the INTFLAGA.PAC flag. 26.5.2.6 AHB Subordinate Bus Errors The PAC module reports errors occurring at the AHB Subordinate bus level. These errors are generated when an access is performed at an address where no subordinate (bridge or peripheral) is mapped. These errors are reported in the corresponding bits of the INTFLAGAHB register. 26.5.2.7 Generating Events The PAC module can also generate an event when any of the Interrupt Flag registers bit are set. To enable the PAC event generation, the control bit EVCTRL.ERREO must be set a '1'. 26.5.3 DMA Operation Not applicable. 26.5.4 Interrupts The PAC has the following interrupt source:
Error (ERR): Indicates that a peripheral access violation occurred in one of the peripherals controlled by the PAC module, or a bridge error occurred in one of the bridges reported by the PAC This interrupt is a synchronous wake-up source Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAGAHB and INTFLAGn) registers is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a '1' to the corresponding bit in the Interrupt Enable Set (INTENSET) register, and disabled by writing a '1' to the corresponding bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled, or the PAC is reset. All interrupt requests from the peripheral are ORed together on system level to generate one combined interrupt request to the NVIC. The user must read the INTFLAGAHB and INTFLAGn registers to determine which interrupt condition is present. Note that interrupts must be globally enabled for interrupt requests to be generated. 26.5.5 Events The PAC can generate the following output event:
Error (ERR): Generated when one of the interrupt flag registers bits is set Writing a '1' to an Event Output bit in the Event Control Register (EVCTRL.ERREO) enables the corresponding output event. Writing a '0' to this bit disables the corresponding output event. 26.5.6 Sleep Mode Operation In Sleep mode, the PAC is kept enabled if an available bus host (CPU, DMA) is running. The PAC will continue to catch access errors from the module and generate interrupts or events. 26.5.7 Synchronization Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 503 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.6 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 7:0 15:8 23:16 31:24 7:0 PERID[7:0]
PERID[15:8]
KEY[7:0]
0x00 WRCTRL 0x04 0x05
... 0x07 0x08 0x09 0x0A
... 0x0F EVCTRL Reserved INTENCLR INTENSET 7:0 7:0 Reserved ERREO ERR ERR 0x10 INTFLAGAHB 0x14 INTFLAGA 0x18 INTFLAGB 0x1C INTFLAGC 0x20
... 0x33 Reserved 0x34 STATUSA 0x38 STATUSB 0x3C STATUSC 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 PBBB PBAB PFLASH CFLASH SRAM3 SRAM2 QSPI SRAM1 PBPICB SRAM0 PBCB TC2 TC1 TC0 SERCOM1 SERCOM0 TCC2 EIC TCC1 FREQM TCC0 RAMECC EVSYS DMAC PAC TC3 DSU AC CCL TC2 TC1 TC0 SERCOM1 SERCOM0 EIC TCC1 FREQM PAC TC3 RAMECC EVSYS DMAC AC CCL SERCOM3 SERCOM2 26.7 Register Description Registers can be 8, 16, or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the "PAC Write-Protection" property in each individual register description. For details, refer to the related links. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 504 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.1 Write Control Name:
Offset:
Reset:
Property:
WRCTRL 0x00 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 Access Reset RW 0 Bit 15 Access Reset RW 0 Bit 7 Access Reset RW 0 22 RW 0 14 RW 0 6 RW 0 21 RW 0 13 RW 0 5 RW 0 KEY[7:0]
PERID[15:8]
PERID[7:0]
20 RW 0 12 RW 0 4 RW 0 19 RW 0 11 RW 0 3 RW 0 18 RW 0 10 RW 0 2 RW 0 17 RW 0 9 RW 0 1 RW 0 16 RW 0 8 RW 0 0 RW 0 Bits 23:16 KEY[7:0]Peripheral Access Control Key These bits define the peripheral access control key:
Value 0x0 0x1 0x2 0x3 Description No action Clear the peripheral write control Set the peripheral write control Set and lock the peripheral write control until the next hardware reset Name OFF CLEAR SET LOCK Bits 15:0 PERID[15:0]Peripheral Identifier The PERID represents the peripheral whose control is changed using the WRCTRL.KEY. The Peripheral Identifier is calculated following formula:
Where BridgeNumber represents the Peripheral Bridge Number (0 for Peripheral Bridge A, 1 for Peripheral Bridge B, PERID = 32* BridgeNumber + N etc). N represents the peripheral index from the respective Bridge Number:
Table 26-2. PERID Values Periph. Bridge Name BridgeNumber PERID Values A B C D 0 1 2 3 0+N 32+N 64+N 96+N Note:GMAC, ICM, SDHC, CAN and PCC peripherals do not support that feature. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 505 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.2 Event Control Name:
Offset:
Reset:
Property:
EVCTRL 0x04 0x00
Bit 7 6 5 4 3 2 1 Access Reset 0 ERREO RW 0 Bit 0 ERREOPeripheral Access Error Event Output This bit indicates if the Peripheral Access Error Event Output is enabled or disabled. When enabled, an event will be generated when one of the interrupt flag registers bits (INTFLAGAHB, INTFLAGn) is set:
Value 0 1 Description Peripheral Access Error Event Output is disabled. Peripheral Access Error Event Output is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 506 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.3 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x08 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENSET). Bit 7 6 5 4 3 2 1 Access Reset Bit 0 ERRPeripheral Access Error Interrupt Disable 0 ERR RW 0 This bit indicates that the Peripheral Access Error Interrupt is enabled and an interrupt request will be generated when one of the interrupt flag registers bits (INTFLAGAHB, INTFLAGn) is set:
Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Peripheral Access Error interrupt Enable bit and disables the corresponding interrupt request. Value 0 1 Description Peripheral Access Error interrupt is disabled. Peripheral Access Error interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 507 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.4 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x09 0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENCLR). Bit 7 6 5 4 3 2 1 Access Reset Bit 0 ERRPeripheral Access Error Interrupt Enable 0 ERR RW 0 This bit indicates that the Peripheral Access Error Interrupt is enabled and an interrupt request will be generated when one of the interrupt flag registers bits (INTFLAGAHB, INTFLAGn) is set:
Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Peripheral Access Error interrupt Enable bit and enables the corresponding interrupt request. Value 0 1 Description Peripheral Access Error interrupt is disabled. Peripheral Access Error interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 508 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.5 Bridge Interrupt Flag Status Name:
Offset:
Reset:
Property:
INTFLAGAHB 0x10 0x00000000
These flags are cleared by writing a 1 to the corresponding bit. These flags are set when an access error is detected by the corresponding AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 Access Reset Bit Access Reset 7 PBBB RW 0 6 PBAB RW 0 5 PFLASH RW 0 4 CFLASH RW 0 3 SRAM3 RW 0 10 QSPI RW 0 2 SRAM2 U 0 9 PBPICB RW 0 1 SRAM1 U 0 8 PBCB RW 0 0 SRAM0 RW 0 Bit 10 QSPIInterrupt Flag for QSPI This flag is set when an access error is detected by the QSPI AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the QSPI interrupt flag. Bit 9 PBPICBInterrupt Flag for PBPICB (PB-PIC-Bridge) This flag is set when an access error is detected by the PBPICB AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the PBPICB interrupt flag. Bit 8 PBCBInterrupt Flag for PBCB (PB-Bridge-C) This flag is set when an access error is detected by the PBCB AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the PBCB interrupt flag. Bit 7 PBBBInterrupt Flag for PBBB (PB-Bridge-B) This flag is set when an access error is detected by the PBBB AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the PBBB interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 509 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) Bit 6 PBABInterrupt Flag for HPB1 (PB-Bridge-A) This flag is set when an access error is detected by the PBAB AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the PBAB interrupt flag. Bit 5 PFLASHInterrupt Flag for PFLASH (Peripheral Flash) This flag is set when an access error is detected by the PFLASH AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the PFLASH interrupt flag. Bit 4 CFLASHInterrupt Flag for CFLASH (CPU Flash) This flag is set when an access error is detected by the CFLASH AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the CFLASH interrupt flag. Bit 3 SRAM3Interrupt Flag for SRAM3 This flag is set when an access error is detected by the SRAM3 AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the SRAM3 interrupt flag. Bit 2 SRAM2Interrupt Flag for SRAM2 This flag is set when an access error is detected by the SRAM2 AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the SRAM2 interrupt flag. Bit 1 SRAM1Interrupt Flag for SRAM1 This flag is set when an access error is detected by the SRAM1 AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the SRAM1 interrupt flag. Bit 0 SRAM0Interrupt Flag for SRAM0 This flag is set when an access error is detected by the SRAM0 AHB Subordinate, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 has no effect. Writing a 1 to this bit will clear the SRAM0 interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 510 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.6 Peripheral Interrupt Flag Status Bridge A Name:
Offset:
Reset:
Property:
INTFLAGA 0x14 0x00000000 These flags are set when a Peripheral Access Error occurs while accessing the peripheral associated with the respective INTFLAGx bit, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 to these bits has no effect. Writing a 1 to these bits will clear the corresponding INTFLAGx interrupt flag. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 Access Reset Bit Access Reset 7 TC2 RW 0 6 TC1 RW 0 5 TC0 RW 0 4 SERCOM1 RW 0 3 SERCOM0 RW 0 11 TCC2 RW 0 10 TCC1 RW 0 2 EIC RW 0 9 TCC0 RW 0 1 FREQM RW 0 8 TC3 RW 0 0 PAC RW 0 Bit 11 TCC2Interrupt Flag for TCC2 This bit is set when a Peripheral Access Error occurs while accessing the TCC2, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. Bit 10 TCC1Interrupt Flag for TCC1 This bit is set when a Peripheral Access Error occurs while accessing the TCC1, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. Bit 9 TCC0Interrupt Flag for TCC0 This bit is set when a Peripheral Access Error occurs while accessing the TCC0, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. Bit 8 TC3Interrupt Flag for TC3 This bit is set when a Peripheral Access Error occurs while accessing the TC3, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 511 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) Bit 7 TC2Interrupt Flag for TC2 This bit is set when a Peripheral Access Error occurs while accessing the TC2, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. Bit 6 TC1Interrupt Flag for TC1 This bit is set when a Peripheral Access Error occurs while accessing the TC1, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. Bit 5 TC0Interrupt Flag for TC0 This bit is set when a Peripheral Write Access Error occurs while accessing the TC0, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. Bit 4 SERCOM1Interrupt Flag for SERCOM1 This bit is set when a Peripheral Access Error occurs while accessing the SERCOM1, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. Bit 3 SERCOM0Interrupt Flag for SERCOM0 This bit is set when a Peripheral Access Error occurs while accessing the SERCOM0, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. Bit 2 EICInterrupt Flag for EIC This bit is set when a Peripheral Access Error occurs while accessing the EIC, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. Bit 1 FREQMInterrupt Flag for FREQM This bit is set when a Peripheral Access Error occurs while accessing the FREQM, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. Bit 0 PACInterrupt Flag for PAC This bit is set when a Peripheral Write Access Error occurs while accessing the PAC, and will generate an interrupt request if SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 512 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.7 Peripheral Interrupt Flag Status Bridge B Name:
Offset:
Reset:
Property:
INTFLAGB 0x18 0x00000000 These flags are set when a Peripheral Access Error occurs while accessing the peripheral associated with the respective INTFLAGx bit, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 to these bits has no effect. Writing a 1 to these bits will clear the corresponding INTFLAGx interrupt flag. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 Access Reset 4 RAMECC RW 0 3 EVSYS RW 0 2 DMAC RW 0 9 1 8 0 DSU RW 0 Bit 4 RAMECCInterrupt Flag for RAMECC This flag is set when a Peripheral Access Error occurs while accessing the RAMECC, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the RAMECC interrupt flag. Bit 3 EVSYSInterrupt Flag for EVSYS This flag is set when a Peripheral Access Error occurs while accessing the EVSYS, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the EVSYS interrupt flag. Bit 2 DMACInterrupt Flag for DMAC This flag is set when a Peripheral Access Error occurs while accessing the DMAC, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the DMAC interrupt flag. Bit 0 DSUInterrupt Flag for DSU This flag is set when a Peripheral Access Error occurs while accessing the DSU, and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the DSU interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 513 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.8 Peripheral Interrupt Flag Status Bridge C Name:
Offset:
Reset:
Property:
INTFLAGC 0x1C 0x00000000 These flags are set when a Peripheral Access Error occurs while accessing the peripheral associated with the respective INTFLAGx bit and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 to these bits has no effect. Writing a 1 to these bits will clear the corresponding INTFLAGx interrupt flag. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit Access Reset 7 AC RW 0 6 CCL RW 0 Bit 7 ACInterrupt Flag for AC 5 4 3 2 9 1 8 0 This flag is set when a Peripheral Access Error occurs while accessing the peripheral associated with the AC and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the AC interrupt flag. Bit 6 CCLInterrupt Flag for CCL This flag is set when a Peripheral Access Error occurs while accessing the peripheral associated with the CCL and will generate an interrupt request if INTENCLR/SET.ERR is 1. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the CCL interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 514 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.9 Peripheral Write Protection Status A Name:
Offset:
Reset:
Property: PAC Write-Protection STATUSA 0x34 0x00010000 Writing to this register has no effect. Reading STATUS register returns peripheral write protection status:
Value Description 0 1 Peripheral is not write protected. Peripheral is write protected. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 Access Reset Bit Access Reset 7 TC2 R 0 6 TC1 R 0 5 TC0 R 0 4 SERCOM1 R 0 3 SERCOM0 R 0 10 TCC1 R 0 2 EIC R 0 9 1 FREQM R 0 8 TC3 R 0 0 PAC R 0 Bit 10 TCC1TCC1 APB Protect Enable Value 0 1 Description TCC1 is not write protected TCC1 is write protected Bit 8 TC3TC3 APB Protect Enable Value 0 1 Description TC3 is not write protected TC3 is write protected Bit 7 TC2TC2 APB Protect Enable Value 0 1 Description TC2 is not write protected TC2 is write protected Bit 6 TC1TC1 APB Protect Enable Value 0 1 Description TC1 is not write protected TC1 is write protected Bit 5 TC0TC0 APB Protect Enable 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 515 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) Value 0 1 Description TC0 is not write protected TC0 is write protected Bit 4 SERCOM1SERCOM1 APB Protect Enable Value 0 1 Description SERCOM1 is not write protected SERCOM1 is write protected Bit 3 SERCOM0SERCOM0 APB Protect Enable Value 0 1 Description SERCOM0 is not write protected SERCOM0 is write protected Bit 2 EICEIC APB Protect Enable Description EIC is not write protected EIC is write protected Value 0 1 Bit 1 FREQMFREQM APB Protect Enable Value 0 1 Description FREQM is not write protected FREQM is write protected Bit 0 PACPAC APB Protect Enable Value 0 1 Description PAC is not write protected PAC is write protected 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 516 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.10 Peripheral Write Protection Status Bridge B Name:
Offset:
Reset:
Property: PAC Write-Protection STATUSB 0x38 0x00000002 Writing to this register has no effect. Reading STATUS register returns peripheral write protection status:
Value Description 0 1 Peripheral is not write protected. Peripheral is write protected. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 Access Reset 4 RAMECC R 0 3 EVSYS R 0 2 DMAC R 0 9 1 8 0 Bit 4 RAMECCRAMECC APB Protect Enable Value 0 1 Description RAMECC peripheral is not write protected RAMECC peripheral is write protected Bit 3 EVSYSEVSYS APB Protect Enable Value 0 1 Description EVSYS peripheral is not write protected EVSYS peripheral is write protected Bit 2 DMACDMAC APB Protect Enable Value 0 1 Description DMAC peripheral is not write protected DMAC peripheral is write protected 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 517 PIC32CX-BZ2 and WBZ45 Family Peripheral Access Controller (PAC) 26.7.11 Peripheral Write Protection Status Bridge C Name:
Offset:
Reset:
Property: PAC Write-Protection STATUSC 0x3C 0x00000000 Writing to this register has no effect. Reading STATUS register returns peripheral write protection status:
Value Description 0 1 Peripheral is not write protected. Peripheral is write protected. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit Access Reset 7 AC R 0 6 CCL R 0 5 4 SERCOM3 R 0 3 SERCOM2 R 0 2 9 1 8 0 Bit 7 ACAC APB Protection Enable Value 0 1 Description Peripheral is not write protected Peripheral is write protected Bit 6 CCLCCL APB Protection Enable Value 0 1 Description Peripheral is not write protected Peripheral is write protected Bit 4 SERCOM3SERCOM3 APB Protection Enable Value 0 1 Description Peripheral is not write protected Peripheral is write protected Bit 3 SERCOM2SERCOM2 APB Protection Enable Value 0 1 Description Peripheral is not write protected Peripheral is write protected 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 518 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27. Frequency Meter (FREQM) 27.1 Overview The Frequency Meter (FREQM) can be used to accurately measure the frequency of a clock by comparing it to a known reference clock. 27.2 Features Ratio can be measured with 24-bit accuracy Accurately measures the frequency of an input clock with respect to a reference clock Reference clock can be selected from the available GCLK_FREQM_REF sources Measured clock can be selected from the available GCLK_FREQM_MSR sources 27.3 Block Diagram Figure 27-1. FREQM Block Diagram 27.4 Signal Description Not applicable. 27.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 27.5.1 I/O Lines The REFO lines (REFO[4:1]) can be used as measurement or reference clock sources. This requires the I/O pins to be configured. 27.5.2 Power Management The FREQM will continue to operate in idle sleep mode where the selected source clock is running. The FREQMs interrupts can be used to wake up the device from idle sleep mode. See Power Management Unit (PMU) from Related Links for details on the different sleep modes. Related Links 15. Power Management Unit (PMU) 27.5.3 Clocks Two generic clocks are used by the FREQM: Reference Clock (GCLK_FREQM_REF) and Measurement Clock
(GCLK_FREQM_MSR). GCLK_FREQM_REF is required to clock the internal reference timer, which acts as the frequency reference. GCLK_FREQM_MSR is required to clock a ripple counter for frequency measurement. These clocks must be configured and enabled in the generic clock controller before using the FREQM. 27.5.4 DMA Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 519 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.5.5 Interrupts The interrupt request line is connected to the interrupt controller. Using FREQM interrupt requires the interrupt controller to be configured first. 27.5.6 Events Not applicable. 27.5.7 Debug Operation When the CPU is halted in debug mode the FREQM continues its normal operation. The FREQM cannot be halted when the CPU is halted in debug mode. If the FREQM is configured in a way that requires it to be periodically serviced by the CPU, improper operation or data loss may result during debugging. 27.5.8 Register Access Protection All registers with write access can be write-protected optionally by the Peripheral Access Controller (PAC), except the following registers:
Control B register (CTRLB) Status register (STATUS) Interrupt Flag Status and Clear register (INTFLAG) Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. Write-protection does not apply to accesses through an external debugger. 27.6 Functional Description 27.6.1 Principle of Operation FREQM counts the number of periods of the measured clock (GCLK_FREQM_MSR) with respect to the reference clock (GCLK_FREQM_REF). The measurement is done for a period of REFNUM/fCLK_REF and stored in the Value register (VALUE.VALUE). REFNUM is the number of Reference clock cycles selected in the Configuration A register
(CFGA.REFNUM). The frequency of the measured clock,
, is calculated by fCLK_MSR =
27.6.2 Basic Operation VALUE REFNUM
. The error can be maximum two measured clock cycles. fCLK_MSR fCLK_REF 27.6.2.1 Initialization Before enabling FREQM, the device and peripheral must be configured:
Write the number of Reference clock cycles for which the measurement is to be done in the Configuration A register (CFGA.REFNUM). This must be a non-zero number. Configuration A register (CFGA) Enable-protection is denoted by the "Enable-Protected" property in the register description. 27.6.2.2 Enabling, Disabling and Resetting The FREQM is enabled by writing a '1' to the Enable bit in the Control A register (CTRLA.ENABLE). The peripheral is disabled by writing CTRLA.ENABLE=0. The FREQM is reset by writing a '1' to the Software Reset bit in the Control A register (CTRLA.SWRST). On software reset, all registers in the FREQM will be reset to their initial state, and the FREQM will be disabled. Then ENABLE and SWRST bits are write-synchronized. Related Links 27.6.7. Synchronization 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 520 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.6.2.3 Measurement In the Configuration A register, the Number of Reference Clock Cycles field (CFGA.REFNUM) selects the duration of the measurement. The measurement is given in number of GCLK_FREQM_REF periods. Note:The REFNUM field must be written before the FREQM is enabled. After the FREQM is enabled, writing a 1 to the START bit in the Control B register (CTRLB.START) starts the measurement. The BUSY bit in Status register (STATUS.BUSY) is set when the measurement starts, and cleared when the measurement is complete. There is also an interrupt request for Measurement Done: When the Measurement Done bit in Interrupt Enable Set register (INTENSET.DONE) is 1 and a measurement is finished, the Measurement Done bit in the Interrupt Flag Status and Clear register (INTFLAG.DONE) will be set and an interrupt request is generated. The result of the measurement can be read from the Value register (VALUE.VALUE). The frequency of the measured clock GCLK_FREQM_MSR is then:
fCLK_MSR =
Notes:
VALUE REFNUM fCLK_REF 1. In order to make sure the measurement result (VALUE.VALUE[23:0]) is valid, the overflow status
(STATUS.OVF) must be checked. 2. Due to asynchronous operations, the VALUE Error measurement can be up to two samples. If an overflow condition occurred, indicated by the overflow bit in the STATUS register (STATUS.OVF), either the number of reference clock cycles must be reduced (CFGA.REFNUM) or a faster reference clock must be configured. Once the configuration is adjusted, clear the overflow status by writing a 1 to STATUS.OVF. Then, another measurement can be started by writing a 1 to CTRLB.START. Note:See CFGA, CTRLB, STATUS, INTENSET, INTFLAG, VALUE registers in the Register Summary - FREQM from Related Links. Related Links 27.7. Register Summary - FREQM 27.6.3 DMA Operation Not applicable. 27.6.4 Interrupts DONE: A frequency measurement is done. The interrupt flag in the Interrupt Flag Status and Clear (27.8.6. INTFLAG) register is set when the interrupt condition occurs. The interrupt can be enabled by writing a '1' to the corresponding bit in the Interrupt Enable Set
(27.8.5. INTENSET) register, and disabled by writing a '1' to the corresponding bit in the Interrupt Enable Clear
(27.8.4. INTENCLR) register. The status of enabled interrupts can be read from either INTENSET or INTENCLR. An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled, or the FREQM is reset. See 27.8.6. INTFLAG for details on how to clear interrupt flags. All interrupt requests from the peripheral are ORed together on system level to generate one combined interrupt request to the NVIC. The user must read the 27.8.6. INTFLAG register to determine which interrupt condition is present. This interrupt is a synchronous wake-up source. Note that interrupts must be globally enabled for interrupt requests to be generated. 27.6.5 Events Not applicable. 27.6.6 Sleep Mode Operation For lowest chip power consumption in sleep modes, FREQM must be disabled before entering a Sleep mode. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 521 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.6.7 Synchronization Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be synchronized when written or read. The following bits and registers are write-synchronized:
Software Reset bit in Control A register (CTRLA.SWRST) Enable bit in Control A register (CTRLA.ENABLE) Required write synchronization is denoted by the "Write-Synchronized" property in the register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 522 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.7 Register Summary - FREQM Offset 0x00 0x01 0x02 0x04
... 0x07 0x08 0x09 0x0A 0x0B Name CTRLA CTRLB CFGA Reserved INTENCLR INTENSET INTFLAG STATUS 0x0C SYNCBUSY 0x10 VALUE Bit Pos. 7 6 5 4 3 2 1 0 7:0 7:0 7:0 15:8 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 REFNUM[7:0]
ENABLE SWRST START DONE DONE DONE BUSY OVF ENABLE SWRST VALUE[7:0]
VALUE[15:8]
VALUE[23:16]
27.8 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers require synchronization when read and/or written. Synchronization is denoted by the Read-
Synchronized and/or Write-Synchronized property in each individual register description. Some registers are enable-protected, meaning they can only be written when the module is disabled. Enable-
protection is denoted by the Enable-Protected property in each individual register description. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the "PAC Write-Protection" property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 523 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.8.1 Control A Name:
Offset:
Property: PAC Write-Protection CTRLA 0x00 Bit 7 6 5 4 3 2 Access Reset Bit 1 ENABLEEnable 1 ENABLE R/W 0 0 SWRST R/W 0 Due to synchronization there is delay from writing CTRLA.ENABLE until the peripheral is enabled or disabled. The value written to CTRLA.ENABLE will read back immediately and the ENABLE bit in the Synchronization Busy register
(SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete. Value 0 1 Description The peripheral is disabled. The peripheral is enabled. Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets all registers in the FREQM to their initial state, and the FREQM will be disabled. Writing a '1' to this bit will always take precedence, meaning that all other writes in the same write-operation will be discarded. Due to synchronization there is a delay from writing CTRLA.SWRST until the Reset is complete. CTRLA.SWRST and SYNCBUSY.SWRST will be cleared when the Reset is complete. Value 0 1 Description There is no ongoing Reset operation. The Reset operation is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 524 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.8.2 Control B Name:
Offset:
Reset:
Property:
CTRLB 0x01 0x00 Bit 7 6 5 4 3 2 1 Access Reset Bit 0 STARTStart Measurement Value 0 1 Description Writing a '0' has no effect. Writing a '1' starts a measurement. 0 START W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 525 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.8.3 Configuration A Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-protected CFGA 0x02 0x0000 Bit 15 14 13 12 11 10 Access Reset Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 4 3 REFNUM[7:0]
R/W 0 R/W 0 2 R/W 0 9 1 8 0 R/W 0 R/W 0 Bits 7:0 REFNUM[7:0]Number of Reference Clock Cycles Selects the duration of a measurement in number of CLK_FREQM_REF cycles. This must be a non-zero value, i.e. 0x01 (one cycle) to 0xFF (255 cycles). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 526 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.8.4 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x08 0x00 Bit 7 6 5 4 3 2 1 Access Reset Bit 0 DONEMeasurement Done Interrupt Enable 0 DONE R/W 0 Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the Measurement Done Interrupt Enable bit, which disables the Measurement Done interrupt. Value 0 1 Description The Measurement Done interrupt is disabled. The Measurement Done interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 527 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.8.5 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x09 0x00 Bit 7 6 5 4 3 2 1 Access Reset 0 DONE R/W 0 Bit 0 DONEMeasurement Done Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' to this bit will set the Measurement Done Interrupt Enable bit, which enables the Measurement Done interrupt. Value 0 1 Description The Measurement Done interrupt is disabled. The Measurement Done interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 528 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.8.6 Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
INTFLAG 0x0A 0x00 Bit 7 6 5 4 3 2 1 Access Reset Bit 0 DONEMesurement Done This flag is cleared by writing a '1' to it. This flag is set when the STATUS.BUSY bit has a one-to-zero transition. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the DONE interrupt flag. 0 DONE R/W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 529 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.8.7 Status Name:
Offset:
Reset:
Property:
STATUS 0x0B 0x00 Bit 7 6 5 4 3 2 Access Reset Bit 1 OVFSticky Count Value Overflow This bit is cleared by writing a '1' to it. This bit is set when an overflow condition occurs to the value counter. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the OVF status. Bit 0 BUSYFREQM Status Value 0 1 Description No ongoing frequency measurement. Frequency measurement is ongoing. 1 OVF R/W 0 0 BUSY R 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 530 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.8.8 Synchronization Busy Name:
Offset:
Reset:
Property:
SYNCBUSY 0x0C 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 1 ENABLEEnable 1 ENABLE R 0 0 SWRST R 0 This bit is cleared when the synchronization of CTRLA.ENABLE is complete. This bit is set when the synchronization of CTRLA.ENABLE is started. Bit 0 SWRSTSynchronization Busy This bit is cleared when the synchronization of CTRLA.SWRST is complete. This bit is set when the synchronization of CTRLA.SWRST is started. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 531 PIC32CX-BZ2 and WBZ45 Family Frequency Meter (FREQM) 27.8.9 Value Name:
Offset:
Reset:
Property:
VALUE 0x10 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 23 R 0 15 R 0 7 R 0 22 R 0 14 R 0 6 R 0 21 R 0 13 R 0 5 R 0 20 19 VALUE[23:16]
R 0 12 R 0 4 R 0 VALUE[15:8]
VALUE[7:0]
R 0 11 R 0 3 R 0 18 R 0 10 R 0 2 R 0 17 16 R 0 9 R 0 1 R 0 R 0 8 R 0 0 R 0 Bits 23:0 VALUE[23:0]Measurement Value Result from measurement. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 532 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28. Event System (EVSYS) 28.1 Overview The Event System (EVSYS) allows autonomous, low-latency and configurable communication between peripherals. Several peripherals can be configured to generate and/or respond to signals known as events. The exact condition to generate an event, or the action taken upon receiving an event, is specific to each peripheral. Peripherals that respond to events are called event users. Peripherals that generate events are called event generators. A peripheral can have one or more event generators and can have one or more event users. Communication is made without CPU intervention and without consuming system resources such as bus or RAM bandwidth. This reduces the load on the CPU and other system resources, compared to a traditional interrupt-based system. 28.2 Features 32 configurable event channels:
All channels can be connected to any event generator All channels provide a pure asynchronous path Twelve channels provide a resynchronized or synchronous path 69 event generators. 52 event users. Configurable edge detector. Peripherals can be event generators, event users, or both. SleepWalking and interrupt for operation in sleep modes. Software event generation. Each event user can choose which channel to respond to. Optional Static or Round-Robin interrupt priority arbitration. 28.3 Block Diagram Figure 28-1. Event System Block Diagram 28.4 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 28.4.1 I/O Lines Not applicable. 28.4.2 Power Management The EVSYS can be used to wake up the CPU from all sleep modes (Deep Sleep/BACKUP and Extreme Deep Sleep/OFF Mode), even if the clock used by the EVSYS channel and the EVSYS bus clock are disabled. See Power Management Unit (PMU) from Related Links for details on the different sleep modes. Although the clock for the EVSYS is stopped, the device still can wake up the EVSYS clock. Some event generators can generate an event when their clocks are stopped. The generic clock for the channel
(GCLK_EVSYS_CHANNEL_n) will be restarted if that channel uses a synchronized path or a resynchronized path. It does not need to wake the system from sleep. Related Links 15. Power Management Unit (PMU) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 533 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.4.3 Clocks Each EVSYS channel which can be configured as synchronous or resynchronized has a dedicated generic clock
(GCLK_EVSYS_CHANNEL_n). These are used for event detection and propagation for each channel. These clocks must be configured and enabled in the generic clock controller before using the EVSYS (see Clock and Reset (CRU) from Related Links). Important:Only EVSYS channel 0 to 11 can be configured as synchronous or resynchronized. Related Links 13. Clock and Reset Unit (CRU) 28.4.4 DMA Not applicable. 28.4.5 Interrupts The interrupt request line is connected to the interrupt controller. Using the EVSYS interrupts requires the interrupt controller to be configured first (see Nested Vector Interrupt Controller (NVIC) from Related Links). Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 28.4.6 Events Not applicable. 28.4.7 Debug Operation When the CPU is halted in Debug mode, this peripheral will continue normal operation. If the peripheral is configured to require periodical service by the CPU through interrupts or similar, improper operation or data loss may result during debugging. This peripheral can be forced to halt operation during debugging. 28.4.8 Register Access Protection Registers with write access can be optionally write-protected by the Peripheral Access Controller (PAC), except for the following:
Channel Pending Interrupt (INTPEND) Channel n Interrupt Flag Status and Clear (CHINTFLAGn) Note:Optional write protection is indicated by the "PAC Write Protection" property in the register description. Write protection does not apply for accesses through an external debugger. 28.4.9 Analog Connections Not applicable. 28.5 Functional Description 28.5.1 Principle of Operation The Event System consists of channels which route the internal events from peripherals (generators) to other internal peripherals. Each event generator can be selected as source for multiple channels, but a channel cannot be set to use multiple event generators at the same time. A channel path can be configured in asynchronous, synchronous or resynchronized mode of operation. The mode of operation must be selected based on the requirements of the application. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 534 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) When using synchronous or resynchronized path, the Event System includes options to transfer events to users when rising, falling or both edges are detected on event generators. See Channel Path from Related Links. Related Links 28.5.2.6. Channel Path 28.5.2 Basic Operation 28.5.2.1 Initialization Before enabling event routing within the system, the Event Users Multiplexer and Event Channels must be selected in the Event System (EVSYS), and the two peripherals that generate and use the event must be configured. Follow these steps to configure the event:
1. In the event generator peripheral, enable output of event by writing a '1' to the respective Event Output Enable bit ("EO") in the peripheral's Event Control register, for example, AC.EVCTRL.WINEO0, RTC.EVCTRL.OVFEO. 2. Configure the EVSYS:
a. Configure the Event User multiplexer by writing the respective EVSYS.USERm register, refer to 28.5.2.3. User Multiplexer Setup. b. Configure the Event Channel by writing the respective EVSYS.CHANNELn register, refer to 28.5.2.4. Event System Channel. 3. Configure the action to be executed by the event user peripheral by writing to the Event Action bits (EVACT) in the respective Event control register, for example, TC.EVCTRL.EVACT. Note:This step is not applicable for all the peripherals. In the event user peripheral, enable event input by writing a '1' to the respective Event Input Enable bit ("EI") in the peripheral's Event Control register, for example, AC.EVCTRL.IVEI0, ADC.EVCTRL.STARTEI. 4. 28.5.2.2 Enabling, Disabling, and Resetting The EVSYS is always enabled. The EVSYS is reset by writing a 1 to the Software Reset bit in the Control A register (CTRLA.SWRST). All registers in the EVSYS will be reset to their initial state and all ongoing events will be canceled. Refer to CTRLA.SWRST register for details. 28.5.2.3 User Multiplexer Setup The user multiplexer defines the channel to be connected to which event user. Each user multiplexer is dedicated to one event user. A user multiplexer receives all event channels output and must be configured to select one of these channels, as shown in Block Diagram section. The channel is selected with the Channel bit group in the User register
(USERm.CHANNEL). The user multiplexer must always be configured before the channel. A list of all available event users is found in the User (USERm) register description. Related Links 28.3. Block Diagram 28.5.2.4 Event System Channel An event channel can select one event from a list of event generators. Depending on configuration, the selected event could be synchronized, resynchronized or asynchronously sent to the users. When synchronization or resynchronization is required, the channel includes an internal edge detector, allowing the Event System to generate internal events when rising, falling or both edges are detected on the selected event generator. An event channel is able to generate internal events for the specific software commands. A channel block diagram is shown in Block Diagram section. Related Links 28.3. Block Diagram 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 535 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.5.2.5 Event Generators Each event channel can receive the events form all event generators. All event generators are listed in the Event Generator bit field in the Channel n register (CHANNELn.EVGEN). For details on event generation, refer to the corresponding module chapter. The channel event generator is selected by the Event Generator bit group in the Channel register (CHANNELn.EVGEN). By default, the channels are not connected to any event generators (ie, CHANNELn.EVGEN = 0) 28.5.2.6 Channel Path There are different ways to propagate the event from an event generator:
Asynchronous path Resynchronized path The path is decided by writing to the Path Selection bit group of the Channel register (CHANNELn.PATH). Asynchronous Path When using the asynchronous path, the events are propagated from the event generator to the event user without intervention from the Event System. The GCLK for this channel (GCLK_EVSYS_CHANNEL_n) is not mandatory, meaning that an event will be propagated to the user without any clock latency. When the asynchronous path is selected, the channel cannot generate any interrupts, and the Channel x Status register (CHSTATUSx) is always zero. The edge detection is not required and must be disabled by software. Each peripheral event user has to select which event edge must trigger internal actions. For further details, refer to each peripheral chapter description. Resynchronized Path The resynchronized path are used when the event generator and the event channel do not share the same generator for the generic clock. When the resynchronized path is used, resynchronization of the event from the event generator is done in the channel. When the resynchronized path is used, the channel is able to generate interrupts. The channel status bits in the Channel Status register (CHSTATUS) are also updated and available for use. 28.5.2.7 Edge Detection When synchronous or resynchronized paths are used, edge detection must be enabled. The event system can execute edge detection in three different ways:
Generate an event only on the rising edge Generate an event only on the falling edge Generate an event on rising and falling edges. Edge detection is selected by writing to the Edge Selection bit group of the Channel register (CHANNELn.EDGSEL). 28.5.2.8 Event Latency The latency from event generator to event user depends on the channel's configuration:
Asynchronous Path: The maximum routing latency of an external event is related to the internal signal routing and it is device dependent. Resynchronized Path: The maximum routing latency of an external event is three GCLK_EVSYS_CHANNEL_n clock cycles. The maximum propagation latency of a user event to the peripheral clock core domain is three peripheral clock cycles. The event generators, event channel and event user clocks ratio must be selected in relation with the internal event latency constraints. Events propagation or event actions in peripherals may be lost if the clock setup violates the internal latencies. 28.5.2.9 The Overrun Channel n Interrupt The Overrun Channel n Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAGn.OVR) will be set, and the optional interrupt will be generated in the following cases:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 536 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) One or more event users on channel n is not ready when there is a new event An event occurs when the previous event on channel m has not been handled by all event users connected to that channel The flag will only be set when using resynchronized paths. In the case of asynchronous path, the INTFLAGn.OVR is always read as zero. 28.5.2.10 The Event Detected Channel n Interrupt The Event Detected Channel n Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAGn.EVD) is set when an event coming from the event generator configured on channel n is detected. The flag will only be set when using a resynchronized path. In the case of an asynchronous path, the INTFLAGn.EVD is always zero. 28.5.2.11 Channel Status The Channel Status register (CHSTATUS) shows the status of the channels when using a synchronous or resynchronized path. There are two different status bits in CHSTATUS for each of the available channels:
The CHSTATUSn.BUSYCH bit will be set when an event on the corresponding channel n has not been handled by all event users connected to that channel. The CHSTATUSn.RDYUSR bit will be set when all event users connected to the corresponding channel are ready to handle incoming events on that channel. 28.5.2.12 Software Event A software event can be initiated on a channel by writing a '1' to the Software Event bit in the Channel register
(SWEVT.CHANNELn). Then the software event can be serviced as any event generator; i.e., when a bit is set to 1, the corresponding event will be generated on the respective channel. 28.5.2.13 Interrupt Status and Interrupts Arbitration The Interrupt Status register stores all channels with pending interrupts, as shown below. Figure 28-2. Interrupt Status Register 31 30 1 0 INTSTATUS CHINTFLAG31.OVR CHINTENSET31.OVR CHINTFLAG31.EVD CHINTENSET31.EVD CHINTFLAG0.OVR CHINTENSET0.OVR CHINTFLAG0.EVD CHINTENSET0.EVD The Event System can arbitrate between all channels with pending interrupts. The arbiter can be configured to prioritize statically or dynamically the incoming events. The priority is evaluated each time a new channel has an interrupt pending, or an interrupt has been cleared. The Channel Pending Interrupt register (INTPEND) will provide the channel number with the highest interrupt priority, and the corresponding channel interrupt flags and status bits. By default, static arbitration is enabled (PRICTRL.RRENx is '0'), the arbiter will prioritize a low channel number over a high channel number as shown below. When using the status scheme, there is a risk of high channel numbers never being granted access by the arbiter. This can be avoided using a dynamic arbitration scheme. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 537 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) Figure 28-3. Static Priority Lowest Channel Channel 0 Highest Priority
. Channel x Channel x+1
. Highest Channel Channel N Lowest Priority The dynamic arbitration scheme available in the Event System is round-robin. Round-robin arbitration is enabled by writing PRICTRL.RREN to one. With the round-robin scheme, the channel number of the last channel being granted access will have the lowest priority the next time the arbiter has to grant access to a channel, as shown below. The channel number of the last channel being granted access, will be stored in the Channel Priority Number bit group in the Priority Control register (PRICTRL.PRI). Figure 28-4. Round-Robin Scheduling Channel x last acknowledge request Channel (x+1) last acknowledge request Channel 0 Channel 0 Channel x Channel x+1 Lowest Priority Highest Priority Channel N
. Channel x Channel x+1 Channel x+2
. Channel N Lowest Priority Highest Priority 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 538 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) The Channel Pending Interrupt register (INTPEND) also offers the possibility to indirectly clear the interrupt flags of a specific channel. Writing a flag to one in this register, will clear the corresponding interrupt flag of the channel specified by the INTPEND.ID bits. 28.5.3 Interrupts The EVSYS has the following interrupt sources for each channel:
Overrun Channel n interrupt (OVR) Event Detected Channel n interrupt (EVD) These interrupts events are asynchronous wake-up sources. Each interrupt source has an interrupt flag associated with it. The interrupt flag in the corresponding Channel n Interrupt Flag Status and Clear (CHINTFLAG) register is set when the interrupt condition occurs. Note:Interrupts must be globally enabled to allow the generation of interrupt requests. Each interrupt can be individually enabled by writing a '1' to the corresponding bit in the Channel n Interrupt Enable Set (CHINTENSET) register, and disabled by writing a '1' to the corresponding bit in the Channel n Interrupt Enable Clear (CHINTENCLR) register. An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled or the Event System is reset. All interrupt requests are ORed together on system level to generate one combined interrupt request to the NVIC. The user must read the Channel Interrupt Status (INTSTATUS) register to identify the channels with pending interrupts, and must read the Channel n Interrupt Flag Status and Clear (CHINTFLAG) register to determine which interrupt condition is present for the corresponding channel. It is also possible to read the Interrupt Pending register
(INTPEND), which provides the highest priority channel with pending interrupt and the respective interrupt flags. 28.5.4 Sleep Mode Operation The Event System can generate interrupts to wake up the device from Idle or Standby mode. To be able to run in standby, the run in Standby bit in the Channel register (CHANNELn.RUNSTDBY) must be set to '1'. When the Generic Clock On Demand bit in the Channel register (CHANNELn.ONDEMAND) is set to '1' and the event generator is detected, the event channel will request its clock (GCLK_EVSYS_CHANNEL_n). The event latency for a resynchronized channel path will increase by two GCLK_EVSYS_CHANNEL_n clock (that is., up to five GCLK_EVSYS_CHANNEL_n clock cycles). A channel will behave differently in different sleep modes regarding to CHANNELn.RUNSTDBY and CHANNELn.ONDEMAND:
Table 28-1. Event Channel Sleep Behavior CHANNELn.PATH CHANNELn. ONDEMAND CHANNELn. RUNSTDBY Sleep Behavior ASYNC SYNC/RESYNC SYNC/RESYNC SYNC/RESYNC SYNC/RESYNC 0 0 0 1 1 0 0 1 0 1 Only run in Idle mode if an event must be propagated. Disabled in Standby mode. N/A. Works only in Active mode. Run in both Idle and Standby modes. Only run in Idle mode if an event must be propagated. Disabled in Standby mode. Two GCLK_EVSYS_n latency added in RESYNC path before the event is propagated internally. Run in both Idle and Standby modes. Two GCLK_EVSYS_n latency added in RESYNC path before the event is propagated internally. Note:The ONDEMAND and RUNSTDBY bits have no effect for channels when asynchronous path is selected. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 539 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.6 Register Summary Offset 0x00 0x01
... 0x03 Name CTRLA Reserved 0x04 SWEVT 0x08 0x09
... 0x0F 0x10 0x12
... 0x13 PRICTRL Reserved INTPEND Reserved 0x14 INTSTATUS 0x18 BUSYCH 0x1C READYUSR 0x20 CHANNEL0 0x24 0x25 0x26 0x27 CHINTENCLR0 CHINTENSET0 CHINTFLAG0 CHSTATUSn0 0x28 CHANNEL1 0x2C 0x2D 0x2E 0x2F CHINTENCLR1 CHINTENSET1 CHINTFLAG1 CHSTATUSn1 0x30 CHANNEL2 0x34 0x35 0x36 0x37 CHINTENCLR2 CHINTENSET2 CHINTFLAG2 CHSTATUSn2 Bit Pos. 7 6 5 4 3 2 1 0 SWRST CHANNEL7 CHANNEL6 CHANNEL5 CHANNEL4 CHANNEL3 CHANNEL2 CHANNEL1 CHANNEL0 CHANNEL15 CHANNEL14 CHANNEL13 CHANNEL12 CHANNEL11 CHANNEL10 CHANNEL9 CHANNEL8 CHANNEL23 CHANNEL22 CHANNEL21 CHANNEL20 CHANNEL19 CHANNEL18 CHANNEL17 CHANNEL16 CHANNEL31 CHANNEL30 CHANNEL29 CHANNEL28 CHANNEL27 CHANNEL26 CHANNEL25 CHANNEL24 RREN PRI[4:0]
ID[4:0]
BUSY READY EVD OVR CHINT7 CHINT6 CHINT5 CHINT4 CHINT3 CHINT2 CHINT11 CHINT10 CHINT1 CHINT9 CHINT0 CHINT8 BUSYCH7 BUSYCH6 BUSYCH5 BUSYCH4 BUSYCH3 BUSYCH2 BUSYCH1 BUSYCH0 BUSYCH11 BUSYCH10 BUSYCH9 BUSYCH8 7:0 7:0 15:8 23:16 31:24 7:0 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 READYUSR7 READYUSR6 READYUSR5 READYUSR4 READYUSR3 READYUSR2 READYUSR1 READYUSR0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 READYUSR1 1 READYUSR1 0 READYUSR9 READYUSR8 ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 540 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x38 CHANNEL3 0x3C 0x3D 0x3E 0x3F CHINTENCLR3 CHINTENSET3 CHINTFLAG3 CHSTATUSn3 0x40 CHANNEL4 0x44 0x45 0x46 0x47 CHINTENCLR4 CHINTENSET4 CHINTFLAG4 CHSTATUSn4 0x48 CHANNEL5 0x4C 0x4D 0x4E 0x4F CHINTENCLR5 CHINTENSET5 CHINTFLAG5 CHSTATUSn5 0x50 CHANNEL6 0x54 0x55 0x56 0x57 CHINTENCLR6 CHINTENSET6 CHINTFLAG6 CHSTATUSn6 0x58 CHANNEL7 0x5C 0x5D 0x5E 0x5F CHINTENCLR7 CHINTENSET7 CHINTFLAG7 CHSTATUSn7 0x60 CHANNEL8 0x64 0x65 0x66 0x67 CHINTENCLR8 CHINTENSET8 CHINTFLAG8 CHSTATUSn8 0x68 CHANNEL9 0x6C 0x6D 0x6E 0x6F CHINTENCLR9 CHINTENSET9 CHINTFLAG9 CHSTATUSn9 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 541 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
EVD EVD EVD OVR OVR OVR BUSYCH RDYUSR ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 0x70 CHANNEL10 0x74 0x75 0x76 0x77 CHINTENCLR10 CHINTENSET10 CHINTFLAG10 CHSTATUSn10 0x78 CHANNEL11 0x7C 0x7D 0x7E 0x7F CHINTENCLR11 CHINTENSET11 CHINTFLAG11 CHSTATUSn11 0x80 CHANNEL12 0x84
... 0x87 Reserved 0x88 CHANNEL13 0x8C
... 0x8F Reserved 0x90 CHANNEL14 0x94
... 0x97 Reserved 0x98 CHANNEL15 0x9C
... 0x9F Reserved 0xA0 CHANNEL16 0xA4
... 0xA7 Reserved 0xA8 CHANNEL17 0xAC
... 0xAF Reserved 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 542 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 0xB0 CHANNEL18 0xB4
... 0xB7 Reserved 0xB8 CHANNEL19 0xBC
... 0xBF Reserved 0xC0 CHANNEL20 0xC4
... 0xC7 Reserved 0xC8 CHANNEL21 0xCC
... 0xCF Reserved 0xD0 CHANNEL22 0xD4
... 0xD7 Reserved 0xD8 CHANNEL23 0xDC
... 0xDF Reserved 0xE0 CHANNEL24 0xE4
... 0xE7 Reserved 0xE8 CHANNEL25 0xEC
... 0xEF Reserved 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 543 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS)
...........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0xF0 CHANNEL26 0xF4
... 0xF7 Reserved 0xF8 CHANNEL27 0xFC
... 0xFF Reserved 0x0100 CHANNEL28 0x0104
... 0x0107 Reserved 0x0108 CHANNEL29 0x010C
... 0x010F Reserved 0x0110 CHANNEL30 0x0114
... 0x0117 Reserved 0x0118 CHANNEL31 0x011C
... 0x011F 0x0120
... Reserved USER0 0x0153 USER51 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 7:0 ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
ONDEMAND RUNSTDBY EDGSEL[1:0]
PATH[1:0]
EVGEN[7:0]
CHANNEL[7:0]
CHANNEL[7:0]
28.7 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. For more details, see Register Access Protection and Peripheral Access Controller (PAC) from Related Links. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 544 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) Related Links 28.4.8. Register Access Protection 26. Peripheral Access Controller (PAC) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 545 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection CTRLA 0x00 0x00 Bit 7 6 5 4 3 2 1 Access Reset Bit 0 SWRSTSoftware Reset Writing '0' to this bit has no effect. Writing '1' to this bit resets all registers in the EVSYS to their initial state. Note:Before applying a Software Reset it is recommended to disable the event generators. 0 SWRST W 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 546 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.2 Software Event Name:
Offset:
Reset:
Property: PAC Write-Protection SWEVT 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 CHANNEL31 CHANNEL30 CHANNEL29 CHANNEL28 CHANNEL27 CHANNEL26 CHANNEL25 CHANNEL24 Access Reset Bit W 0 23 W 0 22 W 0 21 W 0 20 W 0 19 W 0 18 W 0 17 W 0 16 CHANNEL23 CHANNEL22 CHANNEL21 CHANNEL20 CHANNEL19 CHANNEL18 CHANNEL17 CHANNEL16 Access Reset Bit W 0 15 W 0 14 W 0 13 W 0 12 CHANNEL15 CHANNEL14 CHANNEL13 CHANNEL12 W 0 W 0 W 0 W 0 W 0 W 0 11 CHANNEL11 W 0 10 CHANNEL10 W 0 9 CHANNEL9 W 0 Access Reset Bit W 0 7 CHANNEL7 Access Reset W 0 6 CHANNEL6 W 0 5 CHANNEL5 W 0 4 CHANNEL4 W 0 3 CHANNEL3 W 0 2 CHANNEL2 W 0 1 CHANNEL1 W 0 W 0 8 CHANNEL8 W 0 0 CHANNEL0 W 0 Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 CHANNELx Channel x Software Selection [x=0..7]
Writing a '0' to this bit has no effect. Writing a '1' to this bit will trigger a software event for channel x. These bits always return '0' when read. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 547 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.3 Priority Control Name:
Offset:
Reset:
Property: PAC Write-Protection PRICTRL 0x08 0x00 Bit Access Reset 7 RREN RW 0 6 5 4 RW 0 3 RW 0 2 PRI[4:0]
RW 0 1 RW 0 0 RW 0 Bit 7 RRENRound-Robin Scheduling Enable For details on scheduling schemes, refer to Interrupt Status and Interrupts Arbitration Value 0 1 Description Static scheduling scheme for channels with level priority Round-robin scheduling scheme for channels with level priority Bits 4:0 PRI[4:0]Channel Priority Number When round-robin arbitration is enabled (PRICTRL.RREN=1) for priority level, this register holds the channel number of the last EVSYS channel being granted access as the active channel with priority level. The value of this bit group is updated each time the INTPEND or any of CHINTFLAG registers are written. When static arbitration is enabled (PRICTRL.RREN=0) for priority level, and the value of this bit group is nonzero, it will not affect the static priority scheme. This bit group is not reset when round-robin scheduling gets disabled (PRICTRL.RREN written to zero). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 548 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.4 Channel Pending Interrupt Name:
Offset:
Reset:
INTPEND 0x10 0x4000 An interrupt that handles several channels must consult the INTPEND register to find out which channel number has priority (ignoring/filtering each channel that has its own interrupt line). An interrupt dedicated to only one channel must not use the INTPEND register. Bit Access Reset 15 BUSY R 0 14 READY R 1 13 12 11 10 Bit 7 6 5 Access Reset Bit 15 BUSYBusy 4 RW 0 3 RW 0 2 ID[4:0]
RW 0 9 EVD RW 0 1 RW 0 8 OVR RW 0 0 RW 0 This bit is read '1' when the event on a channel selected by Channel ID field (ID) has not been handled by all the event users connected to this channel. Bit 14 READYReady This bit is read '1' when all event users connected to the channel selected by Channel ID field (ID) are ready to handle incoming events on this channel. Bit 9 EVDChannel Event Detected This flag is set on the next CLK_EVSYS_APB cycle when an event is being propagated through the channel, and an interrupt request will be generated if CHINTENCLR/SET.EVD is '1'. When the event channel path is asynchronous, the EVD bit will not be set. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear it. It will also clear the corresponding flag in the Channel n Interrupt Flag Status and Clear register (CHINTFLAGn) of this peripheral, where n is determined by the Channel ID bit field (ID) in this register. Bit 8 OVRChannel Overrun This flag is set on the next CLK_EVSYS cycle after an overrun channel condition occurs, and an interrupt request will be generated if CHINTENCLR/SET.OVRx is '1'. There are two possible overrun channel conditions:
One or more of the event users on channel selected by Channel ID field (ID) are not ready when a new event occurs An event happens when the previous event on channel selected by Channel ID field (ID) has not yet been handled by all event users When the event channel path is asynchronous, the OVR interrupt flag will not be set. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear it. It will also clear the corresponding flag in the Channel n Interrupt Flag Status and Clear register (CHINTFLAGn) of this peripheral, where n is determined by the Channel ID bit field (ID) in this register. Bits 4:0 ID[4:0]Channel ID These bits store the channel number of the highest priority. When the bits are written, indirect access to the corresponding Channel Interrupt Flag register is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 549 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.5 Interrupt Status Name:
Offset:
Reset:
INTSTATUS 0x14 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 Access Reset Bit Access Reset 7 CHINT7 R 0 6 CHINT6 R 0 5 CHINT5 R 0 4 CHINT4 R 0 11 CHINT11 R 0 3 CHINT3 R 0 10 CHINT10 R 0 2 CHINT2 R 0 9 CHINT9 R 0 1 CHINT1 R 0 8 CHINT8 R 0 0 CHINT0 R 0 Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 CHINTxChannel x Pending Interrupt This bit is set when Channel x has a pending interrupt. This bit is cleared when the corresponding Channel x interrupts are disabled, or the source interrupt sources are cleared. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 550 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.6 Busy Channels Name:
Offset:
Reset:
BUSYCH 0x18 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 Access Reset 11 BUSYCH11 R 0 10 BUSYCH10 R 0 Bit 7 BUSYCH7 Access Reset R 0 6 BUSYCH6 R 0 5 BUSYCH5 R 0 4 BUSYCH4 R 0 3 BUSYCH3 R 0 2 BUSYCH2 R 0 9 BUSYCH9 R 0 1 BUSYCH1 R 0 8 BUSYCH8 R 0 0 BUSYCH0 R 0 Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 BUSYCHxBusy Channel x This bit is set if an event occurs on channel x has not been handled by all event users connected to channel x. This bit is cleared when channel x is idle. When the event channel x path is asynchronous, this bit is always read '0'. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 551 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.7 Ready Users Name:
Offset:
Reset:
READYUSR 0x1C 111111111111 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 READYUSR11 READYUSR10 READYUSR9 READYUSR8 R 1 3 R 1 2 R 1 1 R 1 0 READYUSR7 READYUSR6 READYUSR5 READYUSR4 READYUSR3 READYUSR2 READYUSR1 READYUSR0 Access Reset R 1 R 1 R 1 R 1 R 1 R 1 R 1 R 1 Bits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 READYUSRnReady User for Channel n This bit is set when all event users connected to channel n are ready to handle incoming events on channel n. This bit is cleared when at least one of the event users connected to the channel is not ready. When the event channel n path is asynchronous, this bit is always read zero. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 552 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.8 Channel n Control Name:
Offset:
Reset:
Property: PAC Write-Protection, Mix-Secure CHANNEL 0x20 + n*0x08 [n=0..31]
0x00008000 This register allows the user to configure channel n. To write to this register, do a single, 32-bit write of all the configuration data. Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 ONDEMAND Access Reset RW 1 14 RUNSTDBY RW 0 13 12 11 10 EDGSEL[1:0]
RW 0 3 RW 0 RW 0 2 RW 0 PATH[1:0]
9 RW 0 1 RW 0 8 RW 0 0 RW 0 Bit 7 Access Reset RW 0 6 RW 0 5 RW 0 EVGEN[7:0]
4 RW 0 Bit 15 ONDEMANDGeneric Clock On Demand Value 0 1 Description Generic clock for a channel is always on, if the channel is configured and generic clock source is enabled. Generic clock is requested on demand while an event is handled Bit 14 RUNSTDBYRun in Standby This bit is used to define the behavior during standby sleep mode. Value 0 1 Description The channel is disabled in standby sleep mode. The channel is not stopped in standby sleep mode and depends on the CHANNEL.ONDEMAND bit. Bits 11:10 EDGSEL[1:0]Edge Detection Selection These bits set the type of edge detection to be used on the channel. These bits must be written to zero when using the asynchronous path. Value 0x0 0x1 0x2 0x3 Name NO_EVT_OUTPUT No event output when using the resynchronized path RISING_EDGE FALLING_EDGE BOTH_EDGES Event detection only on the rising edge of the signal from the event generator Event detection only on the falling edge of the signal from the event generator Event detection on rising and falling edges of the signal from the event generator Description Bits 9:8 PATH[1:0]Path Selection These bits are used to choose which path will be used by the selected channel. Note:The path choice can be limited by the channel source (see USERm from Related Links). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 553 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) Important:Only EVSYS channel 0 to 3 can be configured as synchronous or resynchronized. Value 0x1 0x2 Other Name RESYNCHRONIZED ASYNCHRONOUS
Description Resynchronized path Asynchronous path Reserved Bits 7:0 EVGEN[7:0]Event Generator Selection These bits are used to choose the event generator to connect to the selected channel. Table 28-2. Event Generator Selection Name RTC_PERx RTC_CMPx RTC_TAMPER RTC_OVF EIC_EXTINTx DMAC_CHx PAC_ACCERR TCC0_OVF TCC0_TRG TCC0_CNT TCC0_MCx TCC1_OVF TCC1_TRG TCC1_CNT TCC1_MCx TCC2_OVF TCC2_TRG TCC2_CNT TCC2_MCx TC0_OVF TC0_MCx TC1_OVF TC1_MCx TC2_OVF TC2_MCx TC3_OVF TC3_MCx ADC_RESRDY Not used AC_COMPx AC_WIN_0 TRNG_READY CCL_LUTOUTx ZB_TX_TS_ACTIVE ZB_RX_TS_ACTIVE Value 0x00 - 0x07 0x08 - 0x0B 0x0C 0x0D 0x0E - 0x11 0x12 - 0x15 0x16 0x17 0x18 0x19 0x1A-0x1F 0x20 0x21 0x22 0x23 - 0x28 0x29 0x2A 0x2B 0x2C - 0x2D 0x2E 0x2F-0x30 0x31 0x32 - 0x33 0x34 0x35 - 0x36 0x37 0x38 - 0x39 0x3A 0x3B - 0x3C 0x3D - 0x3E 0x3F 0x40 0x41 - 0x42 0x43 0x44 Related Links 28.7.13. USERm Description RTC period x=0..7 RTC comparison x=0..3 RTC tamper detection RTC Overflow EIC external interrupt x=0..3 DMA channel x=0..3 PAC Acc. error TCC0 Overflow TCC0 Trigger Event TCC0 Counter TCC0 Match/Compare x=0..5 TCC1 Overflow TCC1 Trigger Event TCC1 Counter TCC1 Match/Compare x=0..5 TCC2 Overflow TCC2 Trigger Event TCC2 Counter TCC2 Match/Compare x=0..1 TC0 Overflow TC0 Match/Compare x=0..1 TC1 Overflow TC1 Match/Compare x=0..1 TC2 Overflow TC2 Match/Compare x=0..1 TC3 Overflow TC3 Match/Compare x=0..1 ADC End-Of-Scan Ready Interrupt AC Comparator, x=0..1 AC0 Window TRNG ready CCL LUTOUT x-0..1 Zigbee Transmit Packet Active time Zigbee Receive Packet Active time 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 554 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.9 Channel n Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection CHINTENCLR 0x24 + n*0x08 [n=0..11]
0x00 Bit 7 6 5 4 3 2 Access Reset 1 EVD RW 0 0 OVR RW 0 Bit 1 EVDChannel Event Detected Interrupt Disable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Event Detected Channel Interrupt Enable bit, which disables the Event Detected Channel interrupt. Value 0 1 Description The Event Detected Channel interrupt is disabled. The Event Detected Channel interrupt is enabled. Bit 0 OVRChannel Overrun Interrupt Disable Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Overrun Channel Interrupt Enable bit, which disables the Overrun Channel interrupt. Value 0 1 Description The Overrun Channel interrupt is disabled. The Overrun Channel interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 555 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.10 Channel n Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection CHINTENSET 0x25 + n*0x08 [n=0..11]
0x00 Bit 7 6 5 4 3 2 Access Reset 1 EVD RW 0 0 OVR RW 0 Bit 1 EVDChannel Event Detected Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Event Detected Channel Interrupt Enable bit, which enables the Event Detected Channel interrupt. Value 0 1 Description The Event Detected Channel interrupt is disabled. The Event Detected Channel interrupt is enabled. Bit 0 OVRChannel Overrun Interrupt Enable Writing a 0 to this bit has no effect. Writing a 1 to this bit will set the Overrun Channel Interrupt Enable bit, which enables the Overrun Channel interrupt. Value 0 1 Description The Overrun Channel interrupt is disabled. The Overrun Channel interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 556 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.11 Channel n Interrupt Flag Status and Clear Name:
Offset:
Reset:
CHINTFLAG 0x26 + n*0x08 [n=0..11]
0x00 Bit 7 6 5 4 3 2 Access Reset Bit 1 EVDChannel Event Detected 1 EVD RW 0 0 OVR RW 0 This flag is set on the next CLK_EVSYS_APB cycle when an event is being propagated through the channel, and an interrupt request will be generated if CHINTENCLR/SET.EVD is 1. When the event channel path is asynchronous, the EVD interrupt flag will not be set. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Event Detected Channel interrupt flag. Bit 0 OVRChannel Overrun This flag is set on the next CLK_EVSYS cycle after an overrun channel condition occurs, and an interrupt request will be generated if CHINTENCLR/SET.OVR is 1. There are two possible overrun channel conditions:
One or more of the event users on the channel are not ready when a new event occurs. An event happens when the previous event on channel has not yet been handled by all event users. When the event channel path is asynchronous, the OVR interrupt flag will not be set. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the Overrun Channel interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 557 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.12 Channel n Status Name:
Offset:
Reset:
CHSTATUSn 0x27 + n*0x08 [n=0..11]
0x01 Bit 7 6 5 4 3 2 Access Reset Bit 1 BUSYCHBusy Channel 1 BUSYCH R 0 0 RDYUSR R 0 This bit is cleared when channel is idle. This bit is set if an event on channel has not been handled by all event users connected to channel. When the event channel path is asynchronous, this bit is always read '0'. Bit 0 RDYUSRReady User This bit is cleared when at least one of the event users connected to the channel is not ready. This bit is set when all event users connected to channel are ready to handle incoming events on the channel. When the event channel path is asynchronous, this bit is always read zero. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 558 PIC32CX-BZ2 and WBZ45 Family Event System (EVSYS) 28.7.13 Event User m Name:
Offset:
Reset:
Property: PAC Write-Protection USERm 0x0120 + m*0x01 [m=0..51]
0x0 Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 4 3 CHANNEL[7:0]
R/W 0 R/W 0 2 R/W 0 1 R/W 0 0 R/W 0 Bits 7:0 CHANNEL[7:0]Channel Event Selection These bits select channel n to connect to the event user m. Note:A value x of this bit field selects channel n = x-1. USERm m = 0 m = 1..8 m = 9 m = 10 m = 11 m = 12..13 m = 14..19 m = 20..21 m = 22..27 m = 28..29 m = 30..31 m = 32 m = 33 m = 34 m = 35 m = 36..47 m = 48..49 m = 50..51 UserMultiplexer RTC_TAMPER DMAC_CH0..7 CM4_TRACE_START CM4_TRACE_STOP CM4_TRACE_TRIG TCC0EV0..1 TCC0MC0..5 TCC1EV0..1 TCC1MC0..5 TCC2EV0..1 TCC2MC0..1 TC0 EVU TC1 EVU TC2 EVU TC3 EVU ADC_TRIGGER5..16 AC_SOC0..1 CCL_LUTIN0..1 Description RTCTamper Channel0..7 CM4trace start CM4trace stop CM4trace trigger TCC0 EVx TCC0 MCx TCC1 EVx TCC1 MCx TCC2 EVx TCC2 MCx TC0 EVU TC1 EVU TC2 EVU TC3 EVU ADC_TRIGGERx AC_SOCx CCL_LUTINx PathType(1) A, S, R S, R A, S, R A, S, R A, S, R A, S, R A, S, R A, S, R A, S, R A, S, R A, S, R A, S, R A, S, R A, S, R A, S, R A A, S, R A, S, R 1) A = Asynchronous path, S = Synchronous path, R = Resynchronized path Value 11 10 01 00 Description 12 bits (default) 10 bits 8 bits 6 bits 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 559 PIC32CX-BZ2 and WBZ45 Family Serial Communication Interface (SERCOM) 29. Serial Communication Interface (SERCOM) 29.1 Overview There are instances of the Serial Communication interface (SERCOM) peripheral. A SERCOM can be configured to support a number of modes: I2C, SPI and USART. When an instance of SERCOM is configured and enabled, all of the resources of that SERCOM instance will be dedicated to the selected mode. The SERCOM serial engine consists of a transmitter and receiver, baud-rate generator and address matching functionality. It can use the internal generic clock or an external clock. Using an external clock allows the SERCOM to be operated in all Sleep modes. Note:Traditional Serial Communication Interface documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Host and Client, respectively. Note:SERCOM3 (4th instance of SERCOM) is only supported using Peripheral Pin Select (PPS). 29.2 Features Interface for Configuring into one of the following (selected by CTRLA.MODE[2:0]):
Inter-Integrated Circuit (I2C) two-wire serial interface System Management Bus (SMBus) compatible Serial Peripheral Interface (SPI) Universal Synchronous/Asynchronous Receiver/Transmitter (USART) Single Transmit Buffer and Double Receive Buffer Baud-rate Generator Address Match/mask Logic Operational in all Sleep modes with an External Clock Source Can be used with DMA See the Related Links for full feature lists of the interface configurations. 29.3 Block Diagram Figure 29-1. SERCOM Block Diagram SERCOM Register Interface CONTROL/STATUS TX/RX DATA BAUD/ADDR Mode Specific Mode n Mode 1 Mode 0 Serial Engine Transmitter Receiver Baud Rate Generator Address Match PAD[3:0]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 560 PIC32CX-BZ2 and WBZ45 Family Serial Communication Interface (SERCOM) 29.4 Signal Description See the respective SERCOM mode chapters for details. 29.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 29.5.1 I/O Lines Using the SERCOM I/O lines requires the I/O pins to be configured using the System Configuration registers or PPS registers. The SERCOM has four internal pads, PAD[3:0], and the signals from I2C, SPI and USART are routed through these SERCOM pads through a multiplexer. The configuration of the multiplexer is available from the different SERCOM modes. Refer to the mode specific chapters for additional information. 29.5.2 Power Management The SERCOM can operate in any Sleep mode provided the selected clock source is running. SERCOM interrupts can be configured to wake the device from sleep modes. 29.5.3 Clocks The SERCOM uses two generic clocks: GCLK_SERCOMx_CORE and GCLK_SERCOMx_SLOWGCLK_SERCOMx_SLOW. The core clock (GCLK_SERCOMx_CORE) is required to clock the SERCOM while working as a host. The slow clock (GCLK_SERCOMx_SLOW) is only required for certain functions. See specific mode chapters for details. These clocks must be configured and enabled in the Clock and Reset Unit (CRU) registers before using the SERCOM. The generic clocks are asynchronous to the bus clock (PBx_CLK). Therefore, writing to certain registers will require synchronization between the clock domains. 29.5.4 DMA The DMA request lines are connected to the DMA Controller (DMAC). The DMAC must be configured before the SERCOM DMA requests are used. 29.5.5 Interrupts The interrupt request line is connected to the Interrupt Controller (NVIC). The NVIC must be configured before the SERCOM interrupts are used. 29.5.6 Events Not applicable. 29.5.7 Debug Operation When the CPU is halted in Debug mode, this peripheral will continue normal operation. If the peripheral is configured to require periodical service by the CPU through interrupts or similar, improper operation or data loss may result during debugging. This peripheral can be forced to halt operation during debugging - refer to the Debug Control
(DBGCTRL) register for details. 29.5.8 Register Access Protection Registers with write-access can be write-protected optionally by the Peripheral Access Controller (PAC). Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. PAC write protection does not apply to accesses through an external debugger. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 561 PIC32CX-BZ2 and WBZ45 Family Serial Communication Interface (SERCOM) 29.5.9 Analog Connections Not applicable. 29.6 Functional Description 29.6.1 Principle of Operation The basic structure of the SERCOM serial engine is shown in SERCOM Serial Engine. Labels in capital letters are synchronous to the system clock and accessible by the CPU; labels in lowercase letters can be configured to run on the GCLK_SERCOMx_CORE clock or an external clock. Figure 29-2. SERCOM Serial Engine Selectable Internal Clk
(GCLK) Ext Clk Transmitter Address Match BAUD TX DATA ADDR/ADDRMASK Baud Rate Generator 1/- /2- /16 TX Shift Register Receiver RX Shift Register Baud Rate Generator Status RX Buffer STATUS RX DATA Equal The transmitter consists of a single write buffer and a Shift register. The receiver consists of a one-level (I2C), or two-level (USART, SPI) receive buffer and a Shift register. The baud-rate generator is capable of running on the GCLK_SERCOMx_CORE clock or an external clock. Address matching logic is included for SPI and I2C operation. 29.6.2 Basic Operation 29.6.2.1 Initialization The SERCOM must be configured to the desired mode by writing the Operating Mode bits in the Control A register
(CTRLA.MODE) as shown in the table below. Table 29-1. SERCOM Modes CTRLA.MODE Description 0x0 0x1 0x2 0x3 0x4 USART with external clock USART with internal clock SPI in client operation SPI in host operation I2C client operation 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 562 PIC32CX-BZ2 and WBZ45 Family Serial Communication Interface (SERCOM)
...........continued CTRLA.MODE 0x5 0x6-0x7 Description I2C host operation Reserved For further initialization information, see the respective SERCOM mode chapters:
29.6.2.2 Enabling, Disabling, and Resetting This peripheral is enabled by writing '1' to the Enable bit in the Control A register (CTRLA.ENABLE), and disabled by writing '0' to it. Writing 1 to the Software Reset bit in the Control A register (CTRLA.SWRST) will reset all registers of this peripheral to their initial states, except the DBGCTRL register, and the peripheral is disabled. Refer to the CTRLA register description for details. Related Links 30.8.1. CTRLA 29.6.2.3 Clock Generation Baud-Rate Generator The baud-rate generator, as shown in the following figure, generates internal clocks for asynchronous and synchronous communication. The output frequency (fBAUD) is determined by the Baud register (BAUD) setting and the baud reference frequency (fref). The baud reference clock is the serial engine clock, and it can be internal or external. For asynchronous communication, the /16 (divide-by-16) output is used when transmitting, whereas the /1 (divide-
by-1) output is used while receiving. For synchronous communication, the /2 (divide-by-2) output is used. This functionality is automatically configured, depending on the selected operating mode. Figure 29-3. Baud Rate Generator Selectable Internal Clk
(GCLK) Ext Clk Baud Rate Generator fref 1 0 Base Period
/2
/8 CTRLA.MODE[0]
/1
/2
/16 Tx Clk CTRLA.MODE Rx Clk 0 1 1 0 1 0 Clock Recovery The following table contains equations for the baud rate (in bits per second) and the BAUD register value for each operating mode. For asynchronous operation, there are two modes:
Arithmetic mode: the BAUD register value is 16 bits (0 to 65,535) Fractional mode: the BAUD register value is 13 bits, while the fractional adjustment is 3 bits. In this mode the BAUD setting must be greater than or equal to 1. For synchronous operation, the BAUD register value is 8 bits (0 to 255). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 563 PIC32CX-BZ2 and WBZ45 Family Serial Communication Interface (SERCOM) Table 29-2. Baud Rate Equations Operating Mode Condition Baud Rate (Bits Per Second) BAUD Register Value Calculation Asynchronous Arithmetic Asynchronous Fractional Synchronous fBAUD fBAUD fref 16 fref S fBAUD =
fref 16 1 BAUD 65536 fBAUD =
fref S BAUD +
FP 8 fBAUD fBAUD =
fref 2 fref 2 BAUD + 1 S - Number of samples per bit, which can be 16, 8, or 3. BAUD = 65536 1 S fBAUD fref BAUD =
fref S fBAUD FP 8 BAUD =
fref 2 fBAUD 1 The Asynchronous Fractional option is used for auto-baud detection. The baud rate error is represented by the following formula:
Error = 1 29.6.3 Additional Features ExpectedBaudRate ActualBaudRate 29.6.3.1 Address Match and Mask The SERCOM address match and mask feature is capable of matching either one address, two unique addresses, or a range of addresses with a mask, based on the mode selected. The match uses seven or eight bits, depending on the mode. 29.6.3.1.1 Address With Mask An address written to the Address bits in the Address register (ADDR.ADDR), and a mask written to the Address Mask bits in the Address register (ADDR.ADDRMASK) will yield an address match. All bits that are masked are not included in the match. Note that writing the ADDR.ADDRMASK to 'all zeros' will match a single unique address, while writing ADDR.ADDRMASK to 'all ones' will result in all addresses being accepted. Figure 29-4. Address With Mask ADDR ADDRMASK
Match rx shift register 29.6.3.1.2 Two Unique Addresses The two addresses written to ADDR and ADDRMASK will cause a match. Figure 29-5. Two Unique Addresses ADDR rx shift register ADDRMASK
Match 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 564 PIC32CX-BZ2 and WBZ45 Family Serial Communication Interface (SERCOM) 29.6.3.1.3 Address Range The range of addresses between and including ADDR.ADDR and ADDR.ADDRMASK will cause a match. ADDR.ADDR and ADDR.ADDRMASK can be set to any two addresses, with ADDR.ADDR acting as the upper limit and ADDR.ADDRMASK acting as the lower limit. Figure 29-6. Address Range ADDRMASK rx shift register ADDR
== Match 29.6.4 DMA Operation The available DMA interrupts and their depend on the operation mode of the SERCOM peripheral. Refer to the Functional Description sections of the respective SERCOM mode. 29.6.5 Interrupts Interrupt sources are mode specific. See the respective SERCOM mode chapters for details. Each interrupt source has its own Interrupt flag. The Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG) will be set when the Interrupt condition is met. Each interrupt can be individually enabled by writing '1' to the corresponding bit in the Interrupt Enable Set register
(INTENSET), and disabled by writing '1' to the corresponding bit in the Interrupt Enable Clear register (INTENCLR). An interrupt request is generated when the Interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until either the Interrupt flag is cleared, the interrupt is disabled, or the SERCOM is reset. For details on clearing Interrupt flags, refer to the INTFLAG register description. The value of INTFLAG indicates which Interrupt condition occurred. The user must read the INTFLAG register to determine which Interrupt condition is present. Note:Interrupts must be globally enabled for interrupt requests to be generated. Related Links 30.8.8. INTFLAG 29.6.6 Events Not applicable. 29.6.7 Sleep Mode Operation The peripheral can operate in any Sleep mode where the selected serial clock is running. This clock can be external or generated by the internal baud-rate generator. The SERCOM interrupts can be used to wake-up the device from Sleep modes. Refer to the different SERCOM mode chapters for details. 29.6.8 Synchronization Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be synchronized when written or read. Required write synchronization is denoted by the "Write-Synchronized" property in the register description. Required read synchronization is denoted by the "Read-Synchronized" property in the register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 565 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30. SERCOM Synchronous and Asynchronous Receiver and Transmitter
(SERCOM USART) 30.1 Overview The Universal Synchronous and Asynchronous Receiver and Transmitter (USART) is one of the available modes in the Serial Communication Interface (SERCOM). The USART uses the SERCOM transmitter and receiver (see USART Block Diagram in the Block Diagram section from Related Links). Labels in uppercase letters are synchronous to PBx_CLK and accessible for CPU. Labels in lowercase letters can be programmed to run on the internal generic clock or an external clock. The transmitter consists of a single write buffer, a Shift register, and control logic for different frame formats. The write buffer supports data transmission without any delay between frames. The receiver consists of a two-level receive buffer and a Shift register. Status information of the received data is available for error checking. Data and clock recovery units ensure robust synchronization and noise filtering during asynchronous data reception. Note:Traditional Universal Synchronous and Asynchronous Receiver and Transmitter (USART) documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Commander and Responder, respectively. Related Links 30.3. Block Diagram 30.2 USART Features Internal or External Clock source for Asynchronous and Synchronous Operation Full-duplex Operation Asynchronous (with Clock Reconstruction) or Synchronous Operation Baud-rate Generator Supports Serial Frames with 5, 6, 7, 8 or 9 Data bits and 1 or 2 Stop bits Odd or Even Parity Generation and Parity Check Selectable LSB- or MSB-first Data Transfer Buffer Overflow and Frame Error Detection Noise Filtering, Including False Start bit Detection and Digital Low-pass Filter Collision Detection Can Operate in all Sleep modes Operation at Speeds up to Half the System Clock for Internally Generated Clocks Operation at Speeds up to the System Clock for Externally Generated Clocks RTS and CTS Flow Control LIN Commander Support LIN Responder Support IrDA Modulation and Demodulation up to 115.2 kbps Auto-baud and break character detection Start-of-frame detection Can work with DMA 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 566 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.3 Block Diagram Figure 30-1. USART Block Diagram GCLK
(internal) BAUD TX DATA Baud Rate Generator CTRLA.MODE
/1 - /2 - /16 TX Shift Register XCK CTRLA.MODE RX Shift Register TxD RxD Status Two-level RX Buffer STATUS RX DATA 30.4 Signal Description Table 30-1. SERCOM USART Signals Signal Name PAD[3:0]
Type Digital I/O Description General SERCOM pins One signal can be mapped to one of several pins. 30.5 Product Dependencies To use this peripheral, other parts of the system must be configured correctly, as described below. 30.5.1 I/O Lines Using the USARTs I/O lines requires the I/O pins to be configured using the System Configuration registers or PPS registers. When the SERCOM is used in USART mode, the SERCOM controls the direction and value of the I/O pins according to the table below. If the receiver or transmitter is disabled, these pins can be used for other purposes. Table 30-2. USART Pin Configuration Pin TxD RxD XCK Pin Configuration Output Input Output or input The combined configuration of PORT and the Transmit Data Pinout and Receive Data Pinout bit fields in the Control A register (CTRLA.TXPO and CTRLA.RXPO, respectively) will define the physical position of the USART signals in the above table. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 567 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.5.2 Power Management This peripheral can continue to operate in any Sleep mode where its source clock is running. The interrupts can wake-up the device from Sleep modes. 30.5.3 Clocks A generic clock (GCLK_SERCOMx_CORE) is required to clock the SERCOMx_CORE. This clock must be configured and enabled in the CRU registers before using the SERCOMx_CORE. See Clock and Reset (CRU) and Peripheral Module Disable Register (PMD) from Related Links. This generic clock is asynchronous to the bus clock (PBx_CLK). Therefore, writing to certain registers will require synchronization to the clock domains. Related Links 20. Peripheral Module Disable Register (PMD) 13. Clock and Reset Unit (CRU) 30.5.4 DMA The DMA request lines are connected to the DMA Controller (DMAC). To use DMA requests with this peripheral, the DMAC must be configured first (see Direct Memory Access Controller (DMAC) from Related Links). Related Links 22. Direct Memory Access Controller (DMAC) 30.5.5 Interrupts The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral, the NVIC must be configured first. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 30.8.8. INTFLAG 30.5.6 Events Not applicable. 30.5.7 Debug Operation When the CPU is halted in Debug mode, this peripheral will continue normal operation. If the peripheral is configured to require periodical service by the CPU through interrupts or similar, improper operation or data loss may result during debugging. This peripheral can be forced to halt operation during debugging - refer to the Debug Control
(DBGCTRL) register for details. Related Links 30.8.12. DBGCTRL 30.5.8 Register Access Protection Registers with write access can be write-protected optionally by the Peripheral Access Controller (PAC). PAC write protection is not available for the following registers:
Interrupt Flag Clear and Status register (INTFLAG) Status register (STATUS) Data register (DATA) Optional PAC write protection is denoted by the "PAC Write-Protection" property in each individual register description. Write-protection does not apply to accesses through an external debugger. 30.5.9 Analog Connections Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 568 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.6 Functional Description 30.6.1 Principle of Operation The USART uses the following lines for data transfer:
RxD for receiving TxD for transmitting XCK for the transmission clock in synchronous operation USART data transfer is frame based. A serial frame consists of:
1 start bit From 5 to 9 data bits (MSB or LSB first) No, even or odd parity bit 1 or 2 stop bits A frame starts with the Start bit followed by one character of Data bits. If enabled, the parity bit is inserted after the Data bits and before the first Stop bit. After the stop bit(s) of a frame, either the next frame can follow immediately, or the communication line can return to the Idle (high) state. The figure below illustrates the possible frame formats. Values inside brackets ([x]) denote optional bits. Figure 30-2. Frame Formats Frame
(IDLE) St 0 1 2 3 4
[5]
[6]
[7]
[8]
[P]
Sp1
[Sp2]
[St/IDL]
St Start bit. Signal is always low. n, [n]
[P]
Data bits. 0 to [5..9]
Parity bit. Either odd or even. Sp, [Sp]
Stop bit. Signal is always high. IDLE No frame is transferred on the communication line. Signal is always high in this state. 30.6.2 Basic Operation 30.6.2.1 Initialization The following registers are enable-protected, meaning they can only be written when the USART is disabled
(CTRL.ENABLE=0):
Control A register (CTRLA), except the Enable (ENABLE) and Software Reset (SWRST) bits. Control B register (CTRLB), except the Receiver Enable (RXEN) and Transmitter Enable (TXEN) bits. Baud register (BAUD) When the USART is enabled or is being enabled (CTRLA.ENABLE=1), any writing attempt to these registers will be discarded. If the peripheral is being disabled, writing to these registers will be executed after disabling is completed. Enable-protection is denoted by the "Enable-Protection" property in the register description. Before the USART is enabled, it must be configured by these steps:
1. 2. Select either external (0x0) or internal clock (0x1) by writing the Operating Mode value in the CTRLA register
(CTRLA.MODE). Select either Asynchronous (0) or Synchronous (1) Communication mode by writing the Communication Mode bit in the CTRLA register (CTRLA.CMODE). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 569 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 3. 4. Select pin for receive data by writing the Receive Data Pinout value in the CTRLA register (CTRLA.RXPO). Select pads for the transmitter and external clock by writing the Transmit Data Pinout bit in the CTRLA register
(CTRLA.TXPO). 7. 5. Configure the Character Size field in the CTRLB register (CTRLB.CHSIZE) for character size. 6. Enable Parity mode by writing 0x1 to the Frame Format field in the CTRLA register (CTRLA.FORM). Set the Data Order bit in the CTRLA register (CTRLA.DORD) to determine MSB- or LSB-first data transmission. To use parity mode:
a. b. Configure the Parity Mode bit in the CTRLB register (CTRLB.PMODE) for even or odd parity. 8. Configure the number of stop bits in the Stop Bit Mode bit in the CTRLB register (CTRLB.SBMODE). 9. When using an internal clock, write the Baud register (BAUD) to generate the desired baud rate. 10. Enable the transmitter and receiver by writing '1' to the Receiver Enable and Transmitter Enable bits in the CTRLB register (CTRLB.RXEN and CTRLB.TXEN). 30.6.2.2 Enabling, Disabling, and Resetting This peripheral is enabled by writing '1' to the Enable bit in the Control A register (CTRLA.ENABLE), and disabled by writing '0' to it. Writing 1 to the Software Reset bit in the Control A register (CTRLA.SWRST) will reset all registers of this peripheral to their initial states, except the DBGCTRL register, and the peripheral is disabled. Refer to the CTRLA register description for details. Related Links 30.8.1. CTRLA 30.6.2.3 Clock Generation and Selection For both Synchronous and Asynchronous modes, the clock used for shifting and sampling data can be generated internally by the SERCOM baud-rate generator or supplied externally through the XCK line. The Synchronous mode is selected by writing a 1 to the Communication Mode bit in the Control A register
(CTRLA.CMODE), the Asynchronous mode is selected by writing 0 to CTRLA.CMODE. The internal clock source is selected by writing 1 to the Operation Mode bit field in the Control A register
(CTRLA.MODE), the external clock source is selected by writing 0 to CTRLA.MODE. The SERCOM baud-rate generator is configured as in the following figure. In Asynchronous mode (CTRLA.CMODE=0), the 16-bit Baud register value is used. In Synchronous mode (CTRLA.CMODE=1), the eight LSBs of the Baud register are used. For more details on configuring the baud rate (see Clock Generation Baud-Rate Generator from Related Links). Figure 30-3. Clock Generation XCKInternal Clk
(GCLK) Baud Rate Generator 1 0 Base Period
/2
/8 CTRLA.MODE[0]
/1
/2
/16 XCK 1 0 Tx Clk CTRLA.CMODE Rx Clk 0 1 1 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 570 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... Related Links 29.6.2.3. Clock Generation Baud-Rate Generator 30.6.2.3.1 Synchronous Clock Operation In Synchronous mode, the CTRLA.MODE bit field determines whether the transmission clock line (XCK) serves either as input or output. The dependency between clock edges, data sampling, and data change is the same for internal and external clocks. Data input on the RxD pin is sampled at the opposite XCK clock edge when data is driven on the TxD pin. The Clock Polarity bit in the Control A register (CTRLA.CPOL) selects which XCK clock edge is used for RxD sampling, and which is used for TxD change:
When CTRLA.CPOL is '0', the data will be changed on the rising edge of XCK, and sampled on the falling edge of XCK. When CTRLA.CPOL is '1', the data will be changed on the falling edge of XCK, and sampled on the rising edge of XCK. Figure 30-4. Synchronous Mode XCK Timing Change CTRLA.CPOL=1 CTRLA.CPOL=0 XCK RxD / TxD XCK RxD / TxD Change Sample When the clock is provided through XCK (CTRLA.MODE=0x0), the Shift registers operate directly on the XCK clock. This means that XCK is not synchronized with the system clock and, therefore, can operate at frequencies up to the system frequency. Sample 30.6.2.4 Data Register The USART Transmit Data register (TxDATA) and USART Receive Data register (RxDATA) share the same I/O address, referred to as the Data register (DATA). Writing the DATA register will update the TxDATA register. Reading the DATA register will return the contents of the RxDATA register. 30.6.2.5 Data Transmission Data transmission is initiated by writing the data to be sent into the DATA register. Then, the data in TxDATA will be moved to the Shift register when the Shift register is empty and ready to send a new frame. After the Shift register is loaded with data, the data frame will be transmitted. When the entire data frame including Stop bit(s) has been transmitted and no new data was written to DATA, the Transmit Complete Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.TXC) will be set, and the optional interrupt will be generated. The Data Register Empty flag in the Interrupt Flag Status and Clear register (INTFLAG.DRE) indicates that the register is empty and ready for new data. The DATA register must be written to when INTFLAG.DRE is set. Disabling the Transmitter The transmitter is disabled by writing 0 to the Transmitter Enable bit in the CTRLB register (CTRLB.TXEN). Disabling the transmitter will complete only after any ongoing and pending transmissions are completed, in other words, there is no data in the transmit shift register and TxDATA to transmit. 30.6.2.5.1 Disabling the Transmitter The transmitter is disabled by writing '0' to the Transmitter Enable bit in the CTRLB register (CTRLB.TXEN). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 571 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... Disabling the transmitter will complete only after any ongoing and pending transmissions are completed, i.e., there is no data in the Transmit Shift register and TxDATA to transmit. 30.6.2.6 Data Reception The receiver accepts data when a valid Start bit is detected. Each bit following the Start bit will be sampled according to the baud rate or XCK clock, and shifted into the receive Shift register until the first Stop bit of a frame is received. The second Stop bit will be ignored by the receiver. When the first Stop bit is received and a complete serial frame is present in the Receive Shift register, the contents of the Shift register will be moved into the two-level receive buffer. Then, the Receive Complete Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.RXC) will be set, and the optional interrupt will be generated. The received data can be read from the DATA register when the Receive Complete Interrupt flag is set. Disabling the Receiver Writing '0' to the Receiver Enable bit in the CTRLB register (CTRLB.RXEN) will disable the receiver, flush the two-level receive buffer, and data from ongoing receptions will be lost. Error Bits The USART receiver has three error bits in the Status (STATUS) register: Frame Error (FERR), Buffer Overflow
(BUFOVF), and Parity Error (PERR). Once an error happens, the corresponding error bit will be set until it is cleared by writing 1 to it. These bits are also cleared automatically when the receiver is disabled. There are two methods for buffer overflow notification, selected by the Immediate Buffer Overflow Notification bit in the Control A register (CTRLA.IBON):
When CTRLA.IBON=1, STATUS.BUFOVF is raised immediately upon buffer overflow. Software can then empty the receive FIFO by reading RxDATA, until the receiver complete interrupt flag (INTFLAG.RXC) is cleared. When CTRLA.IBON=0, the buffer overflow condition is attending data through the receive FIFO. After the received data is read, STATUS.BUFOVF will be set along with INTFLAG.RXC. Asynchronous Data Reception The USART includes a clock recovery and data recovery unit for handling asynchronous data reception. The clock recovery logic can synchronize the incoming asynchronous serial frames at the RxD pin to the internally generated baud-rate clock. The data recovery logic samples and applies a low-pass filter to each incoming bit, thereby improving the noise immunity of the receiver. Asynchronous Operational Range The operational range of the asynchronous reception depends on the accuracy of the internal baud-rate clock, the rate of the incoming frames, and the frame size (in number of bits). In addition, the operational range of the receiver is depending on the difference between the received bit rate and the internally generated baud rate. If the baud rate of an external transmitter is too high or too low compared to the internally generated baud rate, the receiver will not be able to synchronize the frames to the start bit. There are two possible sources for a mismatch in baud rate: First, the reference clock will always have some minor instability. Second, the baud-rate generator cannot always do an exact division of the reference clock frequency to get the baud rate desired. In this case, the BAUD register value must be set to give the lowest possible error, see Clock Generation Baud-Rate Generator from Related Links. Recommended maximum receiver baud-rate errors for various character sizes are shown in the table below. Table 30-3. Asynchronous Receiver Error for 16-fold Oversampling D
(Data bits+Parity) RSLOW [%]
RFAST [%] Max. total error [%]
Recommended max. Rx error [%]
5 6 94.12 94.92 107.69
+5.88/-7.69 106.67
+5.08/-6.67 2.5 2.0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 572 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... ..........continued D
(Data bits+Parity) 7 8 9 10 RSLOW [%]
RFAST [%] Max. total error [%]
Recommended max. Rx error [%]
95.52 96.00 96.39 96.70 105.88
+4.48/-5.88 105.26
+4.00/-5.26 104.76
+3.61/-4.76 104.35
+3.30/-4.35 2.0 2.0 1.5 1.5 The following equations calculate the ratio of the incoming data rate and internal receiver baud rate:
16 D + 1 16 D + 1 + 6 RSLOW =
RSLOW is the ratio of the slowest incoming data rate that can be accepted in relation to the receiver baud rate RFAST is the ratio of the fastest incoming data rate that can be accepted in relation to the receiver baud rate D is the sum of character size and parity size (D = 5 to 10 bits) RFAST =
, 16 D + 2 16 D + 1 + 8 The recommended maximum Rx Error assumes that the receiver and transmitter equally divide the maximum total error. Its connection to the SERCOM Receiver error acceptance is depicted in this figure:
Figure 30-5. USART Rx Error Calculation SERCOM Receiver error acceptance from RSLOW and RFAST formulas
Baud Generator offset error depends on BAUD register value Clock source error
Recommended max. Rx Error (%) Error Max (%) Baud Rate Error Min (%) The recommendation values in the table above accommodate errors of the clock source and the baud generator. The following figure gives an example for a baud rate of 3Mbps:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 573 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... Figure 30-6. USART Rx Error Calculation Example SERCOM Receiver error acceptance sampling = x16 data bits = 10 parity = 0 start bit = stop bit = 1 Error Max 3.3%
No baud generator offset error Fbaud(2Mbps) = 32MHz *1(BAUD=0) /16
Error Max 3.3%
Error Max 3.0%
Accepted Receiver Error
Transmitter Error*
Baud Rate 2Mbps Error Min -4.35%
Error Min -4.35%
Error Min -4.05%
security margin
*Transmitter Error depends on the external transmitter used in the application. It is advised that it is within the Recommended max. Rx Error (+/-1.5% in this example). Larger Transmitter Errors are acceptable but must lie within the Accepted Receiver Error. Recommended max. Rx Error +/-1.5%
(example) Related Links 29.6.2.3. Clock Generation Baud-Rate Generator 30.6.2.6.1 Disabling the Receiver Writing '0' to the Receiver Enable bit in the CTRLB register (CTRLB.RXEN) will disable the receiver, flush the two-level receive buffer, and data from ongoing receptions will be lost. 30.6.2.6.2 Error Bits The USART receiver has three error bits in the Status (STATUS) register: Frame Error (FERR), Buffer Overflow
(BUFOVF), and Parity Error (PERR). Once an error happens, the corresponding error bit will be set until it is cleared by writing 1 to it. These bits are also cleared automatically when the receiver is disabled. There are two methods for buffer overflow notification, selected by the Immediate Buffer Overflow Notification bit in the Control A register (CTRLA.IBON):
When CTRLA.IBON=1, STATUS.BUFOVF is raised immediately upon buffer overflow. Software can then empty the receive FIFO by reading RxDATA, until the Receiver Complete Interrupt flag (INTFLAG.RXC) is cleared. When CTRLA.IBON=0, the Buffer Overflow condition is attending data through the receive FIFO, which will then set the INTFLAG.ERROR bit. After the received data is read, STATUS.BUFOVF (and INTFLAG.ERROR ) will be set along with INTFLAG.RXC. 30.6.2.6.3 Asynchronous Data Reception The USART includes a clock recovery and data recovery unit for handling asynchronous data reception. The clock recovery logic can synchronize the incoming asynchronous serial frames at the RxD pin to the internally generated baud-rate clock. The data recovery logic samples and applies a low-pass filter to each incoming bit, thereby improving the noise immunity of the receiver. 30.6.2.6.4 Asynchronous Operational Range The operational range of the asynchronous reception depends on the accuracy of the internal baud-rate clock, the rate of the incoming frames, and the frame size (in number of bits). In addition, the operational range of the receiver is depending on the difference between the received bit rate and the internally generated baud rate. If the baud rate of an external transmitter is too high or too low compared to the internally generated baud rate, the receiver will not be able to synchronize the frames to the start bit. There are two possible sources for a mismatch in baud rate: First, the reference clock will always have some minor instability. Second, the baud-rate generator cannot always do an exact division of the reference clock frequency to 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 574 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... get the baud rate desired. In this case, the BAUD register value must be set to give the lowest possible error (see Clock Generation Baud-Rate Generator from Related Links). Recommended maximum receiver baud-rate errors for various character sizes are shown in the following table. Table 30-4. Asynchronous Receiver Error for 16-fold Oversampling D
(Data bits+Parity) RSLOW [%]
RFAST [%] Max. total error [%]
Recommended max. Rx error [%]
5 6 7 8 9 10 94.12 94.92 95.52 96.00 96.39 96.70 107.69
+5.88/-7.69 106.67
+5.08/-6.67 105.88
+4.48/-5.88 105.26
+4.00/-5.26 104.76
+3.61/-4.76 104.35
+3.30/-4.35 2.5 2.0 2.0 2.0 1.5 1.5 The following equations calculate the ratio of the incoming data rate and internal receiver baud rate:
D + 1 S S 1 + D S + SF RSLOW =
, RFAST =
RSLOW is the ratio of the slowest incoming data rate that can be accepted in relation to the receiver baud rate RFAST is the ratio of the fastest incoming data rate that can be accepted in relation to the receiver baud rate D is the sum of character size and parity size (D = 5 to 10 bits) S is the number of samples per bit (S = 16, 8 or 3) SF is the first sample number used for majority voting (SF = 7, 3 or 2) when CTRLA.SAMPA=0. SM is the middle sample number used for majority voting (SM = 8, 4 or 2) when CTRLA.SAMPA=0. D + 2 S D + 1 S + SM The recommended maximum Rx Error assumes that the receiver and transmitter equally divide the maximum total error. Its connection to the SERCOM Receiver error acceptance is depicted in this figure:
Figure 30-7. USART Rx Error Calculation SERCOM Receiver error acceptance from RSLOW and RFAST formulas
Baud Generator offset error depends on BAUD register value Clock source error
Recommended max. Rx Error (%) Error Max (%) Baud Rate Error Min (%) The recommendation values in the table above accommodate errors of the clock source and the baud generator. The following figure gives an example for a baud rate of 3 Mbps:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 575 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... Figure 30-8. USART Rx Error Calculation Example SERCOM Receiver error acceptance sampling = x16 data bits = 10 parity = 0 start bit = stop bit = 1 Error Max 3.3%
No baud generator offset error Fbaud(2Mbps) = 32MHz *1(BAUD=0) /16
Error Max 3.3%
Error Max 3.0%
Accepted Receiver Error
Transmitter Error*
Baud Rate 2Mbps Error Min -4.35%
Error Min -4.35%
Error Min -4.05%
security margin
*Transmitter Error depends on the external transmitter used in the application. It is advised that it is within the Recommended max. Rx Error (+/-1.5% in this example). Larger Transmitter Errors are acceptable but must lie within the Accepted Receiver Error. Recommended max. Rx Error +/-1.5%
(example) Related Links 29.6.2.3. Clock Generation Baud-Rate Generator 30.6.3 Additional Features 30.6.3.1 Parity Even or odd parity can be selected for error checking by writing 0x1 to the Frame Format bit field in the Control A register (CTRLA.FORM). If even parity is selected (CTRLB.PMODE=0), the Parity bit of an outgoing frame is '1' if the data contains an odd number of bits that are '1', making the total number of '1' even. If odd parity is selected (CTRLB.PMODE=1), the Parity bit of an outgoing frame is '1' if the data contains an even number of bits that are '0', making the total number of '1' odd. When parity checking is enabled, the parity checker calculates the parity of the data bits in incoming frames and compares the result with the Parity bit of the corresponding frame. If a parity error is detected, the Parity Error bit in the Status register (STATUS.PERR) is set. 30.6.3.2 Hardware Handshaking The USART features an out-of-band hardware handshaking flow control mechanism, implemented by connecting the RTS and CTS pins with the remote device, as shown in the figure below. Figure 30-9. Connection with a Remote Device for Hardware Handshaking USART TXD RXD CTS RTS Remote Device RXD TXD RTS CTS Hardware handshaking is only available in the following configuration:
USART with internal clock (CTRLA.MODE=1), Asynchronous mode (CTRLA.CMODE=0), and Flow control pinout (CTRLA.TXPO=2). When the receiver is disabled or the receive FIFO is full, the receiver will drive the RTS pin high. This notifies the remote device to stop transfer after the ongoing transmission. Enabling and disabling the receiver by writing to 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 576 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... CTRLB.RXEN will set/clear the RTS pin after a synchronization delay. When the receive FIFO goes full, RTS will be set immediately and the frame being received will be stored in the Shift register until the receive FIFO is no longer full. Figure 30-10. Receiver Behavior when Operating with Hardware Handshaking RXD RXEN RTS Two-Level Rx Buffer The current CTS Status is in the STATUS register (STATUS.CTS). Character transmission will start only if STATUS.CTS=0. When CTS is set, the transmitter will complete the ongoing transmission and stop transmitting. Figure 30-11. Transmitter Behavior when Operating with Hardware Handshaking CTS TXD 30.6.3.3 IrDA Modulation and Demodulation Transmission and reception can be encoded IrDA compliant up to 115.2 kb/s. IrDA modulation and demodulation work in the following configuration:
IrDA encoding enabled (CTRLB.ENC=1) Asynchronous mode (CTRLA.CMODE=0) 16x sample rate (CTRLA.SAMPR[0]=0) During transmission, each low bit is transmitted as a high pulse. The pulse width is 3/16 of the baud rate period, as illustrated in the following figure. Figure 30-12. IrDA Transmit Encoding 1 baud clock TXD IrDA encoded TXD 3/16 baud clock The reception decoder has two main functions:
To synchronize the incoming data to the IrDA baud rate counter. Synchronization is performed at the start of each zero pulse. To decode incoming Rx data. If a pulse width meets the minimum length set by configuration (RXPL.RXPL), it is accepted. When the baud rate counter reaches its middle value (1/2 bit length), it is transferred to the receiver. Note:The polarity of the transmitter and receiver are opposite: During transmission, a 0 bit is transmitted as a 1 pulse. During reception, an accepted 0 pulse is received as a 0 bit. Example: The following figure illustrates reception where RXPL.RXPL is set to 19. This indicates that the pulse width must be at least 20 SE clock cycles. When using BAUD=0xE666 or 160 SE cycles per bit, this corresponds to 2/16 baud clock as minimum pulse width required. In this case the first bit is accepted as a 0, the second bit is a 1, and the third bit is also a 1. A low pulse is rejected since it does not meet the minimum requirement of 2/16 baud clock. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 577 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... Figure 30-13. IrDA Receive Decoding Baud clock 0 0.5 1 1.5 2 2.5 IrDA encoded RXD RXD 20 SE clock cycles 30.6.3.4 Break Character Detection and Auto-Baud Break character detection and auto-baud are available in this configuration:
Auto-baud frame format (CTRLA.FORM = 0x04 or 0x05), Asynchronous mode (CTRLA.CMODE = 0), and 16x sample rate using fractional baud rate generation (CTRLA.SAMPR = 1). The USART uses a break detection threshold of greater than 11 nominal bit times at the configured baud rate. At any time, if more than 11 consecutive dominant bits are detected on the bus, the USART detects a Break Field. When a break field has been detected, the Receive Break Interrupt Flag (INTFLAG.RXBRK) is set and the USART expects the sync field character to be 0x55. This field is used to update the actual baud rate in order to stay synchronized. If the received sync character is not 0x55, then the Inconsistent Sync Field error flag (STATUS.ISF) is set along with the Error Interrupt Flag (INTFLAG.ERROR), and the baud rate is unchanged. After a break field is detected and the Start bit of the sync field is detected, a counter is started. The counter is then incremented for the next 8 bit times of the sync field. At the end of these 8 bit times, the counter is stopped. At this moment, the 13 Most Significant bits of the counter (value divided by 8) give the new clock divider (BAUD.BAUD), and the 3 Least Significant bits of this value (the remainder) give the new Fractional Part (BAUD.FP). When the sync field has been received, the clock divider (BAUD.BAUD) and the Fractional Part (BAUD.FP) are updated after a synchronization delay. After the break and sync fields are received, multiple characters of data can be received. 30.6.3.5 LIN Commander LIN commander is available with the following configuration:
LIN commander format (CTRLA.FORM = 0x02) Asynchronous mode (CTRLA.CMODE = 0) 16x sample rate using fractional baud rate generation (CTRLA.SAMPR = 1) LIN frames start with a header transmitted by the commander. The header consists of the break, sync, and identifier fields. After the commander transmits the header, the addressed responder will respond with 1-8 bytes of data plus checksum. Figure 30-14. LIN Frame Format Header TxD Break Sync ID RxD Responder response 1-8 Data bytes Checksum Using the LIN command field (CTRLB.LINCMD), the complete header can be automatically transmitted, or software can control transmission of the various header components. When CTRLB.LINCMD=0x1, software controls transmission of the LIN header. In this case, software uses the following sequence. CTRLB.LINCMD is written to 0x1. DATA register written to 0x00. This triggers transmission of the break field by hardware. Note that writing the DATA register with any other value will also result in the transmission of the break field by hardware. DATA register written to 0x55. The 0x55 value (sync) is transmitted. DATA register written to the identifier. The identifier is transmitted. When CTRLB.LINCMD=0x2, hardware controls transmission of the LIN header. In this case, software uses the following sequence. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 578 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... CTRLB.LINCMD is written to 0x2. DATA register written to the identifier. This triggers transmission of the complete header by hardware. First the break field is transmitted. Next, the sync field is transmitted, and finally the identifier is transmitted. In LIN commander mode, the length of the break field is programmable using the break length field
(CTRLC.BRKLEN). When the LIN header command is used (CTRLB.LINCMD=0x2), the delay between the break and sync fields, in addition to the delay between the sync and ID fields are configurable using the header delay field
(CTRLC.HDRDLY). When manual transmission is used (CTRLB.LINCMD=0x1), software controls the delay between break and sync. Figure 30-15. LIN Header Generation Configurable Break Field Length Sync Field Identifier Field LIN Header After header transmission is complete, the responder responds with 1-8 data bytes plus checksum. Configurable delay using CTRLC.HDRDLY 30.6.3.6 Collision Detection When the receiver and transmitter are connected either through pin configuration or externally, transmit collision can be detected after selecting the Collision Detection Enable bit in the CTRLB register (CTRLB.COLDEN=1). To detect collision, the receiver and transmitter must be enabled (CTRLB.RXEN=1 and CTRLB.TXEN=1). Collision detection is performed for each bit transmitted by comparing the received value with the transmit value, as shown in the figure below. While the transmitter is idle (no transmission in progress), characters can be received on RxD without triggering a collision. Figure 30-16. Collision Checking 8-bit character, single stop bit TXD RXD The next figure shows the conditions for a collision detection. In this case, the Start bit and the first Data bit are received with the same value as transmitted. The second received Data bit is found to be different than the transmitted bit at the detection point, which indicates a collision. Collision checked Figure 30-17. Collision Detected Collision checked and ok TXD RXD TXEN Tri-state When a collision is detected, the USART follows this sequence:
Collision detected Abort the current transfer. Flush the transmit buffer. 1. 2. 3. Disable transmitter (CTRLB.TXEN=0) This is done after a synchronization delay. The CTRLB Synchronization Busy bit (SYNCBUSY.CTRLB) will be set until this is complete. After disabling, the TxD pin will be tri-stated. 4. Set the Collision Detected bit (STATUS.COLL) along with the Error Interrupt Flag (INTFLAG.ERROR). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 579 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 5. Set the Transmit Complete Interrupt Flag (INTFLAG.TXC), since the transmit buffer no longer contains data. After a collision, software must manually enable the transmitter again before continuing, after assuring that the CTRLB Synchronization Busy bit (SYNCBUSY.CTRLB) is not set. 30.6.3.7 Loop-Back Mode For Loop-Back mode, configure the Receive Data Pinout (CTRLA.RXPO) and Transmit Data Pinout (CTRLA.TXPO) to use the same data pins for transmit and receive. The loop-back is through the pad, so the signal is also available externally. 30.6.3.8 Start-of-Frame Detection The USART start-of-frame detector can wake up the CPU when it detects a Start bit. In Standby Sleep mode, the internal fast start-up oscillator must be selected as the GCLK_SERCOMx_CORE source. When a 1-to-0 transition is detected on RxD, the 8 MHz Internal Oscillator is powered up and the USART clock is enabled. After start-up, the rest of the data frame can be received, provided that the baud rate is slow enough in relation to the fast start-up internal oscillator start-up time. See Electrical Characteristics from Related Links for details. The start-up time of this oscillator varies with supply voltage and temperature. The USART start-of-frame detection works both in Asynchronous and Synchronous modes. It is enabled by writing 1 to the Start of Frame Detection Enable bit in the Control B register (CTRLB.SFDE). If the Receive Start Interrupt Enable bit in the Interrupt Enable Set register (INTENSET.RXS) is set, the Receive Start interrupt is generated immediately when a start is detected. When using start-of-frame detection without the Receive Start interrupt, start detection will force the 8 MHz internal oscillator and USART clock active while the frame is being received. In this case, the CPU will not wake up until the receive complete interrupt is generated. Related Links 43. Electrical Characteristics 30.6.3.9 Sample Adjustment In Asynchronous mode (CTRLA.CMODE=0), three samples in the middle are used to determine the value based on majority voting. The three samples used for voting can be selected using the Sample Adjustment bit field in Control A register (CTRLA.SAMPA). When CTRLA.SAMPA=0, samples 7-8-9 are used for 16x oversampling, and samples 3-4-5 are used for 8x oversampling. 30.6.4 DMA, Interrupts and Events 30.6.4.1 DMA Operation The USART generates the following DMA requests:
30.6.4.2 Interrupts The USART has the following interrupt sources. These are asynchronous interrupts, and can wake-up the device from any Sleep mode:
Data Register Empty (DRE) Receive Complete (RXC) Transmit Complete (TXC) Receive Start (RXS) Clear to Send Input Change (CTSIC) Received Break (RXBRK) Error (ERROR) Each interrupt source has its own Interrupt flag. The Interrupt flag in the Interrupt Flag Status and Clear register
(INTFLAG) will be set when the Interrupt condition is met. Each interrupt can be individually enabled by writing
'1' to the corresponding bit in the Interrupt Enable Set register (INTENSET), and disabled by writing '1' to the corresponding bit in the Interrupt Enable Clear register (INTENCLR). The status of enabled interrupts can be read from either INTENSET or INTENCLR. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 580 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... An interrupt request is generated when the Interrupt flag is set and if the corresponding interrupt is enabled. The interrupt request remains active until either the Interrupt flag is cleared, the interrupt is disabled, or the USART is reset. For details on clearing Interrupt flags, see INTFLAG from Related Links. The value of INTFLAG indicates which interrupt is executed. Note that interrupts must be globally enabled for interrupt requests. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 30.8.8. INTFLAG 30.6.4.3 Events Not applicable. 30.6.5 Sleep Mode Operation The behavior in Sleep mode is depending on the clock source and the Run In Standby bit in the Control A register
(CTRLA.RUNSTDBY):
Internal clocking, CTRLA.RUNSTDBY=1: GCLK_SERCOMx_CORE can be enabled in all Sleep modes. Any interrupt can wake-up the device. External clocking, CTRLA.RUNSTDBY=1: The Receive Complete interrupt(s) can wake-up the device. Internal clocking, CTRLA.RUNSTDBY=0: Internal clock will be disabled, after any ongoing transfer was completed. The Receive Complete interrupt(s) can wake-up the device. External clocking, CTRLA.RUNSTDBY=0: External clock will be disconnected, after any ongoing transfer was completed. All reception will be dropped. 30.6.6 Synchronization Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be synchronized when written or read. The following bits are synchronized when written:
Software Reset bit in the CTRLA register (CTRLA.SWRST) Enable bit in the CTRLA register (CTRLA.ENABLE) Receiver Enable bit in the CTRLB register (CTRLB.RXEN) Transmitter Enable bit in the Control B register (CTRLB.TXEN) Note:CTRLB.RXEN is write-synchronized somewhat differently. See also 30.8.2. CTRLB for details. Required write synchronization is denoted by the "Write-Synchronized" property in the register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 581 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.7 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CTRLA 0x04 CTRLB 0x08 CTRLC 0x0C 0x0E 0x0F
... 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A BAUD RXPL Reserved INTENCLR Reserved INTENSET Reserved INTFLAG Reserved STATUS 0x1C SYNCBUSY 0x20
... 0x27 Reserved 0x28 DATA 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 7:0 7:0 7:0 7:0 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 0x2C
... 0x2F 0x30 Reserved DBGCTRL 7:0 30.8 Register Description RUNSTDBY SAMPR[2:0]
SAMPA[1:0]
RXPO[1:0]
DORD SBMODE CPOL CMODE PMODE MODE[2:0]
ENABLE SWRST IBON TXPO[1:0]
FORM[3:0]
CHSIZE[2:0]
ENC RXEN COLDEN TXEN BAUD[7:0]
BAUD[15:8]
RXPL[7:0]
ERROR ERROR ERROR RXBRK CTSIC RXBRK CTSIC RXBRK CTSIC RXC RXC RXC TXC TXC TXC DRE DRE DRE TXE COLL ISF CTS BUFOVF FERR PERR CTRLB ENABLE SWRST DATA[7:0]
DATA[15:8]
DATA[23:16]
DATA[31:24]
DBGSTOP Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers require synchronization when read and/or written. Synchronization is denoted by the Read-
Synchronized and/or Write-Synchronized property in each individual register description. Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. Some registers are enable-protected, meaning they can only be written when the module is disabled. Enable-
protection is denoted by the Enable-Protected property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 582 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized CTRLA 0x00 0x00000000 Bit 31 Access Reset 30 DORD R/W 0 29 CPOL R/W 0 28 CMODE R/W 0 Bit 23 22 SAMPA[1:0]
Access Reset R/W 0 R/W 0 Bit 15 Access Reset R/W 0 14 SAMPR[2:0]
R/W 0 Bit 7 6 RUNSTDBY Access Reset R/W 0 Bit 30 DORDData Order RXPO[1:0]
21 R/W 0 13 R/W 0 5 20 R/W 0 12 4 R/W 0 27 R/W 0 19 FORM[3:0]
26 R/W 0 18 11 10 25 R/W 0 17 R/W 0 9 TXPO[1:0]
24 R/W 0 16 R/W 0 8 IBON R/W 0 3 MODE[2:0]
R/W 0 2 R/W 0 1 ENABLE R/W 0 0 SWRST R/W 0 This bit selects the data order when a character is shifted out from the Data register. This bit is not synchronized. Value 0 1 Description MSB is transmitted first. LSB is transmitted first. Bit 29 CPOLClock Polarity This bit selects the relationship between data output change and data input sampling in synchronous mode. This bit is not synchronized. CPOL 0x0 0x1 TxD Change Rising XCK edge Falling XCK edge RxD Sample Falling XCK edge Rising XCK edge Bit 28 CMODECommunication Mode This bit selects asynchronous or synchronous communication. This bit is not synchronized. Value 0 1 Description Asynchronous communication. Synchronous communication. Bits 27:24 FORM[3:0]Frame Format These bits define the frame format. These bits are not synchronized. FORM[3:0]
Description 0x0 0x1 USART frame USART frame with parity 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 583 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... ..........continued FORM[3:0]
Description 0x4 0x5 Auto-baud (LIN Responder) - break detection and auto-baud. Auto-baud - break detection and auto-baud with parity Bits 23:22 SAMPA[1:0]Sample Adjustment These bits define the sample adjustment. These bits are not synchronized. SAMPA[1:0]
16x Over-sampling (CTRLA.SAMPR=0 or 1) 8x Over-sampling (CTRLA.SAMPR=2 or 3) 0x0 0x1 0x2 0x3 7-8-9 9-10-11 11-12-13 13-14-15 3-4-5 4-5-6 5-6-7 6-7-8 Bits 21:20 RXPO[1:0]Receive Data Pinout These bits define the receive data (RxD) pin configuration. These bits are not synchronized. RXPO[1:0]
0x0 0x1 0x2 0x3 Name PAD[0]
PAD[1]
PAD[2]
PAD[3]
Description SERCOM PAD[0] is used for data reception SERCOM PAD[1] is used for data reception SERCOM PAD[2] is used for data reception SERCOM PAD[3] is used for data reception Bits 17:16 TXPO[1:0]Transmit Data Pinout These bits define the transmit data (TxD) and XCK pin configurations. This bit is not synchronized. Bits 15:13 SAMPR[2:0]Sample Rate These bits select the sample rate. These bits are not synchronized. SAMPR[2:0]
Description 0x0 0x1 0x2 0x3 0x4 0x5-0x7 16x over-sampling using arithmetic baud rate generation. 16x over-sampling using fractional baud rate generation. 8x over-sampling using arithmetic baud rate generation. 8x over-sampling using fractional baud rate generation. 3x over-sampling using arithmetic baud rate generation. Reserved Bit 8 IBONImmediate Buffer Overflow Notification This bit controls when the buffer overflow status bit (STATUS.BUFOVF) is asserted when a buffer overflow occurs. This bit is not synchronized. Value 0 1 Description STATUS.BUFOVF is asserted when it occurs in the data stream. STATUS.BUFOVF is asserted immediately upon buffer overflow. Bit 7 RUNSTDBYRun In Standby This bit defines the functionality in standby sleep mode. This bit is not synchronized. RUNSTDBY External Clock Internal Clock 0x0 External clock is disconnected when ongoing transfer is finished. All reception is dropped. Generic clock is disabled when ongoing transfer is finished. The device will not wake up on Transfer Complete interrupt unless the appropriate ONDEMAND bits are set in the clocking chain. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 584 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... ..........continued RUNSTDBY External Clock Internal Clock 0x1 Wake on Receive Complete interrupt. Generic clock is enabled in all sleep modes. Any interrupt can wake up the device. Bits 4:2 MODE[2:0]Operating Mode These bits select the USART serial communication interface of the SERCOM. These bits are not synchronized. Value 0x0 0x1 Description USART with external clock USART with internal clock Bit 1 ENABLEEnable Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRLA.ENABLE will read back immediately and the Enable Synchronization Busy bit in the Synchronization Busy register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE is cleared when the operation is complete. This bit is not enable-protected. Value 0 1 Description The peripheral is disabled or being disabled. The peripheral is enabled or being enabled. Bit 0 SWRSTSoftware Reset Writing 0 to this bit has no effect. Writing 1 to this bit resets all registers in the SERCOM, except DBGCTRL, to their initial state, and the SERCOM will be disabled. Writing 1 to CTRLA.SWRST will always take precedence, meaning that all other writes in the same write-operation will be discarded. Any register write access during the ongoing reset will result in an APB error. Reading any register will return the reset value of the register. Due to synchronization, there is a delay from writing CTRLA.SWRST until the reset is complete. CTRLA.SWRST and SYNCBUSY.SWRST will both be cleared when the reset is complete. This bit is not enable-protected. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description There is no reset operation ongoing. The reset operation is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 585 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.2 Control B Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized CTRLB 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 Access Reset Bit 15 14 Access Reset Bit 7 Access Reset 6 SBMODE R/W 0 Bit 17 RXENReceiver Enable 12 11 13 PMODE R/W 0 5 4 3 10 ENC R/W 0 2 R/W 0 17 RXEN R/W 0 9 16 TXEN R/W 0 8 COLDEN R/W 0 1 CHSIZE[2:0]
R/W 0 0 R/W 0 Writing 0 to this bit will disable the USART receiver. Disabling the receiver will flush the receive buffer and clear the FERR, PERR and BUFOVF bits in the STATUS register. Writing 1 to CTRLB.RXEN when the USART is disabled will set CTRLB.RXEN immediately. When the USART is enabled, CTRLB.RXEN will be cleared, and SYNCBUSY.CTRLB will be set and remain set until the receiver is enabled. When the receiver is enabled, CTRLB.RXEN will read back as 1. Writing 1 to CTRLB.RXEN when the USART is enabled will set SYNCBUSY.CTRLB, which will remain set until the receiver is enabled, and CTRLB.RXEN will read back as 1. This bit is not enable-protected. Value 0 1 Description The receiver is disabled or being enabled. The receiver is enabled or will be enabled when the USART is enabled. Bit 16 TXENTransmitter Enable Writing 0 to this bit will disable the USART transmitter. Disabling the transmitter will not become effective until ongoing and pending transmissions are completed. Writing 1 to CTRLB.TXEN when the USART is disabled will set CTRLB.TXEN immediately. When the USART is enabled, CTRLB.TXEN will be cleared, and SYNCBUSY.CTRLB will be set and remain set until the transmitter is enabled. When the transmitter is enabled, CTRLB.TXEN will read back as 1. Writing 1 to CTRLB.TXEN when the USART is enabled will set SYNCBUSY.CTRLB, which will remain set until the transmitter is enabled, and CTRLB.TXEN will read back as 1. This bit is not enable-protected. Value 0 1 Description The transmitter is disabled or being enabled. The transmitter is enabled or will be enabled when the USART is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 586 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... Bit 13 PMODEParity Mode This bit selects the type of parity used when parity is enabled (CTRLA.FORM is 1). The transmitter will automatically generate and send the parity of the transmitted data bits within each frame. The receiver will generate a parity value for the incoming data and parity bit, compare it to the parity mode and, if a mismatch is detected, STATUS.PERR will be set. This bit is not synchronized. Value 0 1 Description Even parity. Odd parity. Bit 10 ENCEncoding Format This bit selects the data encoding format. This bit is not synchronized. Value 0 1 Description Data is not encoded. Data is IrDA encoded. Bit 8 COLDENCollision Detection Enable This bit enables collision detection. This bit is not synchronized. Value 0 1 Description Collision detection is not enabled. Collision detection is enabled. Bit 6 SBMODEStop Bit Mode This bit selects the number of stop bits transmitted. This bit is not synchronized. Value 0 1 Description One stop bit. Two stop bits. Bits 2:0 CHSIZE[2:0]Character Size These bits select the number of bits in a character. These bits are not synchronized. CHSIZE[2:0]
0x0 0x1 0x2-0x4 0x5 0x6 0x7 Description 8 bits 9 bits Reserved 5 bits 6 bits 7 bits 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 587 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.3 Control C Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected CTRLC 0x08 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 588 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.4 Baud Name:
Offset:
Reset:
Property: Enable-Protected, PAC Write-Protection BAUD 0x0C 0x0000 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 BAUD[15:8]
BAUD[7:0]
12 R/W 0 4 R/W 0 11 R/W 0 3 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:0 BAUD[15:0]Baud Value Arithmetic Baud Rate Generation (CTRLA.SAMPR[0]=0):
These bits control the clock generation, as described in the SERCOM Baud Rate section. If Fractional Baud Rate Generation (CTRLA.SAMPR[0]=1 or =3) bit positions 15 to 13 are replaced by FP[2:0]
Fractional Part:
Bits 15:13 - FP[2:0]: Fractional Part These bits control the clock generation, as described in the SERCOM Clock Generation Baud-Rate Generator section. Bits 12:0 - BAUD[12:0]: Baud Value These bits control the clock generation, as described in the SERCOM Clock Generation Baud-Rate Generator section. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 589 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.5 Receive Pulse Length Register Name:
Offset:
Reset:
Property: Enable-Protected, PAC Write-Protection RXPL 0x0E 0x00 Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 4 R/W 0 RXPL[7:0]
3 R/W 0 2 R/W 0 1 R/W 0 0 R/W 0 Bits 7:0 RXPL[7:0]Receive Pulse Length When the encoding format is set to IrDA (CTRLB.ENC=1), these bits control the minimum pulse length that is required for a pulse to be accepted by the IrDA receiver with regards to the serial engine clock period
. PULSE RXPL + 1 SEper SEper 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 590 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.6 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x14 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENSET). Bit Access Reset 7 ERROR R/W 0 6 5 RXBRK R/W 0 4 CTSIC R/W 0 3 2 RXC R/W 0 1 TXC R/W 0 0 DRE R/W 0 Bit 7 ERRORError Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Error Interrupt Enable bit, which disables the Error interrupt. Value 0 1 Description Error interrupt is disabled. Error interrupt is enabled. Bit 5 RXBRKReceive Break Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Receive Break Interrupt Enable bit, which disables the Receive Break interrupt. Value 0 1 Description Receive Break interrupt is disabled. Receive Break interrupt is enabled. Bit 4 CTSICClear to Send Input Change Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Clear To Send Input Change Interrupt Enable bit, which disables the Clear To Send Input Change interrupt. Value 0 1 Description Clear To Send Input Change interrupt is disabled. Clear To Send Input Change interrupt is enabled. Bit 2 RXCReceive Complete Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Receive Complete Interrupt Enable bit, which disables the Receive Complete interrupt. Value 0 1 Description Receive Complete interrupt is disabled. Receive Complete interrupt is enabled. Bit 1 TXCTransmit Complete Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Transmit Complete Interrupt Enable bit, which disables the Receive Complete interrupt. Value 0 1 Description Transmit Complete interrupt is disabled. Transmit Complete interrupt is enabled. Bit 0 DREData Register Empty Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Data Register Empty Interrupt Enable bit, which disables the Data Register Empty interrupt. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 591 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... Value 0 1 Description Data Register Empty interrupt is disabled. Data Register Empty interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 592 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.7 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x16 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear register (INTENCLR). Bit Access Reset 7 ERROR R/W 0 6 5 RXBRK R/W 0 4 CTSIC R/W 0 3 2 RXC R/W 0 1 TXC R/W 0 0 DRE R/W 0 Bit 7 ERRORError Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Error Interrupt Enable bit, which enables the Error interrupt. Value 0 1 Description Error interrupt is disabled. Error interrupt is enabled. Bit 5 RXBRKReceive Break Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Receive Break Interrupt Enable bit, which enables the Receive Break interrupt. Value 0 1 Description Receive Break interrupt is disabled. Receive Break interrupt is enabled. Bit 4 CTSICClear to Send Input Change Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Clear To Send Input Change Interrupt Enable bit, which enables the Clear To Send Input Change interrupt. Value 0 1 Description Clear To Send Input Change interrupt is disabled. Clear To Send Input Change interrupt is enabled. Bit 2 RXCReceive Complete Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Receive Complete Interrupt Enable bit, which enables the Receive Complete interrupt. Value 0 1 Description Receive Complete interrupt is disabled. Receive Complete interrupt is enabled. Bit 1 TXCTransmit Complete Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Transmit Complete Interrupt Enable bit, which enables the Transmit Complete interrupt. Value 0 1 Description Transmit Complete interrupt is disabled. Transmit Complete interrupt is enabled. Bit 0 DREData Register Empty Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Data Register Empty Interrupt Enable bit, which enables the Data Register Empty interrupt. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 593 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... Value 0 1 Description Data Register Empty interrupt is disabled. Data Register Empty interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 594 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.8 Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
INTFLAG 0x18 0x00
Bit Access Reset 7 ERROR R/W 0 Bit 7 ERRORError 6 5 RXBRK R/W 0 4 CTSIC R/W 0 3 2 RXC R 0 1 TXC R/W 0 0 DRE R 0 This flag is cleared by writing '1' to it. This bit is set when any error is detected. Errors that will set this flag have corresponding status flags in the STATUS register. Errors that will set this flag are COLL, ISF, BUFOVF, FERR, and PERR.Writing '0' to this bit has no effect. Writing '1' to this bit will clear the flag. Bit 5 RXBRKReceive Break This flag is cleared by writing '1' to it. This flag is set when auto-baud is enabled (CTRLA.FORM) and a break character is received. Writing '0' to this bit has no effect. Writing '1' to this bit will clear the flag. Bit 4 CTSICClear to Send Input Change This flag is cleared by writing a '1' to it. This flag is set when a change is detected on the CTS pin. Writing '0' to this bit has no effect. Writing '1' to this bit will clear the flag. Bit 2 RXCReceive Complete This flag is cleared by reading the Data register (DATA) or by disabling the receiver. This flag is set when there are unread data in DATA. Writing '0' to this bit has no effect. Writing '1' to this bit has no effect. Bit 1 TXCTransmit Complete This flag is cleared by writing '1' to it or by writing new data to DATA. This flag is set when the entire frame in the Transmit Shift register has been shifted out and there are no new data in DATA. Writing '0' to this bit has no effect. Writing '1' to this bit will clear the flag. Bit 0 DREData Register Empty This flag is cleared by writing new data to DATA. This flag is set when DATA is empty and ready to be written. Writing '0' to this bit has no effect. Writing '1' to this bit has no effect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 595 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.9 Status Name:
Offset:
Reset:
Property:
STATUS 0x1A 0x0000
Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 Access Reset 6 TXE R/W 0 5 COLL R/W 0 4 ISF R/W 0 3 CTS R 0 2 BUFOVF R/W 0 1 FERR R/W 0 0 PERR R/W 0 Bit 6 TXETransmitter Empty Writing 0 to this bit has no effect. Writing 1 to this bit will clear it. Bit 5 COLLCollision Detected This bit is cleared by writing '1' to the bit or by disabling the receiver. This bit is set when collision detection is enabled (CTRLB.COLDEN) and a collision is detected. Writing 0 to this bit has no effect. Writing 1 to this bit will clear it. Bit 4 ISFInconsistent Sync Field This bit is cleared by writing '1' to the bit or by disabling the receiver. This bit is set when the frame format is set to auto-baud (CTRLA.FORM) and a sync field not equal to 0x55 is received. Writing 0 to this bit has no effect. Writing 1 to this bit will clear it. Bit 3 CTSClear to Send This bit indicates the current level of the CTS pin when flow control is enabled (CTRLA.TXPO). Writing 0 to this bit has no effect. Writing 1 to this bit has no effect. Bit 2 BUFOVFBuffer Overflow Reading this bit before reading the Data register will indicate the error status of the next character to be read. This bit is cleared by writing 1 to the bit or by disabling the receiver. This bit is set when a buffer overflow condition is detected. A buffer overflow occurs when the receive buffer is full, there is a new character waiting in the receive shift register and a new start bit is detected. Writing 0 to this bit has no effect. Writing 1 to this bit will clear it. Bit 1 FERRFrame Error Reading this bit before reading the Data register will indicate the error status of the next character to be read. This bit is cleared by writing '1' to the bit or by disabling the receiver. This bit is set if the received character had a frame error, i.e., when the first stop bit is zero. Writing 0 to this bit has no effect. Writing 1 to this bit will clear it. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 596 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... Bit 0 PERRParity Error Reading this bit before reading the Data register will indicate the error status of the next character to be read. This bit is cleared by writing 1 to the bit or by disabling the receiver. This bit is set if parity checking is enabled (CTRLA.FORM is 0x1, 0x5) and a parity error is detected. Writing 0 to this bit has no effect. Writing 1 to this bit will clear it. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 597 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.10 Synchronization Busy Name:
Offset:
Reset:
Property:
SYNCBUSY 0x1C 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 3 Access Reset Bit 2 CTRLBCTRLB Synchronization Busy 2 CTRLB R 0 1 ENABLE R 0 0 SWRST R 0 Writing to the CTRLB register when the SERCOM is enabled requires synchronization. When writing to CTRLB the SYNCBUSY.CTRLB bit will be set until synchronization is complete. If CTRLB is written while SYNCBUSY.CTRLB is asserted, an APB error will be generated. Value 0 1 Description CTRLB synchronization is not busy. CTRLB synchronization is busy. Bit 1 ENABLESERCOM Enable Synchronization Busy Enabling and disabling the SERCOM (CTRLA.ENABLE) requires synchronization. When written, the SYNCBUSY.ENABLE bit will be set until synchronization is complete. Value 0 1 Description Enable synchronization is not busy. Enable synchronization is busy. Bit 0 SWRSTSoftware Reset Synchronization Busy Resetting the SERCOM (CTRLA.SWRST) requires synchronization. When written, the SYNCBUSY.SWRST bit will be set until synchronization is complete. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description SWRST synchronization is not busy. SWRST synchronization is busy. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 598 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.11 Data Name:
Offset:
Reset:
Property:
DATA 0x28 0x0000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 DATA[31:24]
R/W 0 20 R/W 0 19 DATA[23:16]
R/W 0 12 R/W 0 4 R/W 0 DATA[15:8]
DATA[7:0]
R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 DATA[31:0]Data Reading these bits will return the contents of the Receive Data register. The register must be read only when the Receive Complete Interrupt Flag bit in the Interrupt Flag Status and Clear register (INTFLAG.RXC) is set. The status bits in STATUS must be read before reading the DATA value in order to get any corresponding error. Writing these bits will write the Transmit Data register. This register must be written only when the Data Register Empty Interrupt Flag bit in the Interrupt Flag Status and Clear register (INTFLAG.DRE) is set. Reads and writes are 32-bit or CTLB.CHSIZE based on the CTRLC.DATA32B setting. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 599 PIC32CX-BZ2 and WBZ45 Family SERCOM Synchronous and Asynchronous Receiver ... 30.8.12 Debug Control Name:
Offset:
Reset:
Property: PAC Write-Protection DBGCTRL 0x30 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGSTOPDebug Stop Mode DBGSTOP R/W 0 This bit controls the baud-rate generator functionality when the CPU is halted by an external debugger. Value 0 1 Description The baud-rate generator continues normal operation when the CPU is halted by an external debugger. The baud-rate generator is halted when the CPU is halted by an external debugger. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 600 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31. SERCOM Serial Peripheral Interface (SERCOM SPI) 31.1 Overview The Serial Peripheral Interface (SPI) is one of the available modes in the Serial Communication Interface (SERCOM). The SPI uses the SERCOM transmitter and receiver configured as shown in the Block Diagram (see Full-Duplex SPI Host Client Interconnection in the Block Diagram from Related Links). Each side, host and client, depicts a separate SPI containing a Shift register, a transmit buffer and a two-level receive buffer. In addition, the SPI host uses the SERCOM baud-rate generator, while the SPI Client can use the SERCOM address match logic. Labels in capital letters are synchronous to PBx_CLK and accessible by the CPU, while labels in lowercase letters are synchronous to the SCK clock. Note:Traditional Serial Peripheral Interface (SPI) documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Host and Client, respectively. Related Links 31.3. Block Diagram 31.2 Features SERCOM SPI includes the following features:
Full-duplex, four-wire interface (MISO, MOSI, SCK, SS) One-level transmit buffer, two-level receive buffer Supports all four SPI modes of operation Single data direction operation allows alternate function on MISO or MOSI pin Selectable LSB- or MSB-first data transfer Can be used with DMA Host operation:
Serial clock speed up to half the system clock 8-bit clock generator Hardware controlled SS Client operation:
Serial clock speed up to half the system clock Optional 8-bit address match operation Operation in all sleep modes Wake on SS transition 31.3 Block Diagram Figure 31-1. Full-Duplex SPI Host Client Interconnection Host Client BAUD Tx DATA Tx DATA ADDR/ADDRMASK baud rate generator shift register SCK SS MISO MOSI shift register rx buffer Rx DATA rx buffer Rx DATA
Address Match 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 601 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.4 Signal Description Table 31-1. SERCOM SPI Signals Signal Name PAD[3:0]
Type Digital I/O Description General SERCOM pins One signal can be mapped to one of several pins. 31.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 31.5.1 I/O Lines In order to use the SERCOMs I/O lines, the I/O pins must be configured using the System Configuration registers or PPS registers. When the SERCOM is configured for SPI operation, the SERCOM controls the direction and value of the I/O pins according to the following table. Both PORT Control bits PINCFGn.PULLEN and PINCFGn.DRVSTR are still effective. If the receiver is disabled, the data input pin can be used for other purposes. In Host mode, the Client Select line (SS) is hardware controlled when the Host Client Select Enable bit in the Control B register
(CTRLB.MSSEN) is 1. Table 31-2. SPI Pin Configuration Pin MOSI MISO SCK Host SPI Output Input Output Client SPI Input Output Input The combined configuration of PORT, the Data In Pinout and the Data Out Pinout bit groups in the Control A register
(CTRLA.DIPO and CTRLA.DOPO) define the physical position of the SPI signals in the table above. 31.5.2 Power Management This peripheral can continue to operate in any Sleep mode where its source clock is running. The interrupts can wake-up the device from Sleep modes. 31.5.3 Clocks A generic clock (GCLK_SERCOMx_CORE) is required to clock the SPI. This clock must be configured and enabled in the Clock and Reset Unit (CRU) and Configuration (CFG.CFGPCLKGEN1) registers before using the SPI. This generic clock is asynchronous to the bus clock (PBx_CLK). Therefore, writes to certain registers will require synchronization to the clock domains. 31.5.4 DMA The DMA request lines are connected to the DMA Controller (DMAC). To use DMA requests with this peripheral, the DMAC must be configured first (see Direct Memory Access Controller (DMAC) from Related Links). Related Links 22. Direct Memory Access Controller (DMAC) 31.5.5 Interrupts The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral, the Interrupt Controller (NVIC) must be configured first. See Nested Vector Interrupt Controller (NVIC) from Related Links. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 602 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 31.5.6 Events Not applicable. 31.5.7 Debug Operation When the CPU is halted in Debug mode, this peripheral will continue normal operation. If the peripheral is configured to require periodical service by the CPU through interrupts or similar, improper operation or data loss may result during debugging. This peripheral can be forced to halt operation during debugging - refer to the Debug Control
(DBGCTRL) register for details. Related Links 31.8.11. DBGCTRL 31.5.8 Register Access Protection Registers with write access can be write-protected optionally by the Peripheral Access Controller (PAC). PAC write protection is not available for the following registers:
Interrupt Flag Clear and Status register (INTFLAG) Status register (STATUS) Data register (DATA) Optional PAC write protection is denoted by the "PAC Write-Protection" property in each individual register description. Write-protection does not apply to accesses through an external debugger. 31.5.9 Analog Connections Not applicable. 31.6 Functional Description 31.6.1 Principle of Operation The SPI is a high-speed synchronous data transfer interface. It allows high-speed communication between the device and peripheral devices. The SPI can operate as Host or Client. As Host, the SPI initiates and controls all data transactions. The SPI is single buffered for transmitting and double buffered for receiving. When transmitting data, the Data register can be loaded with the next character to be transmitted during the current transmission. When receiving, the data is transferred to the two-level receive buffer, and the receiver is ready for a new character. The SPI transaction format is shown in SPI Transaction Format. Each transaction can contain one or more characters. The character size is configurable, and can be either 8 or 9 bits. Figure 31-2. SPI Transaction Format Character Transaction MOSI/MISO Character 0 Character 1 Character 2 SS The SPI Host must pull the SPI select line (SS) of the desired Client low to initiate a transaction. The Host and Client prepare data to send via their respective Shift registers, and the Host generates the serial clock on the SCK line. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 603 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... Data are always shifted from Host to Client on the Host Output Client Input line (MOSI); data is shifted from Client to Host on the Host Input Client Output line (MISO). Each time character is shifted out from the Host, a character will be shifted out from the Client simultaneously. To signal the end of a transaction, the Host will pull the SS line high 31.6.2 Basic Operation 31.6.2.1 Initialization The following registers are enable-protected, meaning that they can only be written when the SPI is disabled
(CTRL.ENABLE=0):
Control A register (CTRLA), except Enable (CTRLA.ENABLE) and Software Reset (CTRLA.SWRST) Control B register (CTRLB), except Receiver Enable (CTRLB.RXEN) Baud register (BAUD) Address register (ADDR) When the SPI is enabled or is being enabled (CTRLA.ENABLE=1), any writing to these registers will be discarded. When the SPI is being disabled, writing to these registers will be completed after the disabling. Enable-protection is denoted by the Enable-Protection property in the register description. Initialize the SPI by following these steps:
1. 2. Select SPI mode in host/client operation in the Operating Mode bit group in the CTRLA register
(CTRLA.MODE= 0x2 or 0x3 ). Select Transfer mode for the Clock Polarity bit and the Clock Phase bit in the CTRLA register (CTRLA.CPOL and CTRLA.CPHA) if desired. Select the Frame Format value in the CTRLA register (CTRLA.FORM). 3. 4. Configure the Data In Pinout field in the Control A register (CTRLA.DIPO) for SERCOM pads of the receiver. 5. Configure the Data Out Pinout bit group in the Control A register (CTRLA.DOPO) for SERCOM pads of the transmitter. Select the Character Size value in the CTRLB register (CTRLB.CHSIZE). 6. 7. Write the Data Order bit in the CTRLA register (CTRLA.DORD) for data direction. 8. If the SPI is used in Host mode:
a. b. Select the desired baud rate by writing to the Baud register (BAUD). If Hardware SS control is required, write '1' to the Host SPI Select Enable bit in CTRLB register
(CTRLB.MSSEN). 9. Enable the receiver by writing the Receiver Enable bit in the CTRLB register (CTRLB.RXEN=1). 31.6.2.2 Enabling, Disabling, and Resetting This peripheral is enabled by writing '1' to the Enable bit in the Control A register (CTRLA.ENABLE), and disabled by writing '0' to it. Writing 1 to the Software Reset bit in the Control A register (CTRLA.SWRST) will reset all registers of this peripheral to their initial states, except the DBGCTRL register, and the peripheral is disabled. Refer to the CTRLA register description for details. Related Links 31.8.1. CTRLA 31.6.2.3 Clock Generation In the SPI host operation (CTRLA.MODE = 0x3), the serial clock (SCK) is generated internally by the SERCOM Baud Rate Generator (BRG). In the SPI mode, the BRG is set to Synchronous mode. The 8-bit Baud register (BAUD) value is used for generating SCK and clocking the Shift register (see Clock Generation Baud-Rate Generator from Related Links). In the SPI client operation (CTRLA.MODE = 0x2), the clock is provided by an external host on the SCK pin. This clock is used to clock the SPI Shift register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 604 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... Related Links 29.6.2.3. Clock Generation Baud-Rate Generator 31.6.2.4 Data Register The SPI Transmit Data register (TxDATA) and SPI Receive Data register (RxDATA) share the same I/O address, referred to as the SPI Data register (DATA). Writing DATA register will update the Transmit Data register. Reading the DATA register will return the contents of the Receive Data register. 31.6.2.5 SPI Transfer Modes There are four combinations of SCK phase and polarity to transfer serial data. The SPI Data Transfer modes are shown in SPI Transfer Modes (Table) and SPI Transfer Modes (Figure). SCK phase is configured by the Clock Phase bit in the CTRLA register (CTRLA.CPHA). SCK polarity is programmed by the Clock Polarity bit in the CTRLA register (CTRLA.CPOL). Data bits are shifted out and latched in on opposite edges of the SCK signal. This ensures sufficient time for the data signals to stabilize. Table 31-3. SPI Transfer Modes Mode CPOL CPHA Leading Edge 0 1 2 3 0 0 1 1 0 1 0 1 Rising, sample Rising, setup Falling, sample Falling, setup Note:
Leading edge is the first clock edge in a clock cycle. Trailing edge is the second clock edge in a clock cycle. Trailing Edge Falling, setup Falling, sample Rising, setup Rising, sample 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 605 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... Figure 31-3. SPI Transfer Modes Mode 0 Mode 2 SAMPLE I MOSI/MISO CHANGE 0 MOSI PIN CHANGE 0 MISO PIN SS MSB first (DORD = 0) LSB first (DORD = 1) MSB LSB Bit 6 Bit 1 Bit 5 Bit 2 Bit 4 Bit 3 Bit 3 Bit 4 Bit 2 Bit 5 Bit 1 Bit 6 LSB MSB Mode 1 Mode 3 SAMPLE I MOSI/MISO CHANGE 0 MOSI PIN CHANGE 0 MISO PIN SS MSB first (DORD = 0) LSB first (DORD = 1) MSB LSB Bit 6 Bit 1 Bit 5 Bit 2 Bit 4 Bit 3 Bit 3 Bit 4 Bit 2 Bit 5 Bit 1 Bit 6 LSB MSB 31.6.2.6 Transferring Data 31.6.2.6.1 Host In Host mode (CTRLA.MODE=0x3), when Host SPI Select Enable (CTRLB.MSSEN) is 1, hardware will control the SS line. When Host SPI Select Enable (CTRLB.MSSEN) is '0', the SS line must be configured as an output. SS can be assigned to any general purpose I/O pin. When the SPI is ready for a data transaction, software must pull the SS line low. When writing a character to the Data register (DATA), the character will be transferred to the Shift register. Once the content of TxDATA has been transferred to the Shift register, the Data Register Empty flag in the Interrupt Flag Status and Clear register (INTFLAG.DRE) will be set. And a new character can be written to DATA. Each time one character is shifted out from the Host, another character will be shifted in from the Client simultaneously. If the receiver is enabled (CTRLA.RXEN=1), the contents of the Shift register will be transferred to the two-level receive buffer. The transfer takes place in the same clock cycle as the last data bit is shifted in. And the Receive Complete Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.RXC) will be set. The received data can be retrieved by reading DATA. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 606 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... When the last character has been transmitted and there is no valid data in DATA, the Transmit Complete Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.TXC) will be set. When the transaction is finished, the Host must pull the SS line high to notify the Client. If Host SPI Select Enable (CTRLB.MSSEN) is set to '0', the software must pull the SS line high. 31.6.2.6.2 Client In Client mode (CTRLA.MODE = 0x2), the SPI interface will remain inactive with the MISO line tri-stated as long as the SS pin is pulled high. Software may update the contents of DATA at any time as long as the Data Register Empty flag in the Interrupt Status and Clear register (INTFLAG.DRE) is set. When SS is pulled low and SCK is running, the client will sample and shift out data according to the Transaction mode set. Once the content of TxDATA is loaded into the Shift register, INTFLAG.DRE will be set and new data can be written to DATA. Similar to the host, the client will receive one character for each character transmitted. A character will be transferred into the two-level receive buffer within the same clock cycle its last data bit is received. The received character can be retrieved from DATA when the Receive Complete interrupt flag (INTFLAG.RXC) is set. When the host pulls the SS line high, the transaction is done and the Transmit Complete Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.TXC) will be set. After DATA is written it takes up to three SCK clock cycles until the content of DATA is ready to be loaded into the Shift register on the next character boundary. As a consequence, the first character transferred in a SPI transaction will not be the content of DATA. This can be avoided by using the preloading feature (see Preloading of the Client Shift Register from Related Links). When transmitting several characters in one SPI transaction, the data has to be written into DATA register with at least three SCK clock cycles left in the current character transmission. If this criteria is not met, the previously received character will be transmitted. Once the DATA register is empty, it takes three CLK_SERCOM_APB cycles for INTFLAG.DRE to be set. Related Links 31.6.3.2. Preloading of the Client Shift Register 31.6.2.7 Receiver Error Bit The SPI receiver has one error bit: the Buffer Overflow bit (BUFOVF), which can be read from the Status register
(STATUS). Once an error happens, the bit will stay set until it is cleared by writing '1' to it. The bit is also automatically cleared when the receiver is disabled. There are two methods for buffer overflow notification, selected by the immediate Buffer Overflow Notification bit in the Control A register (CTRLA.IBON):
If CTRLA.IBON=1, STATUS.BUFOVF is raised immediately upon buffer overflow. Software can then empty the receive FIFO by reading RxDATA until the receiver complete Interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.RXC) goes low. If CTRLA.IBON=0, the Buffer Overflow condition travels with data through the receive FIFO. After the received data is read, STATUS.BUFOVF and INTFLAG.ERROR will be set along with INTFLAG.RXC, and RxDATA will be zero. 31.6.3 Additional Features 31.6.3.1 Address Recognition When the SPI is configured for client operation (CTRLA.MODE=0x2) with address recognition (CTRLA.FORM is 0x2), the SERCOM address recognition logic is enabled: the first character in a transaction is checked for an address match. If there is a match, the Receive Complete Interrupt flag in the Interrupt Flag Status and Clear register
(INTFLAG.RXC) is set, the MISO output is enabled, and the transaction is processed. If the device is in Sleep mode, an address match can wake-up the device in order to process the transaction. If there is no match, the complete transaction is ignored. If a 9-bit frame format is selected, only the lower 8 bits of the Shift register are checked against the Address register
(ADDR). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 607 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... Preload must be disabled (CTRLB.PLOADEN=0) in order to use this mode. Related Links 29.6.3.1. Address Match and Mask 31.6.3.2 Preloading of the Client Shift Register When starting a transaction, the client will first transmit the contents of the shift register before loading new data from DATA. The first character sent can be either the reset value of the shift register (if this is the first transmission since the last reset) or the last character in the previous transmission. Preloading can be used to preload data into the shift register while SS is high: this eliminates sending a dummy character when starting a transaction. If the shift register is not preloaded, the current contents of the shift register will be shifted out. Only one data character will be preloaded into the shift register while the synchronized SS signal is high. If the next character is written to DATA before SS is pulled low, the second character will be stored in DATA until transfer begins. For proper preloading, sufficient time must elapse between SS going low and the first SCK sampling edge, as shown in the following figure. For timing details, see Electrical Characteristics from Related Links. Preloading is enabled by writing 1 to the Client Data Preload Enable bit in the CTRLB register (CTRLB.PLOADEN). Figure 31-4. Timing Using Preloading Required SS-to-SCK time using PRELOADEN SS SS synchronized to system domain SCK Synchronization to system domain MISO to SCK setup time Related Links 43. Electrical Characteristics 31.6.3.3 Host with Several Clients If the bus consists of several SPI clients, a SPI host can use general purpose I/O pins to control the SS line to each of the clients on the bus, as shown in the following figure. In this configuration, the single selected SPI client will drive the tri-state MISO line. Figure 31-5. Multiple Clients in Parallel shift register SPI Host MOSI MISO SCK SS[0]
SS[n-1]
MOSI MISO SCK SS MOSI MISO SCK SS shift register SPI Client 0 shift register SPI Client n-1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 608 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... Another configuration is multiple clients in series, as shown in the following figure. In this configuration, all n attached clients are connected in series. A common SS line is provided to all clients, enabling them simultaneously. The host must shift n characters for a complete transaction. The SS line is controlled by a normal GPIO. Figure 31-6. Multiple Clients in Series shift register SPI Host MOSI MISO SCK SS MOSI MISO SCK SS MOSI MISO SCK SS shift register SPI Client 0 shift register SPI Client n-1 31.6.3.4 Loop-Back Mode For Loop-back mode, configure the Data In Pinout (CTRLA.DIPO) and Data Out Pinout (CTRLA.DOPO) to use the same data pins for transmit and receive. The loop-back is through the pad, so the signal is also available externally. 31.6.3.5 Hardware Controlled SS In Host mode, a single SS chip select can be controlled by hardware by writing the Host SPI Select Enable
(CTRLB.MSSEN) bit to '1'. In this mode, the SS pin is driven low for a minimum of one baud cycle before transmission begins, and stays low for a minimum of one baud cycle after transmission completes. If back-to-back frames are transmitted, the SS pin will always be driven high for a minimum of one baud cycle between frames. In Hardware Controlled SS, the time T is between one and two baud cycles depending on the SPI Transfer mode. Figure 31-7. Hardware Controlled SS T T T T T SS SCK T = 1 to 2 baud cycles When CTRLB.MSSEN=0, the SS pin(s) is/are controlled by user software and normal GPIO. 31.6.3.6 SPI Select Low Detection In Client mode, the SPI can wake the CPU when the SPI Select (SS) goes low. When the SPI Select Low Detect is enabled (CTRLB.SSDE=1), a high-to-low transition will set the SPI Select Low Interrupt flag (INTFLAG.SSL) and the device will wake-up if applicable. 31.6.3.7 Host Inter-Character Spacing When configured as host, inter-character spacing can be increased by writing a non-zero value to the Inter-Character Spacing bit field in the Control C register (CTRLC.ICSPACE). When non-zero, CTRLC.ICSPACE represents the minimum number of baud cycles that the SCK clock line does not toggle and the next character is stalled. The figure gives an example for CTRLC.ICSPACE=4; In this case, the SCK is inactive for 4 baud cycles. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 609 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... Figure 31-8. Four Cycle Inter-Character Spacing Example T T T T SCK T = 1 baud cycle 31.6.3.8 32-bit Extension For better system bus utilization, 32-bit data receive and transmit can be enabled by writing to the Data 32-bit bit field in the Control C register (CTRLC.DATA32B=1). When enabled, write and read transaction to/from the DATA register are 32 bit in size. If frames are not multiples of 4 Bytes, the Length Counter (LENGTH.LEN) and Length Enable (LENGTH.LENEN) must be configured before data transfer begins. LENGTH.LEN must be enabled only when CTRLC.DATA32B is enabled. The following figure shows the order of transmit and receive when using 32-bit mode. Bytes are transmitted or received and stored in order from 0 to 3. Only 8-bit character size is supported. Figure 31-9. 32-bit Extension Byte Ordering APB Write/Read BYTE3 BYTE2 BYTE1 BYTE0 Bit Position 31 0 32-bit Extension Client Operation The following figure shows a transaction with 32-bit Extension enabled (CTRLC.DATA32B=1). When address recognition is enabled (CTRLA.FORM=0x2) and there is an address match, the address is loaded into the FIFO as Byte zero and data begins with Byte 1. INTFLAGS.RXC will then be raised for every 4 Bytes transferred. For transmit, there is a 32-bit holding buffer in the core domain. Once DATA has been registered in the core domain, INTFLAG.DRE will be raised, so that the next 32 bits can be written to the DATA register. Figure 31-10. 32-bit Extension Client Operation RXC interrupt RXC interrupt ADDRESS S W Byte 0 Byte 1 Byte 2 Byte 3 S W When utilizing the length counter, the LENGTH register must be written before the frame begins. If the frame length while SS is low is not a multiple of LENGTH.LEN Bytes, the Length Error Status bit (STATUS.LENERR) is raised. If LENGTH.LEN is not a multiple of 4 Bytes, the final INTFLAG.RXC interrupt will be raised when the last Byte is received. The length count is based on the received Bytes, or the number of clocks if the receiver is not enabled. If pre-
loading is disabled and DATA is written to for transmit before SCK starts, transmitted data will be delayed by one Byte, but the length counter will still increment for the first (empty) Byte transmission. When the counter reaches LENGTH.LEN, the internal length counter, Rx Byte counter, and Tx Byte counter are reset. If multiple lengths are to be transmitted, INTFLAG.TXC must go high before writing DATA for subsequent lengths. If there is a Length Error (STATUS.LENERR), the remaining Bytes in the length will be transmitted at the beginning of the next frame. If this is not desired, the SERCOM must be disabled and re-enabled in order to flush the Tx and Rx pipelines. Writing the LENGTH register while a frame is in progress will produce unpredictable results. If LENGTH.LENEN is not configured and a frame is not a multiple of 4 Bytes (while SS is low), the remainder will be transmitted in the next frame. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 610 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 32-bit Extension Host Operation When using the SPI configured as Host, the Length and the Length Enable bit fields (LENGTH.LEN and LENGTH.LENEN) must be written before the frame begins. When LENGTH.LENEN is written to '1', the value of LENGTH.LEN determines the number of data bytes in the transaction from 1 to 255. For receive data, INTFLAG.RXC is raised every 4 Bytes received. If LENGTH.LEN is not a multiple of 4 Bytes, the final INTFLAG.RXC is set when the final byte is received. For transmit, there is a holding buffer for the 32-bit data in the core domain. Once DATA has been registered in the core domain, INTFLAG.DRE will be raised so that the next 32 bits can be written to the DATA register. If multiple lengths are to be transmitted, INTFLAG.TXC must go high before writing DATA for subsequent lengths. 31.6.4 DMA, Interrupts, and Events Table 31-4. Module Request for SERCOM SPI Condition Request Data Register Empty
(DRE) DMA Yes Interrupt Yes Event NA
(request cleared when data is written) Receive Complete (RXC) Yes
(request cleared when data is read) Transmit Complete (TXC) Client Select low (SSL) Error (ERROR) NA NA NA Yes Yes Yes Yes 31.6.4.1 DMA Operation The SPI generates the following DMA requests:
31.6.4.2 Interrupts The SPI has the following interrupt sources. These are asynchronous interrupts, and can wake-up the device from any Sleep mode:
Data Register Empty (DRE) Receive Complete (RXC) Transmit Complete (TXC) SPI Select Low (SSL) Error (ERROR) Each interrupt source has its own Interrupt flag. The Interrupt flag in the Interrupt Flag Status and Clear register
(INTFLAG) will be set when the Interrupt condition is met. Each interrupt can be individually enabled by writing 1 to the corresponding bit in the Interrupt Enable Set register (INTENSET), and disabled by writing 1 to the corresponding bit in the Interrupt Enable Clear register (INTENCLR). The status of enabled interrupts can be read from either INTENSET or INTENCLR. An interrupt request is generated when the Interrupt flag is set and if the corresponding interrupt is enabled. The interrupt request remains active until either the Interrupt flag is cleared, the interrupt is disabled, or the SPI is reset. For details on clearing Interrupt flags, see INTFLAG register description. The value of INTFLAG indicates which interrupt is executed. Note that interrupts must be globally enabled for interrupt requests. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 611 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.6.4.3 Events Not applicable. 31.6.5 Sleep Mode Operation The behavior in sleep mode is depending on the Host/Client configuration and the Run In Standby bit in the Control A register (CTRLA.RUNSTDBY):
Host operation, CTRLA.RUNSTDBY=1: The peripheral clock GCLK_SERCOM_CORE will continue to run in idle sleep mode and in standby sleep mode. Any interrupt can wake up the device. Host operation, CTRLA.RUNSTDBY=0: GLK_SERCOMx_CORE will be disabled after the ongoing transaction is finished. Any interrupt can wake up the device. Client operation, CTRLA.RUNSTDBY=1: The Receive Complete interrupt can wake up the device Client operation, CTRLA.RUNSTDBY=0: All reception will be dropped, including the ongoing transaction 31.6.6 Synchronization Due to asynchronicity between the main clock domain and the peripheral clock domains, some registers need to be synchronized when written or read. The following bits are synchronized when written:
Software Reset bit in the CTRLA register (CTRLA.SWRST) Enable bit in the CTRLA register (CTRLA.ENABLE) Receiver Enable bit in the CTRLB register (CTRLB.RXEN) Note:CTRLB.RXEN is write-synchronized somewhat differently. See CTRLB register from Related Links. Required write synchronization is denoted by the "Write-Synchronized" property in the register description. Related Links 31.8.2. CTRLB 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 612 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.7 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CTRLA 0x04 CTRLB 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 RUNSTDBY MODE[2:0]
ENABLE SWRST DORD CPOL CPHA FORM[3:0]
DIPO[1:0]
IBON DOPO[1:0]
PLOADEN AMODE[1:0]
MSSEN CHSIZE[2:0]
SSDE RXEN Reserved BAUD 7:0 BAUD[7:0]
0x08
... 0x0B 0x0C 0x0D
... 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A Reserved INTENCLR Reserved INTENSET Reserved INTFLAG Reserved STATUS 0x1C SYNCBUSY 0x20
... 0x23 Reserved 0x24 ADDR 0x28 DATA ERROR ERROR ERROR 7:0 7:0 7:0 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 0x2C
... 0x2F 0x30 Reserved DBGCTRL 7:0 31.8 Register Description SSL SSL SSL RXC RXC RXC BUFOVF TXC TXC TXC DRE DRE DRE CTRLB ENABLE SWRST ADDR[7:0]
ADDRMASK[7:0]
DATA[7:0]
DATA[15:8]
DATA[23:16]
DATA[31:24]
DBGSTOP Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers require synchronization when read and/or written. Synchronization is denoted by the Read-
Synchronized and/or Write-Synchronized property in each individual register description. Some registers are enable-protected, meaning they can only be written when the module is disabled. Enable-
protection is denoted by the Enable-Protected property in each individual register description. Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 613 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... See Peripheral Access Controller (PAC) from Related Links. Related Links 26. Peripheral Access Controller (PAC) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 614 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized CTRLA 0x00 0x00000000 Bit 31 Access Reset 30 DORD R/W 0 Bit 23 22 Access Reset Bit 15 14 Access Reset 29 CPOL R/W 0 21 R/W 0 13 DIPO[1:0]
Bit 7 6 5 RUNSTDBY Access Reset R/W 0 Bit 30 DORDData Order 28 CPHA R/W 0 20 R/W 0 12 4 R/W 0 27 R/W 0 19 FORM[3:0]
26 R/W 0 18 11 10 25 R/W 0 17 R/W 0 9 24 R/W 0 16 R/W 0 DOPO[1:0]
3 MODE[2:0]
R/W 0 2 R/W 0 1 ENABLE R/W 0 8 IBON R/W 0 0 SWRST R/W 0 This bit selects the data order when a character is shifted out from the shift register. This bit is not synchronized. Value 0 1 Description MSB is transferred first. LSB is transferred first. Bit 29 CPOLClock Polarity In combination with the Clock Phase bit (CPHA), this bit determines the SPI transfer mode. This bit is not synchronized. Value 0 Description SCK is low when idle. The leading edge of a clock cycle is a rising edge, while the trailing edge is a falling edge. SCK is high when idle. The leading edge of a clock cycle is a falling edge, while the trailing edge is a rising edge. 1 Bit 28 CPHAClock Phase In combination with the Clock Polarity bit (CPOL), this bit determines the SPI transfer mode. This bit is not synchronized. Mode CPOL CPHA 0 0 1 1 0 1 0 1 Leading Edge Rising, sample Rising, change Falling, sample Falling, change Trailing Edge Falling, change Falling, sample Rising, change Rising, sample Description The data is sampled on a leading SCK edge and changed on a trailing SCK edge. The data is sampled on a trailing SCK edge and changed on a leading SCK edge. 0x0 0x1 0x2 0x3 Value 0 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 615 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... Bits 27:24 FORM[3:0]Frame Format This bit field selects the various frame formats supported by the SPI in client mode. When the 'SPI frame with address' format is selected, the first byte received is checked against the ADDR register. FORM[3:0]
0x0 0x1 0x2 0x3-0xF Name SPI SPI_ADDR Description SPI frame Reserved SPI frame with address Reserved Bits 21:20 DIPO[1:0]Data In Pinout These bits define the data in (DI) pad configurations. In host operation, DI is MISO. In client operation, DI is MOSI. These bits are not synchronized. DIPO[1:0]
0x0 0x1 0x2 0x3 Name PAD[0]
PAD[1]
PAD[2]
PAD[3]
Bits 17:16 DOPO[1:0]Data Out Pinout Description SERCOM PAD[0] is used as data input SERCOM PAD[1] is used as data input SERCOM PAD[2] is used as data input SERCOM PAD[3] is used as data input This bit defines the available pad configurations for data out (DO), the serial clock (SCK) and the SPI Select (SS). In Client operation, the SPI Select line (SS) is controlled by DOPO. In host operation, the SPI Select line (SS) is either controlled by DOPO when CTRLB.MSSEN=1, or by a GPIO driven by the application when CTRLB.MSSEN=0. In host operation, DO is MOSI. In client operation, DO is MISO. These bits are not synchronized. DOPO DO SCK Client SS Host SS (MSSEN = 1) Host SS (MSSEN = 0) 0x0 0x2 PAD[0] PAD[1]
PAD[3] PAD[1]
PAD[2]
PAD[2]
PAD[2]
PAD[2]
Any GPIO configured by the application Any GPIO configured by the application Bit 8 IBONImmediate Buffer Overflow Notification This bit controls when the Buffer Overflow Status bit (STATUS.BUFOVF) is set when a buffer overflow occurs. This bit is not synchronized. Value 0 1 Description STATUS.BUFOVF is set when it occurs in the data stream. STATUS.BUFOVF is set immediately upon buffer overflow. Bit 7 RUNSTDBYRun In Standby This bit defines the functionality in Standby mode. These bits are not synchronized. RUNSTDBY Client Host 0x0 0x1 Disabled. All reception is dropped, including the ongoing transaction. Ongoing transaction continues, wake on Receive Complete interrupt. Generic clock is disabled when ongoing transaction is finished. All interrupts can wake up the device. Generic clock is enabled while in sleep modes. All interrupts can wake up the device. Bits 4:2 MODE[2:0]Operating Mode These bits must be written to 0x2 or 0x3 to select the SPI serial communication interface of the SERCOM. 0x2: SPI client operation 0x3: SPI host operation These bits are not synchronized. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 616 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... Bit 1 ENABLEEnable Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRL.ENABLE will read back immediately and the Synchronization Enable Busy bit in the Synchronization Busy register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE is cleared when the operation is complete. This bit is not enable-protected. Value 0 1 Description The peripheral is disabled or being disabled. The peripheral is enabled or being enabled. Bit 0 SWRSTSoftware Reset Writing 0 to this bit has no effect. Writing 1 to this bit resets all registers in the SERCOM, except DBGCTRL, to their initial state, and the SERCOM will be disabled. Writing 1 to CTRL.SWRST will always take precedence, meaning that all other writes in the same write-operation will be discarded. Any register write access during the ongoing reset will result in an APB error. Reading any register will return the reset value of the register. Due to synchronization, there is a delay from writing CTRLA.SWRST until the reset is complete. CTRLA.SWRST and SYNCBUSY. SWRST will both be cleared when the reset is complete. This bit is not enable-protected. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description There is no reset operation ongoing. The reset operation is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 617 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.2 Control B Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized CTRLB 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 Access Reset Bit 15 14 AMODE[1:0]
Access Reset R/W 0 R/W 0 13 MSSEN R/W 0 12 11 10 17 RXEN R/W 0 9 SSDE R/W 0 Bit 7 Access Reset 6 PLOADEN R/W 0 Bit 17 RXENReceiver Enable 5 4 3 2 R/W 0 1 CHSIZE[2:0]
R/W 0 16 8 0 R/W 0 Writing 0 to this bit will disable the SPI receiver immediately. The receive buffer will be flushed, data from ongoing receptions will be lost and STATUS.BUFOVF will be cleared. Writing 1 to CTRLB.RXEN when the SPI is disabled will set CTRLB.RXEN immediately. When the SPI is enabled, CTRLB.RXEN will be cleared, SYNCBUSY.CTRLB will be set and remain set until the receiver is enabled. When the receiver is enabled CTRLB.RXEN will read back as 1. Writing 1 to CTRLB.RXEN when the SPI is enabled will set SYNCBUSY.CTRLB, which will remain set until the receiver is enabled, and CTRLB.RXEN will read back as 1. This bit is not enable-protected. Value 0 1 Description The receiver is disabled. The receiver is enabled or it will be enabled when SPI is enabled. Bits 15:14 AMODE[1:0]Address Mode These bits set the Client Addressing mode when the frame format (CTRLA.FORM) with address is used. They are unused in Host mode. These bits are not synchronized. AMODE[1:0] Name Description 0x0 0x1 0x2 0x3 ADDRMASK is used as a mask to the ADDR register MASK 2_ADDRS The client responds to the two unique addresses in ADDR and ADDRMASK RANGE The client responds to the range of addresses between and including ADDR and ADDRMASK. ADDR is the upper limit Reserved Bit 13 MSSENHost SPI Select Enable This bit enables hardware SPI Select (SS) control. This bit is not synchronized. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 618 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... Value 0 1 Description Hardware SS control is disabled. Hardware SS control is enabled. Bit 9 SSDESPI Select Low Detect Enable This bit enables wake-up when the SPI Select (SS) pin transitions from high-to-low. This bit is not synchronized. Value 0 1 Description SS low detector is disabled. SS low detector is enabled. Bit 6 PLOADENClient Data Preload Enable Setting this bit will enable preloading of the Client Shift register when there is no transfer in progress. If the SS line is high when DATA is written, it will be transferred immediately to the Shift register. This bit is not synchronized. Bits 2:0 CHSIZE[2:0]Character Size These bits are not synchronized. CHSIZE[2:0]
0x0 0x1 0x2-0x7 Name 8BIT 9BIT Description 8 bits 9 bits Reserved 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 619 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.3 Baud Rate Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected BAUD 0x0C 0x00 Bit 7 Access Reset R/W 0 6 R/W 0 5 R/W 0 BAUD[7:0]
4 R/W 0 3 R/W 0 2 R/W 0 1 R/W 0 0 R/W 0 Bits 7:0 BAUD[7:0]Baud Register These bits control the clock generation, as described in the SERCOM Clock Generation Baud-Rate Generator. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 620 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.4 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x14 0x00 This register allows the user to disable an interrupt without read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENSET). Bit Access Reset 7 ERROR R/W 0 6 5 4 3 SSL R/W 0 2 RXC R/W 0 1 TXC R/W 0 0 DRE R/W 0 Bit 7 ERRORError Interrupt Enable Writing 0 to this bit has no effect. Writing 1 to this bit will clear the Error Interrupt Enable bit, which disables the Error interrupt. Value 0 1 Description Error interrupt is disabled. Error interrupt is enabled. Bit 3 SSLClient Select Low Interrupt Enable Writing 0 to this bit has no effect. Writing 1 to this bit will clear the Client Select Low Interrupt Enable bit, which disables the Client Select Low interrupt. Value 0 1 Description Client Select Low interrupt is disabled. Client Select Low interrupt is enabled. Bit 2 RXCReceive Complete Interrupt Enable Writing 0 to this bit has no effect. Writing 1 to this bit will clear the Receive Complete Interrupt Enable bit, which disables the Receive Complete interrupt. Value 0 1 Description Receive Complete interrupt is disabled. Receive Complete interrupt is enabled. Bit 1 TXCTransmit Complete Interrupt Enable Writing 0 to this bit has no effect. Writing 1 to this bit will clear the Transmit Complete Interrupt Enable bit, which disable the Transmit Complete interrupt. Value 0 1 Description Transmit Complete interrupt is disabled. Transmit Complete interrupt is enabled. Bit 0 DREData Register Empty Interrupt Enable Writing 0 to this bit has no effect. Writing 1 to this bit will clear the Data Register Empty Interrupt Enable bit, which disables the Data Register Empty interrupt. Value 0 1 Description Data Register Empty interrupt is disabled. Data Register Empty interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 621 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.5 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x16 0x00 This register allows the user to disable an interrupt without read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear register (INTENCLR). Bit Access Reset 7 ERROR R/W 0 6 5 4 3 SSL R/W 0 2 RXC R/W 0 1 TXC R/W 0 0 DRE R/W 0 Bit 7 ERRORError Interrupt Enable Writing 0 to this bit has no effect. Writing 1 to this bit will set the Error Interrupt Enable bit, which enables the Error interrupt. Value 0 1 Description Error interrupt is disabled. Error interrupt is enabled. Bit 3 SSLClient Select Low Interrupt Enable Writing 0 to this bit has no effect. Writing 1 to this bit will set the Client Select Low Interrupt Enable bit, which enables the Client Select Low interrupt. Value 0 1 Description Client Select Low interrupt is disabled. Client Select Low interrupt is enabled. Bit 2 RXCReceive Complete Interrupt Enable Writing 0 to this bit has no effect. Writing 1 to this bit will set the Receive Complete Interrupt Enable bit, which enables the Receive Complete interrupt. Value 0 1 Description Receive Complete interrupt is disabled. Receive Complete interrupt is enabled. Bit 1 TXCTransmit Complete Interrupt Enable Writing 0 to this bit has no effect. Writing 1 to this bit will set the Transmit Complete Interrupt Enable bit, which enables the Transmit Complete interrupt. Value 0 1 Description Transmit Complete interrupt is disabled. Transmit Complete interrupt is enabled. Bit 0 DREData Register Empty Interrupt Enable Writing 0 to this bit has no effect. Writing 1 to this bit will set the Data Register Empty Interrupt Enable bit, which enables the Data Register Empty interrupt. Value 0 1 Description Data Register Empty interrupt is disabled. Data Register Empty interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 622 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.6 Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
INTFLAG 0x18 0x00
Bit Access Reset 7 ERROR R/W 0 Bit 7 ERRORError 6 5 4 3 SSL R/W 0 2 RXC R 0 1 TXC R/W 0 0 DRE R 0 This flag is cleared by writing '1' to it. This bit is set when any error is detected. Errors that will set this flag have corresponding Status flags in the STATUS register. The BUFOVF error will set this Interrupt flag. Writing '0' to this bit has no effect. Writing '1' to this bit will clear the flag. Bit 3 SSLSPI Select Low This flag is cleared by writing '1' to it. This bit is set when a high to low transition is detected on the SS pin in Client mode and SPI Select Low Detect
(CTRLB.SSDE) is enabled. Writing '0' to this bit has no effect. Writing '1' to this bit will clear the flag. Bit 2 RXCReceive Complete This flag is cleared by reading the Data (DATA) register or by disabling the receiver. This flag is set when there are unread data in the receive buffer. If address matching is enabled, the first data received in a transaction will be an address. Writing '0' to this bit has no effect. Writing '1' to this bit has no effect. Bit 1 TXCTransmit Complete This flag is cleared by writing '1' to it or by writing new data to DATA. In Host mode, this flag is set when the data have been shifted out and there are no new data in DATA. In Client mode, this flag is set when the SS pin is pulled high. If address matching is enabled, this flag is only set if the transaction was initiated with an address match. Writing '0' to this bit has no effect. Writing '1' to this bit will clear the flag. Bit 0 DREData Register Empty This flag is cleared by writing new data to DATA. This flag is set when DATA is empty and ready for new data to transmit. Writing '0' to this bit has no effect. Writing '1' to this bit has no effect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 623 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.7 Status Name:
Offset:
Reset:
Property:
STATUS 0x1A 0x0000 Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 Access Reset Bit 2 BUFOVFBuffer Overflow 2 BUFOVF R/W 0 9 1 8 0 Reading this bit before reading DATA will indicate the error status of the next character to be read. This bit is cleared by writing 1 to the bit or by disabling the receiver. This bit is set when a Buffer Overflow condition is detected. See CTRLA from Related Links for overflow handling. When set, the corresponding RxDATA will be zero. Writing 0 to this bit has no effect. Writing 1 to this bit will clear it. Value 0 1 Description No Buffer Overflow has occurred. A Buffer Overflow has occurred. Related Links 31.8.1. CTRLA 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 624 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.8 Synchronization Busy Name:
Offset:
Reset:
Property:
SYNCBUSY 0x1C 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 3 Access Reset Bit 2 CTRLBCTRLB Synchronization Busy 2 CTRLB R 0 1 ENABLE R 0 0 SWRST R 0 Writing to the CTRLB when the SERCOM is enabled requires synchronization. Ongoing synchronization is indicated by SYNCBUSY.CTRLB=1 until synchronization is complete. If CTRLB is written while SYNCBUSY.CTRLB=1, an APB error will be generated. Value 0 1 Description CTRLB synchronization is not busy. CTRLB synchronization is busy. Bit 1 ENABLESERCOM Enable Synchronization Busy Enabling and disabling the SERCOM (CTRLA.ENABLE) requires synchronization. Ongoing synchronization is indicated by SYNCBUSY.ENABLE=1 until synchronization is complete. Value 0 1 Description Enable synchronization is not busy. Enable synchronization is busy. Bit 0 SWRSTSoftware Reset Synchronization Busy Resetting the SERCOM (CTRLA.SWRST) requires synchronization. Ongoing synchronization is indicated by SYNCBUSY.SWRST=1 until synchronization is complete. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description SWRST synchronization is not busy. SWRST synchronization is busy. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 625 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.9 Address Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected ADDR 0x24 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 Access Reset R/W 0 Bit 15 Access Reset Bit 7 Access Reset R/W 0 22 R/W 0 14 6 R/W 0 21 R/W 0 13 5 R/W 0 20 19 ADDRMASK[7:0]
R/W 0 12 4 R/W 0 ADDR[7:0]
R/W 0 11 3 R/W 0 18 R/W 0 10 2 R/W 0 17 R/W 0 9 1 16 R/W 0 8 0 R/W 0 R/W 0 Bits 23:16 ADDRMASK[7:0]Address Mask These bits hold the address mask when the transaction format with address is used (CTRLA.FORM, CTRLB.AMODE). Bits 7:0 ADDR[7:0]Address These bits hold the address when the transaction format with address is used (CTRLA.FORM, CTRLB.AMODE). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 626 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.10 Data Name:
Offset:
Reset:
Property:
DATA 0x28 0x0000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 DATA[31:24]
R/W 0 20 R/W 0 19 DATA[23:16]
R/W 0 12 R/W 0 4 R/W 0 DATA[15:8]
DATA[7:0]
R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 DATA[31:0]Data Reading these bits will return the contents of the receive data buffer. The register must be read only when the Receive Complete Interrupt Flag bit in the Interrupt Flag Status and Clear register (INTFLAG.RXC) is set. Writing these bits will write the transmit data buffer. This register must be written only when the Data Register Empty Interrupt Flag bit in the Interrupt Flag Status and Clear register (INTFLAG.DRE) is set. Reads and writes are 32-bit or CTLB.CHSIZE based on the CTRLC.DATA32B setting. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 627 PIC32CX-BZ2 and WBZ45 Family SERCOM Serial Peripheral Interface (SERCOM S... 31.8.11 Debug Control Name:
Offset:
Reset:
Property: PAC Write-Protection DBGCTRL 0x30 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGSTOPDebug Stop Mode DBGSTOP R/W 0 This bit controls the functionality when the CPU is halted by an external debugger. Value 0 1 Description The baud-rate generator continues normal operation when the CPU is halted by an external debugger. The baud-rate generator is halted when the CPU is halted by an external debugger. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 628 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32. SERCOM Inter-Integrated Circuit (SERCOM I2C) 32.1 Overview The Inter-Integrated Circuit ( I2C) interface is one of the available modes in the serial communication interface
(SERCOM). The I2C interface uses the SERCOM transmitter and receiver configured as shown in Figure 32-1. Labels in capital letters are registers accessible by the CPU, while lowercase labels are internal to the SERCOM. A SERCOM instance can be configured to be either an I2C host or an I2C client. Both host and client have an interface containing a shift register, a transmit buffer and a receive buffer. In addition, the I2C host uses the SERCOM baud-rate generator, while the I2C client uses the SERCOM address match logic. Note:Traditional Inter-Integrated Circuit ( I2C) documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Host and Client, respectively. 32.2 Features SERCOM I2C includes the following features:
Host or Client Operation Can be used with DMA Philips I2C Compatible SMBus Compatible PMBus Compatible Support of 100 kHz and 400 kHz, 1 MHz I2C mode 4-Wire Operation Supported Physical interface includes:
Slew-rate limited outputs Filtered inputs Client Operation:
Operation in all Sleep modes Wake-up on address match 7-bit Address match in hardware for:
Unique address and/or 7-bit general call address Address range Two unique addresses can be used with DMA 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 629 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.3 Block Diagram Figure 32-1. I2C Single-Host Single-Client Interconnection Host Client BAUD TxDATA TxDATA ADDR/ADDRMASK baud rate generator SCL hold low shift register 0 0 SCL 0 SCL hold low SDA 0 shift register RxDATA RxDATA
32.4 Signal Description Signal Name PAD[0]
PAD[1]
PAD[2]
PAD[3]
Type Digital I/O Digital I/O Digital I/O Digital I/O Description SDA SCL SDA_OUT (4-wire operation) SCL_OUT (4-wire operation) One signal can be mapped on several pins. Not all the pins are I2C pins. Refer to Table 7-5. SERCOM Pins Supporting I2C for additional information . Related Links 32.6.3.3. 4-Wire Mode 32.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 32.5.1 I/O Lines In order to use the SERCOMs I/O lines, the I/O pins must be configured using the System Configuration registers only. I2C does not operate through PPS. See DEVCFG1 configuration bits SCOMn_HSEN in Configuration Bits Fuses and also CFGCON1 SCOMn_HSEN in CFGCON1(L) register. See CFGCON1(L) register from Related Links. When the SERCOM is used in I2C mode, the SERCOM controls the direction and value of the I/O pins. In I2C mode pull-up resistors are disabled. External pull-up resistors are required for proper function. Related Links 18.4.2. CFGCON1(L) 32.5.2 Power Management This peripheral can continue to operate in any Sleep mode where its source clock is running. The interrupts can wake-up the device from Sleep modes. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 630 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.5.3 Clocks Two generic clocks are used by SERCOM, GCLK_SERCOMx_CORE and GCLK_SERCOMx_SLOW. The core clock
(GCLK_SERCOMx_CORE) can clock the I2C when working as a host. The slow clock (GCLK_SERCOMx_SLOW) is required only for certain functions, e.g., SMBus timing. These two clocks must be configured and enabled in the CRU registers before using the I2C. These generic clocks are asynchronous to the bus clock (PBx_CLK). Due to this asynchronicity, writes to certain registers will require synchronization between the clock domains. 32.5.4 DMA The DMA request lines are connected to the DMA Controller (DMAC). To use DMA requests with this peripheral, the DMAC must be configured first (see Direct Memory Access Controller (DMAC) from Related Links). Related Links 22. Direct Memory Access Controller (DMAC) 32.5.5 Interrupts The interrupt request line is connected to the Interrupt Controller. In order to use interrupt requests of this peripheral, the Interrupt Controller (NVIC) must be configured first. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 32.5.6 Events Not applicable. 32.5.7 Debug Operation When the CPU is halted in Debug mode, this peripheral will continue normal operation. If the peripheral is configured to require periodical service by the CPU through interrupts or similar, improper operation or data loss may result during debugging. This peripheral can be forced to halt operation during debugging - refer to the Debug Control
(DBGCTRL) register for details. Related Links 32.10.11. DBGCTRL 32.5.8 Register Access Protection Registers with write access can be write-protected optionally by the Peripheral Access Controller (PAC). PAC write protection is not available for the following registers:
Interrupt Flag Clear and Status register (INTFLAG) Status register (STATUS) Data register (DATA) Address register (ADDR) in Host mode Optional PAC write protection is denoted by the "PAC Write-Protection" property in each individual register description. Write-protection does not apply to accesses through an external debugger. 32.5.9 Analog Connections Not applicable. 32.6 Functional Description 32.6.1 Principle of Operation The I2C interface uses two physical lines for communication:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 631 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Serial Data Line (SDA) for data transfer Serial Clock Line (SCL) for the bus clock A transaction starts with the I2C host sending the Start condition, followed by a 7-bit address and a direction bit (read or write to/from the client). The addressed I2C client will then Acknowledge (ACK) the address, and data packet transactions can begin. Every 9-bit data packet consists of 8 data bits followed by a one-bit reply indicating whether the data was acknowledged or not. If a data packet is Not Acknowledged (NACK), whether by the I2C client or host, the I2C host takes action by either terminating the transaction by sending the Stop condition, or by sending a repeated start to transfer more data. The figure below illustrates the possible transaction formats and Transaction Diagram Symbols explains the transaction symbols. These symbols will be used in the following descriptions. Figure 32-2. Transaction Diagram Symbols Bus Driver Special Bus Conditions Host driving bus S START condition Client driving bus Sr repeated START condition Either Host or Client driving bus P STOP condition Data Package Direction Acknowledge Host Read Host Write R
'1'
W
'0'
Figure 32-3. Basic I2C Transaction Diagram Acknowledge (ACK) Not Acknowledge (NACK) A
'0'
A
'1'
SDA SCL 6..0 7..0 7..0 S ADDRESS R/W ACK DATA ACK DATA ACK/NACK P S ADDRESS R/W A DATA A DATA A/A P Direction Address Packet Data Packet #0 Data Packet #1 Transaction 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 632 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.6.2 Basic Operation 32.6.2.1 Initialization The following registers are enable-protected, meaning they can be written only when the I2C interface is disabled
(CTRLA.ENABLE is 0):
Control A register (CTRLA), except Enable (CTRLA.ENABLE) and Software Reset (CTRLA.SWRST) bits Control B register (CTRLB), except Acknowledge Action (CTRLB.ACKACT) and Command (CTRLB.CMD) bits Baud register (BAUD) Address register (ADDR) in client operation. When the I2C is enabled or is being enabled (CTRLA.ENABLE=1), writing to these registers will be discarded. If the I2C is being disabled, writing to these registers will be completed after the disabling. Enable-protection is denoted by the "Enable-Protection" property in the register description. Before the I2C is enabled it must be configured as outlined by the following steps:
1. 2. 3. 4. 5. Select I2C Host or Client mode by writing 0x4 (Client mode) or 0x5 (Host mode) to the Operating Mode bits in the CTRLA register (CTRLA.MODE). If desired, select the SDA Hold Time value in the CTRLA register (CTRLA.SDAHOLD). If desired, enable smart operation by setting the Smart Mode Enable bit in the CTRLB register
(CTRLB.SMEN). If desired, enable SCL low time-out by setting the SCL Low Time-Out bit in the Control A register
(CTRLA.LOWTOUT). In Host mode:
a. Select the inactive bus time-out in the Inactive Time-Out bit group in the CTRLA register
(CTRLA.INACTOUT). b. Write the Baud Rate register (BAUD) to generate the desired baud rate. In Client mode:
a. Configure the address match configuration by writing the Address Mode value in the CTRLB register b.
(CTRLB.AMODE). Set the Address and Address Mask value in the Address register (ADDR.ADDR and ADDR.ADDRMASK) according to the address configuration. 32.6.2.2 Enabling, Disabling, and Resetting This peripheral is enabled by writing '1' to the Enable bit in the Control A register (CTRLA.ENABLE), and disabled by writing '0' to it. Writing 1 to the Software Reset bit in the Control A register (CTRLA.SWRST) will reset all registers of this peripheral to their initial states, except the DBGCTRL register, and the peripheral is disabled. 32.6.2.3 I2C Bus State Logic The Bus state logic includes several logic blocks that continuously monitor the activity on the I2C bus lines in all Sleep modes with running GCLK_SERCOM_x clocks. The start and stop detectors and the bit counter are all essential in the process of determining the current Bus state. The Bus state is determined according to Bus State Diagram. Software can get the current Bus state by reading the Host Bus State bits in the Status register
(STATUS.BUSSTATE). The value of STATUS.BUSSTATE in the figure is shown in binary. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 633 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Figure 32-4. Bus State Diagram RESET UNKNOWN
(0b00) Timeout or Stop Condition Start Condition IDLE
(0b01) Timeout or Stop Condition BUSY
(0b11) Stop Condition Write ADDR to generate Start Condition Lost Arbitration OWNER
(0b10) R e p e a e d t t S a r t C o n d i t i o n Write ADDR to generate Repeated Start Condition The Bus state machine is active when the I2C host is enabled. After the I2C host has been enabled, the Bus state is UNKNOWN (0b00). From the UNKNOWN state, the bus will transition to IDLE (0b01) by either:
Forcing by writing 0b01 to STATUS.BUSSTATE A Stop condition is detected on the bus If the inactive bus time-out is configured for SMBus compatibility (CTRLA.INACTOUT) and a time-out occurs. Note:Once a known Bus state is established, the Bus state logic will not re-enter the UNKNOWN state. When the bus is IDLE it is ready for a new transaction. If a Start condition is issued on the bus by another I2C host in a multi-host setup, the bus becomes BUSY (0b11). The bus will re-enter IDLE either when a Stop condition is detected, or when a time-out occurs (inactive bus time-out needs to be configured). If a Start condition is generated internally by writing the Address bit group in the Address register (ADDR.ADDR) while IDLE, the OWNER state (0b10) is entered. If the complete transaction was performed without interference, i.e., arbitration was not lost, the I2C host can issue a Stop condition, which will change the Bus state back to IDLE. However, if a packet collision is detected while in OWNER state, the arbitration is assumed lost and the Bus state becomes BUSY until a Stop condition is detected. A repeated Start condition will change the Bus state only if arbitration is lost while issuing a repeated start. Note:Violating the protocol may cause the I2C to hang. If this happens it is possible to recover from this state by a software Reset (CTRLA.SWRST='1'). 32.6.2.4 I2C Host Operation The I2C host is byte-oriented and interrupt based. The number of interrupts generated is kept at a minimum by automatic handling of most incidents. The software driver complexity and code size are reduced by auto-triggering of operations, and a Special Smart mode, which can be enabled by the Smart Mode Enable bit in the Control A register
(CTRLA.SMEN). The I2C host has two interrupt strategies. When SCL Stretch Mode (CTRLA.SCLSM) is '0', SCL is stretched before or after the Acknowledge bit . In this mode the I2C host operates according to I2C Host Behavioral Diagram (SCLSM=0) as shown in the following figure. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 634 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... The circles labeled "Mn" (M1, M2..) indicate the nodes the bus logic can jump to, based on software or hardware interaction. This diagram is used as reference for the description of the I2C host operation throughout the document. Figure 32-5. I2C Host Behavioral Diagram (SCLSM=0) APPLICATION HOST BUS INTERRUPT + SCL HOLD M1 M2 M3 M4 BUSY P IDLE S ADDRESS R/W BUSY SW BUSY SW Wait for IDLE R/W A W A SW SW SW P IDLE Sr M1 M2 M3 BUSY M4 DATA A/A CLIENT BUS INTERRUPT + SCL HOLD SW Software interaction SW A BUSY The host provides data on the bus A/A P IDLE Addressed client provides data on the bus A/A Sr A/A M4 M2 M3 In the second strategy (CTRLA.SCLSM=1), interrupts only occur after the ACK bit, as in Host Behavioral Diagram
(SCLSM=1) shown in the following figure. This strategy can be used when it is not necessary to check DATA before acknowledging. R A DATA 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 635 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Figure 32-6. I2C Host Behavioral Diagram (SCLSM=1) APPLICATION Host Bus INTERRUPT + SCL HOLD M1 M2 M3 M4 BUSY P IDLE S ADDRESS R/W BUSY SW BUSY SW Wait for IDLE R/W A W A SW SW SW P IDLE Sr M1 M2 M3 BUSY M4 DATA A/A SW Software interaction The host provides data on the bus Addressed client provides data on the bus Client Bus INTERRUPT + SCL HOLD SW BUSY P IDLE Sr M4 M2 M3 R A DATA A/A 32.6.2.4.1 Host Clock Generation The SERCOM peripheral supports several I2C bidirectional modes:
Standard mode (Sm) up to 100 kHz Fast mode (Fm) up to 400 kHz Fast mode Plus (Fm+) up to 1 MHz The Host clock configuration for Sm, Fm and Fm+ are described in Clock Generation (Standard-Mode, Fast-Mode and Fast-Mode Plus) as follows. Clock Generation (Standard-Mode, Fast-Mode, and Fast-Mode Plus) In I2C Sm, Fm, and Fm+ mode, the Host clock (SCL) frequency is determined as described in this section:
The low (TLOW) and high (THIGH) times are determined by the Baud Rate register (BAUD), while the rise (TRISE) and fall (TFALL) times are determined by the bus topology. Because of the wired-AND logic of the bus, TFALL will be considered as part of TLOW. Likewise, TRISE will be in a state between TLOW and THIGH until a high state has been detected. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 636 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Figure 32-7. SCL Timing P S TLOW Sr TRISE SCL SDA TBUF THIGH TFALL TSU;STO THD;STA TSU;STA The following parameters are timed using the SCL low time period TLOW. This comes from the Host Baud Rate Low bit group in the Baud Rate register (BAUD.BAUDLOW). When BAUD.BAUDLOW=0, or the Host Baud Rate bit group in the Baud Rate register (BAUD.BAUD) determines it. TLOW Low period of SCL clock TSU;STO Set-up time for stop condition TBUF Bus free time between stop and start conditions THD;STA Hold time (repeated) start condition TSU;STA Set-up time for repeated start condition THIGH is timed using the SCL high time count from BAUD.BAUD TRISE is determined by the bus impedance; for internal pull-ups. TFALL is determined by the open-drain current limit and bus impedance; can typically be regarded as zero. The SCL frequency is given by:
1 TLOW + THIGH + TRISE fSCL =
When BAUD.BAUDLOW is zero, the BAUD.BAUD value is used to time both SCL high and SCL low. In this case the following formula will give the SCL frequency:
fSCL =
When BAUD.BAUDLOW is non-zero, the following formula determines the SCL frequency:
fGCLK 10 + 2BAUD + fGCLK TRISE fSCL =
The following formulas can determine the SCL TLOW and THIGH times:
fGCLK 10 + BAUD + BAUDLOW + fGCLK TRISE TLOW =
BAUDLOW + 5 fGCLK BAUD + 5 fGCLK THIGH =
Note:The I2C standard Fm+ (Fast-mode plus) requires a nominal high to low SCL ratio of 1:2, and BAUD must be set accordingly. At a minimum, BAUD.BAUD and/or BAUD.BAUDLOW must be non-zero. Start-up Timing: The minimum time between SDA transition and SCL rising edge is 6 APB cycles when the DATA register is written in smart mode. If a greater start-up time is required due to long rise times, the time between DATA write and IF clear must be controlled by software. Note:When timing is controlled by user, the Smart Mode cannot be enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 637 32.6.2.4.2 Transmitting Address Packets PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... The I2C host starts a bus transaction by writing the I2C client address to ADDR.ADDR and the direction bit, as described in Principle of Operation, see Principle of Operation from Related Links. If the bus is busy, the I2C host will wait until the bus becomes idle before continuing the operation. When the bus is idle, the I2C host will issue a start condition on the bus. The I2C host will then transmit an address packet using the address written to ADDR.ADDR. After the address packet has been transmitted by the I2C host, one of four cases will arise according to arbitration and transfer direction. Case 1: Arbitration lost or bus error during address packet transmission If arbitration was lost during transmission of the address packet, the Host on Bus bit in the Interrupt Flag Status and Clear register (INTFLAG.MB) and the Arbitration Lost bit in the Status register (STATUS.ARBLOST) are both set. Serial data output to SDA is disabled, and the SCL is released, which disables clock stretching. In effect the I2C host is no longer allowed to execute any operation on the bus until the bus is idle again. A bus error will behave similarly to the Arbitration Lost condition. In this case, the MB Interrupt flag and Host Bus Error bit in the Status register
(STATUS.BUSERR) are both set in addition to STATUS.ARBLOST. The Host Received Not Acknowledge bit in the Status register (STATUS.RXNACK) will always contain the last successfully received acknowledge or not acknowledge indication. In this case, software will typically inform the application code of the condition and then clear the Interrupt flag before exiting the interrupt routine. No other flags have to be cleared at this moment, because all flags will be cleared automatically the next time the ADDR.ADDR register is written. Case 2: Address packet transmit complete No ACK received If there is no I2C client device responding to the address packet, then the INTFLAG.MB Interrupt flag and STATUS.RXNACK will be set. The clock hold is active at this point, preventing further activity on the bus. The missing ACK response can indicate that the I2C client is busy with other tasks or sleeping. Therefore, it is not able to respond. In this event, the next step can be either issuing a Stop condition (recommended) or resending the address packet by a repeated Start condition. When using SMBus logic, the client must ACK the address. If there is no response, it means that the client is not available on the bus. Case 3: Address packet transmit complete Write packet, Host on Bus set If the I2C host receives an acknowledge response from the I2C client, INTFLAG.MB will be set and STATUS.RXNACK will be cleared. The clock hold is active at this point, preventing further activity on the bus. In this case, the software implementation becomes highly protocol dependent. Three possible actions can enable the I2C operation to continue:
Initiate a data transmit operation by writing the data byte to be transmitted into DATA.DATA. Transmit a new address packet by writing ADDR.ADDR. A repeated Start condition will automatically be inserted before the address packet. Issue a Stop condition, consequently terminating the transaction. Case 4: Address packet transmit complete Read packet, Client on Bus set If the I2C host receives an ACK from the I2C client, the I2C host proceeds to receive the next byte of data from the I2C client. When the first data byte is received, the Client on Bus bit in the Interrupt Flag register (INTFLAG.SB) will be set and STATUS.RXNACK will be cleared. The clock hold is active at this point, preventing further activity on the bus. In this case, the software implementation becomes highly protocol dependent. Three possible actions can enable the I2C operation to continue:
Let the I2C host continue to read data by acknowledging the data received. ACK can be sent by software, or automatically in Smart mode. Transmit a new address packet. Terminate the transaction by issuing a Stop condition. Note:An ACK or NACK will be automatically transmitted if Smart mode is enabled. The Acknowledge Action bit in the Control B register (CTRLB.ACKACT) determines whether ACK or NACK must be sent. Related Links 32.6.1. Principle of Operation 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 638 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.6.2.4.3 Transmitting Data Packets When an address packet with direction Host Write (see Figure 32-3) was transmitted successfully , INTFLAG.MB will be set. The I2C host will start transmitting data via the I2C bus by writing to DATA.DATA, and monitor continuously for packet collisions. If a collision is detected, the I2C host will lose arbitration and STATUS.ARBLOST will be set. If the transmit was successful, the I2C host will receive an ACK bit from the I2C client, and STATUS.RXNACK will be cleared. INTFLAG.MB will be set in both cases, regardless of arbitration outcome. It is recommended to read STATUS.ARBLOST and handle the arbitration lost condition in the beginning of the I2C Host on Bus interrupt. This can be done as there is no difference between handling address and data packet arbitration. STATUS.RXNACK must be checked for each data packet transmitted before the next data packet transmission can commence. The I2C host is not allowed to continue transmitting data packets if a NACK is received from the I2C client. 32.6.2.4.4 Receiving Data Packets (SCLSM=0) When INTFLAG.SB is set, the I2C host will already have received one data packet. The I2C host must respond by sending either an ACK or NACK. Sending a NACK may be unsuccessful when arbitration is lost during the transmission. In this case, a lost arbitration will prevent setting INTFLAG.SB. Instead, INTFLAG.MB will indicate a change in arbitration. Handling of lost arbitration is the same as for data bit transmission. 32.6.2.4.5 Receiving Data Packets (SCLSM=1) When INTFLAG.SB is set, the I2C host will already have received one data packet and transmitted an ACK or NACK, depending on CTRLB.ACKACT. At this point, CTRLB.ACKACT must be set to the correct value for the next ACK bit, and the transaction can continue by reading DATA and issuing a command if not in the Smart mode. 32.6.2.4.6 10-Bit Addressing When 10-bit addressing is enabled by the Ten Bit Addressing Enable bit in the Address register
(ADDR.TENBITEN=1) and the Address bit field ADDR.ADDR is written, the two address bytes will be transmitted, see 10-bit Address Transmission for a Read Transaction. The addressed client acknowledges the two address bytes, and the transaction continues. Regardless of whether the transaction is a read or write, the host must start by sending the 10-bit address with the direction bit (ADDR.ADDR[0]) being zero. If the host receives a NACK after the first byte, the Write Interrupt flag will be raised and the STATUS.RXNACK bit will be set. If the first byte is acknowledged by one or more clients, then the host will proceed to transmit the second address byte and the host will first see the Write Interrupt flag after the second byte is transmitted. If the transaction direction is read-from-client, the 10-bit address transmission must be followed by a repeated start and the first 7 bits of the address with the read/write bit equal to '1'. Figure 32-8. 10-bit Address Transmission for a Read Transaction MB INTERRUPT S 11110 addr[9:8]
AW addr[7:0]
A This implies the following procedure for a 10-bit read operation:
S W Sr 11110 addr[9:8]
1 R A 1. Write the 10-bit address to ADDR.ADDR[10:1]. ADDR.TENBITEN must be '1', the direction bit
(ADDR.ADDR[0]) must be '0' (can be written simultaneously with ADDR). 2. Once the Host on Bus interrupt is asserted, Write ADDR[7:0] register to '11110 address[9:8] 1'. ADDR.TENBITEN must be cleared (can be written simultaneously with ADDR). Proceed to transmit data. 3. 32.6.2.5 I2C Client Operation The I2C client is byte-oriented and interrupt-based. The number of interrupts generated is kept at a minimum by automatic handling of most events. The software driver complexity and code size are reduced by auto-triggering of operations, and a special smart mode, which can be enabled by the Smart Mode Enable bit in the Control A register
(CTRLA.SMEN). The I2C client has two interrupt strategies. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 639 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... When SCL Stretch Mode bit (CTRLA.SCLSM) is '0', SCL is stretched before or after the acknowledge bit. In this mode, the I2C client operates according to I2C Client Behavioral Diagram (SCLSM=0) as shown in the following figure. The circles labelled "Sn" (S1, S2..) indicate the nodes the bus logic can jump to, based on software or hardware interaction. This diagram is used as reference for the description of the I2C client operation throughout the document. Figure 32-9. I2C Client Behavioral Diagram (SCLSM=0) AMATCH INTERRUPT DRDY INTERRUPT S1 S1 A A A A S W S W P Sr S2 S3 DATA P Sr S2 S3 DATA A/A S W S W A/A S1 S2 S3 S ADDRESS R PREC INTERRUPT W Interrupt on STOP Condition Enabled S W S W Software interaction The host provides data on the bus Addressed client provides data on the bus In the second strategy (CTRLA.SCLSM=1), interrupts only occur after the ACK bit is sent as shown in the following figure I2C Client Behavioral Diagram (SCLSM=1). This strategy can be used when it is not necessary to check DATA before acknowledging. For host reads, an address and data interrupt will be issued simultaneously after the address acknowledge. However, for host writes, the first data interrupt will be seen after the first data byte has been received by the client and the acknowledge bit has been sent to the host. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 640 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Figure 32-10. I2C Client Behavioral Diagram (SCLSM=1) AMATCH INTERRUPT (+ DRDY INTERRUPT in Host Read mode) DRDY INTERRUPT P Sr S2 S3 DATA A/A S W S W P Sr S2 S3 DATA A/A S W S1 S2 S3 S ADDRESS R A/A PREC INTERRUPT W A/A Interrupt on STOP Condition Enabled S W S W Software interaction The host provides data on the bus Addressed client provides data on the bus 32.6.2.5.1 Receiving Address Packets (SCLSM=0) When CTRLA.SCLSM=0, the I2C client stretches the SCL line according to Figure 32-9. When the I2C client is properly configured, it will wait for a Start condition. When a Start condition is detected, the successive address packet will be received and checked by the address match logic. If the received address is not a match, the packet will be rejected, and the I2C client will wait for a new Start condition. If the received address is a match, the Address Match bit in the Interrupt Flag register
(INTFLAG.AMATCH) will be set. SCL will be stretched until the I2C client clears INTFLAG.AMATCH. As the I2C client holds the clock by forcing SCL low, the software has unlimited time to respond. The direction of a transaction is determined by reading the Read/Write Direction bit in the Status register
(STATUS.DIR). This bit will be updated only when a valid address packet is received. If the Transmit Collision bit in the Status register (STATUS.COLL) is set, this indicates that the last packet addressed to the I2C client had a packet collision. A collision causes the SDA and SCL lines to be released without any notification to software. Therefore, the next AMATCH interrupt is the first indication of the previous packets collision. Collisions are intended to follow the SMBus Address Resolution Protocol (ARP). After the address packet has been received from the I2C host, one of two cases will arise based on transfer direction. Case 1: Address packet accepted Read flag set The STATUS.DIR bit is 1, indicating an I2C host read operation. The SCL line is forced low, stretching the bus clock. If an ACK is sent, I2C client hardware will set the Data Ready bit in the Interrupt Flag register (INTFLAG.DRDY), indicating data are needed for transmit. If a NACK is sent, the I2C client will wait for a new Start condition and address match. Typically, software will immediately acknowledge the address packet by sending an ACK/NACK bit. The I2C client Command bit field in the Control B register (CTRLB.CMD) can be written to '0x3' for both read and write operations as the command execution is dependent on the STATUS.DIR bit. Writing 1 to INTFLAG.AMATCH will also cause an ACK/NACK to be sent corresponding to the CTRLB.ACKACT bit. Case 2: Address packet accepted Write flag set The STATUS.DIR bit is cleared, indicating an I2C host write operation. The SCL line is forced low, stretching the bus clock. If an ACK is sent, the I2C client will wait for data to be received. Data, repeated start or stop can be received. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 641 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... If a NACK is sent, the I2C client will wait for a new Start condition and address match. Typically, software will immediately acknowledge the address packet by sending an ACK/NACK. The I2C client command CTRLB.CMD = 3 can be used for both read and write operation as the command execution is dependent on STATUS.DIR. Writing 1 to INTFLAG.AMATCH will also cause an ACK/NACK to be sent corresponding to the CTRLB.ACKACT bit. 32.6.2.5.2 Receiving Address Packets (SCLSM=1) When SCLSM=1, the I2C client will stretch the SCL line only after an ACK (see Figure 32-10). When the I2C client is properly configured, it will wait for a Start condition to be detected. When a Start condition is detected, the successive address packet will be received and checked by the address match logic. If the received address is not a match, the packet will be rejected and the I2C client will wait for a new Start condition. If the address matches, the acknowledge action as configured by the Acknowledge Action bit Control B register
(CTRLB.ACKACT) will be sent and the Address Match bit in the Interrupt Flag register (INTFLAG.AMATCH) is set. SCL will be stretched until the I2C client clears INTFLAG.AMATCH. As the I2C client holds the clock by forcing SCL low, the software is given unlimited time to respond to the address. The direction of a transaction is determined by reading the Read/Write Direction bit in the Status register
(STATUS.DIR). This bit will be updated only when a valid address packet is received. If the Transmit Collision bit in the Status register (STATUS.COLL) is set, the last packet addressed to the I2C client had a packet collision. A collision causes the SDA and SCL lines to be released without any notification to software. The next AMATCH interrupt is, therefore, the first indication of the previous packets collision. Collisions are intended to follow the SMBus Address Resolution Protocol (ARP). After the address packet has been received from the I2C host, INTFLAG.AMATCH can be set to 1 to clear it. 32.6.2.5.3 Receiving and Transmitting Data Packets After the I2C client has received an address packet, it will respond according to the direction either by waiting for the data packet to be received or by starting to send a data packet by writing to DATA.DATA. When a data packet is received or sent, INTFLAG.DRDY will be set. After receiving data, the I2C client will send an acknowledge according to CTRLB.ACKACT. Case 1: Data received INTFLAG.DRDY is set, and SCL is held low, pending for SW interaction. Case 2: Data sent When a byte transmission is successfully completed, the INTFLAG.DRDY Interrupt flag is set. If NACK is received, indicated by STATUS.RXNACK=1, the I2C client must expect a stop or a repeated start to be received. The I2C client must release the data line to allow the I2C host to generate a stop or repeated start. Upon detecting a Stop condition, the Stop Received bit in the Interrupt Flag register (INTFLAG.PREC) will be set and the I2C client will return to IDLE state. 32.6.2.5.4 PMBus Group Command When the PMBus Group Command bit in the CTRLB register is set (CTRLB.GCMD=1) and 7-bit addressing is used, INTFLAG.PREC will be set if the client has been addressed since the last STOP condition. When CTRLB.GCMD=0, a STOP condition without address match will not set INTFLAG.PREC. The group command protocol is used to send commands to more than one device. The commands are sent in one continuous transmission with a single STOP condition at the end. When the STOP condition is detected by the clients addressed during the group command, they all begin executing the command they received. The following figure shows an example where this client, bearing ADDRESS 1, is addressed after a repeated START condition. There can be multiple clients addressed before and after this client. Eventually, at the end of the group command, a single STOP is generated by the host. At this point a STOP interrupt is asserted. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 642 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Figure 32-11. PMBus Group Command Example S ADDRESS 0 W A n Bytes A Command/Data AMATCH INTERRUPT DRDY INTERRUPT Command/Data Sr ADDRESS 1
(this client) W S W A n Bytes S W A Command/Data PREC INTERRUPT Sr ADDRESS 2 W A n Bytes A P S W 32.6.3 Additional Features 32.6.3.1 SMBus The I2C includes three hardware SCL low time-outs which allow a time-out to occur for SMBus SCL low time-out, host extend time-out, and client extend time-out. This allows for SMBus functionality These time-outs are driven by the GCLK_SERCOM_SLOW clock. The GCLK_SERCOM_SLOW clock is used to accurately time the time-out and must be configured to use a 32.768 kHz oscillator. The I2C interface also allows for a SMBus compatible SDA hold time. TTIMEOUT: SCL low time of 25..35ms Measured for a single SCL low period. It is enabled by CTRLA.LOWTOUTEN TLOW:SEXT: Cumulative clock low extend time of 25 ms Measured as the cumulative SCL low extend time by a client device in a single message from the initial START to the STOP. It is enabled by CTRLA.SEXTTOEN. TLOW:MEXT: Cumulative clock low extend time of 10 ms Measured as the cumulative SCL low extend time by the host device within a single byte from START-to-ACK, ACK-to-ACK, or ACK-to-STOP. It is enabled by CTRLA.MEXTTOEN. 32.6.3.2 Smart Mode The I2C interface has a Smart mode that simplifies application code and minimizes the user interaction needed to adhere to the I2C protocol. The Smart mode accomplishes this by automatically issuing an ACK or NACK (based on the content of CTRLB.ACKACT) as soon as DATA.DATA is read. 32.6.3.3 4-Wire Mode Writing a '1' to the Pin Usage bit in the Control A register (CTRLA.PINOUT) will enable 4-Wire mode operation. In this mode, the internal I2C tri-state drivers are bypassed, and an external I2C compliant tri-state driver is needed when connecting to an I2C bus. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 643 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Figure 32-12. I2C Pad Interface SCL_OUT/
SDA_OUT SCL_IN/
SDA_IN PINOUT I2C Driver PINOUT SCL_OUT/
SDA_OUT pad SCL/SDA pad 32.6.3.4 Quick Command Setting the Quick Command Enable bit in the Control B register (CTRLB.QCEN) enables quick command. When quick command is enabled, the corresponding Interrupt flag (INTFLAG.SB or INTFLAG.MB) is set immediately after the client acknowledges the address. At this point, the software can either issue a Stop command or a repeated start by writing CTRLB.CMD or ADDR.ADDR. 32.6.3.5 32-bit Extension For better system bus utilization, 32-bit data receive and transmit can be enabled by writing to the Data 32-bit bit field in the Control C register (CTRLC.DATA32B=1). When enabled, write and read transaction to/from the DATA register are 32 bit in size. If frames are not multiples of 4 Bytes, the Length Counter (LENGTH.LEN) and Length Enable (LENGTH.LENEN) must be configured before data transfer begins. LENGTH.LEN must be enabled only when CTRLC.DATA32B is enabled. The following figure shows the order of transmit and receive when using 32-bit mode. Bytes are transmitted or received and stored in order from 0 to 3. Figure 32-13. 32-bit Extension Byte Ordering APB Write/Read BYTE3 BYTE2 BYTE1 BYTE0 Bit Position 31 0 32-bit Extension Client Operation The following figure shows a transaction with 32-bit Extension enabled (CTRLC.DATA32B=1). In client operation, the Address Match interrupt in the Interrupt Flag Status and Clear register (INTFLAG.AMATCH) is set after the address is received and available in the DATA register. The Data Ready interrupt (INTFLAG.DRDY) will then be raised for every 4 Bytes transferred. Figure 32-14. 32-bit Extension Client Operation CLIENT ADDRESS INTERRUPT S ADDRESS W S W A Byte 0 A Byte 1 A Byte 2 A Byte 3 CLIENT DATA INTERRUPT S W The LENGTH register can be written before the frame begins, or when the AMATCH interrupt is set. If the frame size is not LENGTH.LEN Bytes, the Length Error status bit (STATUS.LENERR) is raised. If LENGTH.LEN is not a multiple of 4 Bytes, the final INTFLAG.DRDY interrupt is raised when the last Byte is received for host reads. For host writes, the last data byte will be automatically NACKed. On address recognition, the internal length counter is reset in preparation for the incoming frame. High Speed transactions start with a Full Speed Host Code. When a Host Code is detected, no data is received and the next expected operation is a repeated start. For this reason, the length is not counted after a Host Code is received. In this case, no Length Error (STATUS.LENERR) is registered, regardless of the LENGTH.LENEN setting. When SCL clock stretch mode is selected (CTRLA.SCLSM=1) and the transaction is a host write, the selected Acknowledge Action (CTRLB.ACKACT) will only be used to ACK/NACK each 4th byte. All other bytes are ACKed. This allows the user to write CTRLB.ACKACT=1 in the final interrupt, so that the last byte in a 32-bit word will be NACKed. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 644 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Writing to the LENGTH register while a frame is in progress will produce unpredictable results. If LENGTH.LENEN is not set and a frame is not a multiple of 4 Bytes, the remainder will be lost. 32-bit Extension Host Operation When using the I2C configured as Host, the Address register must be written with the desired address
(ADDR.ADDR), and optionally, the transaction Length and transaction Length Enable bits (ADDR.LEN and ADDR.LENEN) can be written. When ADDR.LENEN is written to '1' along with ADDR.ADDR, ADDR.LEN determines the number of data bytes in the transaction from 0 to 255. Then, the ADDR.LEN bytes are transferred, followed by an automatically generated NACK (for host reads) and a STOP. The INTFLAG.SB or INTFLAG.MB are raised for every 4 Bytes transferred. If the transaction is a host read and ADDR.LEN is not a multiple of 4 Bytes, the final INTFLAG.SB is set when the last byte is received. When SCL clock stretch mode is enabled (CTRLA.SCLSM=1) and the transaction is a host read, the selected Acknowledge Action (CTRLB.ACKACT) will only be used to ACK/NACK each 4th Byte. All other bytes are ACKed. This allows the user to set CTRLB.ACKACT=1 in the final interrupt, so that the last byte in a 32-bit word will be NACKed. If a NACK is received by the client for a host write transaction before ADDR.LEN bytes, a STOP will be automatically generated, and the length error (STATUS.LENERR) is raised along with the INTFLAG.ERROR interrupt. 32.6.4 DMA, Interrupts and Events Each interrupt source has its own Interrupt flag. The Interrupt flag in the Interrupt Flag Status and Clear register
(INTFLAG) will be set when the Interrupt condition is meet. Each interrupt can be individually enabled by writing 1 to the corresponding bit in the Interrupt Enable Set register (INTENSET), and disabled by writing 1 to the corresponding bit in the Interrupt Enable Clear register (INTENCLR). An interrupt request is generated when the Interrupt flag is set and the corresponding interrupt is enabled. The interrupt request is active until the Interrupt flag is cleared, the interrupt is disabled or the I2C is reset. See the INTFLAG (Client) or INTFLAG (Host) register for details on how to clear Interrupt flags. Table 32-1. Module Request for SERCOM I2C Client Condition Data needed for transmit (TX) (Client Transmit mode) Data received (RX) (Client Receive mode) Request DMA Yes
(request cleared when data is written) Yes
(request cleared when data is read) Data Ready (DRDY) Address Match (AMATCH) Stop received (PREC) Error (ERROR) Interrupt Yes Yes Yes Yes Event NA 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 645 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Table 32-2. Module Request for SERCOM I2C Host Condition Data needed for transmit (TX) (Host Transmit mode) Data needed for transmit (RX) (Host Transmit mode) Host on Bus (MB) Stop received (SB) Error (ERROR) 32.6.4.1 DMA Operation Request DMA Yes
(request cleared when data is written) Yes
(request cleared when data is read) Interrupt Yes Yes Yes Event NA Smart mode must be enabled for DMA operation in the Control B register by writing CTRLB.SMEN=1. 32.6.4.1.1 Client DMA When using the I2C client with DMA, an address match will cause the address Interrupt flag
(INTFLAG.ADDRMATCH) to be raised. After the interrupt has been serviced, data transfer will be performed through DMA. The I2C client generates the following requests:
32.6.4.1.2 Host DMA When using the I2C host with DMA, the ADDR register must be written with the desired address (ADDR.ADDR), transaction length (ADDR.LEN), and transaction length enable (ADDR.LENEN). When ADDR.LENEN is written to 1 along with ADDR.ADDR, ADDR.LEN determines the number of data bytes in the transaction from 0 to 255. DMA is then used to transfer ADDR.LEN bytes followed by an automatically generated NACK (for host reads) and a STOP. If a NACK is received by the client for a host write transaction before ADDR.LEN bytes, a STOP will be automatically generated and the length error (STATUS.LENERR) will be raised along with the INTFLAG.ERROR interrupt. The I2C host generates the following requests:
32.6.4.2 Interrupts The I2C client has the following interrupt sources. These are asynchronous interrupts. They can wake-up the device from any Sleep mode:
Error (ERROR) Data Ready (DRDY) Address Match (AMATCH) Stop Received (PREC) The I2C host has the following interrupt sources. These are asynchronous interrupts. They can wake-up the device from any Sleep mode:
Error (ERROR) Client on Bus (SB) Host on Bus (MB) Each interrupt source has its own Interrupt flag. The Interrupt flag in the Interrupt Flag Status and Clear register
(INTFLAG) will be set when the Interrupt condition is met. Each interrupt can be individually enabled by writing 1 to the corresponding bit in the Interrupt Enable Set register (INTENSET), and disabled by writing 1 to the corresponding bit in the Interrupt Enable Clear register (INTENCLR). The status of enabled interrupts can be read from either INTENSET or INTENCLR. An interrupt request is generated when the Interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 646 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Interrupt flag is cleared, the interrupt is disabled or the I2C is reset. For details on how to clear Interrupt flags, see INTFLAG register from Related Links. The value of INTFLAG indicates which interrupt is executed. Note that interrupts must be globally enabled for interrupt requests. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 32.10.6. INTFLAG 32.6.4.3 Events Not applicable. 32.6.5 Sleep Mode Operation I2C Host Operation The generic clock (GCLK_SERCOMx_CORE) will continue to run in idle sleep mode. If the Run In Standby bit in the Control A register (CTRLA.RUNSTDBY) is '1', the GLK_SERCOMx_CORE will also run in Standby Sleep mode. Any interrupt can wake-up the device. If CTRLA.RUNSTDBY=0, the GLK_SERCOMx_CORE will be disabled after any ongoing transaction is finished. Any interrupt can wake-up the device. I2C Client Operation Writing CTRLA.RUNSTDBY=1 will allow the Address Match interrupt to wake-up the device. When CTRLA.RUNSTDBY=0, all receptions will be dropped. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 647 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.7 Register Summary - I2C Client Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CTRLA 0x04 CTRLB 0x08 CTRLC 0x0C
... 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1A Reserved INTENCLR Reserved INTENSET Reserved INTFLAG Reserved STATUS 0x1C SYNCBUSY 0x20
... 0x23 Reserved 0x24 ADDR 0x28 DATA 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 RUNSTDBY MODE[2:0]
ENABLE SWRST SEXTTOEN SDAHOLD[1:0]
LOWTOUT SCLSM PINOUT SPEED[1:0]
AMODE[1:0]
AACKEN ACKACT GCMD SMEN CMD[1:0]
ERROR ERROR ERROR DATA32B DRDY AMATCH PREC DRDY AMATCH PREC DRDY AMATCH PREC CLKHOLD LOWTOUT SR DIR RXNACK COLL BUSERR LENERR SEXTTOUT ENABLE SWRST ADDR[6:0]
ADDRMASK[6:0]
DATA[7:0]
DATA[15:8]
DATA[23:16]
DATA[31:24]
GENCEN ADDR[9:7]
ADDRMASK[9:7]
32.8 Register Description - I2C Client Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description. Some registers are synchronized when read and/or written. Synchronization is denoted by the Write-Synchronized or the Read-Synchronized property in each individual register description. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable-
protection is denoted by the Enable-Protected property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 648 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.8.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized CTRLA 0x00 0x00000000 Bit 31 Access Reset 30 LOWTOUT R/W 0 29 28 26 27 SCLSM R/W 0 Bit 23 22 21 20 19 18 SEXTTOEN Access Reset R/W 0 Bit 15 14 Access Reset Bit 7 6 5 RUNSTDBY Access Reset R/W 0 Bit 30 LOWTOUTSCL Low Time-Out SDAHOLD[1:0]
R/W 0 13 R/W 0 12 4 R/W 0 25 R/W 0 17 SPEED[1:0]
24 R/W 0 16 PINOUT R/W 0 11 10 9 8 3 MODE[2:0]
R/W 0 2 R/W 0 1 ENABLE R/W 0 0 SWRST R/W 0 This bit enables the SCL low time-out. If SCL is held low for 25 ms-35 ms, the client will release its clock hold, if enabled, and reset the internal state machine. Any interrupt flags set at the time of time-out will remain set. This bit is not synchronized. Value 0 1 Description Time-out disabled. Time-out enabled. Bit 27 SCLSMSCL Clock Stretch Mode This bit controls when SCL will be stretched for software interaction. This bit is not synchronized. Value 0 1 Description SCL stretch according to Figure 32-9 SCL stretch only after ACK bit according to Figure 32-10 Bits 25:24 SPEED[1:0]Transfer Speed These bits define bus speed. These bits are not synchronized. Value 0x0 0x1 0x2 0x3 Description Standard-mode (Sm) up to 100 kHz and Fast-mode (Fm) up to 400 kHz Fast-mode Plus (Fm+) up to 1 MHz Reserved Reserved Bit 23 SEXTTOENClient SCL Low Extend Time-Out This bit enables the client SCL low extend time-out. If SCL is cumulatively held low for greater than 25 ms from the initial START to a STOP, the client will release its clock hold if enabled and reset the internal state machine. Any interrupt flags set at the time of time-out will remain set. If the address was recognized, PREC will be set when a STOP is received. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 649 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... This bit is not synchronized. Value 0 1 Description Time-out disabled Time-out enabled Bits 21:20 SDAHOLD[1:0]SDA Hold Time These bits define the SDA hold time with respect to the negative edge of SCL. These bits are not synchronized. Name Value DIS 0x0 75 0x1 450 0x2 600 0x3 Description Disabled 50-100ns hold time 300-600ns hold time 400-800ns hold time Bit 16 PINOUTPin Usage This bit sets the pin usage to either two- or four-wire operation:
This bit is not synchronized. Value 0 1 Description 4-wire operation disabled 4-wire operation enabled Bit 7 RUNSTDBYRun in Standby This bit defines the functionality in standby sleep mode. This bit is not synchronized. Value 0 1 Description Disabled All reception is dropped. Wake on address match, if enabled. Bits 4:2 MODE[2:0]Operating Mode These bits must be written to 0x04 to select the I2C client serial communication interface of the SERCOM. These bits are not synchronized. Bit 1 ENABLEEnable Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRL.ENABLE will read back immediately and the Enable Synchronization Busy bit in the Synchronization Busy register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete. This bit is not enable-protected. Value 0 1 Description The peripheral is disabled or being disabled. The peripheral is enabled. Bit 0 SWRSTSoftware Reset Writing 0 to this bit has no effect. Writing 1 to this bit resets all registers in the SERCOM, except DBGCTRL, to their initial state, and the SERCOM will be disabled. Writing 1 to CTRLA.SWRST will always take precedence, meaning that all other writes in the same write-operation will be discarded. Any register write access during the ongoing reset will result in an APB error. Reading any register will return the reset value of the register. Due to synchronization, there is a delay from writing CTRLA.SWRST until the reset is complete. CTRLA.SWRST and SYNCBUSY.SWRST will both be cleared when the reset is complete. This bit is not enable-protected. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description There is no reset operation ongoing. The reset operation is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 650 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.8.2 Control B Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected CTRLB 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 Access Reset Bit 15 14 13 12 11 AMODE[1:0]
CMD[1:0]
18 ACKACT R/W 0 10 AACKEN R/W 0 17 W 0 9 GCMD R/W 0 16 W 0 8 SMEN R/W 0 5 4 3 2 1 0 Access Reset R/W 0 Bit 7 Access Reset R/W 0 6 Bit 18 ACKACTAcknowledge Action This bit defines the client's acknowledge behavior after an address or data byte is received from the host. The acknowledge action is executed when a command is written to the CMD bits. If smart mode is enabled
(CTRLB.SMEN=1), the acknowledge action is performed when the DATA register is read. ACKACT shall not be updated more than once between each peripheral interrupts request. This bit is not enable-protected. Value 0 1 Description Send ACK Send NACK Bits 17:16 CMD[1:0]Command This bit field triggers the client operation as the below. The CMD bits are strobe bits, and always read as zero. The operation is dependent on the client interrupt flags, INTFLAG.DRDY and INTFLAG.AMATCH, in addition to STATUS.DIR. All interrupt flags (INTFLAG.DRDY, INTFLAG.AMATCH and INTFLAG.PREC) are automatically cleared when a command is given. This bit is not enable-protected. Table 32-3. Command Description CMD[1:0] DIR Action 0x0 0x1 0x2
(No action)
(Reserved) X X Used to complete a transaction in response to a data interrupt (DRDY) 0 (Host write) Execute acknowledge action succeeded by waiting for any start (S/Sr) condition 1 (Host read) Wait for any start (S/Sr) condition 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 651 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... ..........continued CMD[1:0] DIR Action 0x3 Used in response to an address interrupt (AMATCH) 0 (Host write) Execute acknowledge action succeeded by reception of next byte 1 (Host read) Used in response to a data interrupt (DRDY) 0 (Host write) Execute acknowledge action succeeded by reception of next byte 1 (Host read) Execute a byte read operation followed by ACK/NACK reception Execute acknowledge action succeeded by client data interrupt Bits 15:14 AMODE[1:0]Address Mode These bits set the addressing mode. Value 0x0 Name MASK Description The client responds to the address written in ADDR.ADDR masked by the value in ADDR.ADDRMASK. 0x1 0x2 0x3 2_ADDRS The client responds to the two unique addresses in ADDR.ADDR and ADDR.ADDRMASK. RANGE The client responds to the range of addresses between and including ADDR.ADDR and ADDR.ADDRMASK. ADDR.ADDR is the upper limit. Reserved. Bit 10 AACKENAutomatic Acknowledge Enable This bit enables the address to be automatically acknowledged if there is an address match. Value 0 1 Description Automatic acknowledge is disabled. Automatic acknowledge is enabled. Bit 9 GCMDPMBus Group Command This bit enables PMBus group command support. When enabled, the Stop Received interrupt flag (INTFLAG.PREC) will be set when a STOP condition is detected if the client has been addressed since the last STOP condition on the bus. Value 0 1 Description Group command is disabled. Group command is enabled. Bit 8 SMENSmart Mode Enable When smart mode is enabled, data is acknowledged automatically when DATA.DATA is read. Value 0 1 Description Smart mode is disabled. Smart mode is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 652 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.8.3 Control C Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected CTRLC 0x08 0x00000000 Bit 31 30 29 28 27 26 25 Access Reset 24 DATA32B R/W 0 Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 24 DATA32BData 32 Bit This bit enables 32-bit data writes and reads to/from the DATA register. Value 0 1 Description Data transaction to/from DATA are 8-bit in size Data transaction to/from DATA are 32-bit in size 9 1 8 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 653 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.8.4 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x14 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENSET). Bit Access Reset 7 ERROR R/W 0 6 5 4 3 2 DRDY R/W 0 1 AMATCH R/W 0 0 PREC R/W 0 Bit 7 ERRORError Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Error Interrupt Enable bit, which disables the Error interrupt. Value 0 1 Description Error interrupt is disabled. Error interrupt is enabled. Bit 2 DRDYData Ready Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Data Ready bit, which disables the Data Ready interrupt. Value 0 1 Description The Data Ready interrupt is disabled. The Data Ready interrupt is enabled. Bit 1 AMATCHAddress Match Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Address Match Interrupt Enable bit, which disables the Address Match interrupt. Value 0 1 Description The Address Match interrupt is disabled. The Address Match interrupt is enabled. Bit 0 PRECStop Received Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Stop Received Interrupt Enable bit, which disables the Stop Received interrupt. Value 0 1 Description The Stop Received interrupt is disabled. The Stop Received interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 654 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.8.5 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x16 0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear register (INTENCLR). Bit Access Reset 7 ERROR R/W 0 6 5 4 3 2 DRDY R/W 0 1 AMATCH R/W 0 0 PREC R/W 0 Bit 7 ERRORError Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Error Interrupt Enable bit, which enables the Error interrupt. Value 0 1 Description Error interrupt is disabled. Error interrupt is enabled. Bit 2 DRDYData Ready Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Data Ready bit, which enables the Data Ready interrupt. Value 0 1 Description The Data Ready interrupt is disabled. The Data Ready interrupt is enabled. Bit 1 AMATCHAddress Match Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Address Match Interrupt Enable bit, which enables the Address Match interrupt. Value 0 1 Description The Address Match interrupt is disabled. The Address Match interrupt is enabled. Bit 0 PRECStop Received Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Stop Received Interrupt Enable bit, which enables the Stop Received interrupt. Value 0 1 Description The Stop Received interrupt is disabled. The Stop Received interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 655 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.8.6 Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
INTFLAG 0x18 0x00
Bit Access Reset 7 ERROR R/W 0 Bit 7 ERRORError 6 5 4 3 2 DRDY R/W 0 1 AMATCH R/W 0 0 PREC R/W 0 This bit is set when any error is detected. Errors that will set this flag have corresponding status flags in the STATUS register. The corresponding bits in STATUS are SEXTTOUT, LOWTOUT, COLL and BUSERR. Writing 0 to this bit has no effect. Writing 1 to this bit will clear the flag. Bit 2 DRDYData Ready This flag is set when a I2C client byte transmission is successfully completed. The flag is cleared by hardware when either:
Writing to the DATA register. Reading the DATA register with Smart mode enabled. Writing a valid command to the CMD register. Writing 0 to this bit has no effect. Writing 1 to this bit will clear the Data Ready Interrupt flag. Bit 1 AMATCHAddress Match This flag is set when the I2C client address match logic detects that a valid address has been received. The flag is cleared by hardware when CTRL.CMD is written. Writing 0 to this bit has no effect. Writing 1 to this bit will clear the Address Match Interrupt flag. When cleared, an ACK/NACK will be sent according to CTRLB.ACKACT. Bit 0 PRECStop Received This flag is set when a Stop condition is detected for a transaction being processed. A Stop condition detected between a bus host and another client will not set this flag, unless the PMBus Group Command is enabled in the Control B register (CTRLB.GCMD=1). This flag is cleared by hardware after a command is issued on the next address match. Writing 0 to this bit has no effect. Writing 1 to this bit will clear the Stop Received Interrupt flag. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 656 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.8.7 Status Name:
Offset:
Reset:
Property:
STATUS 0x1A 0x0000
Bit 15 14 13 12 Access Reset Bit 7 CLKHOLD Access Reset R 0 6 LOWTOUT R/W 0 5 4 SR R 0 Bit 11 LENERRTransaction Length Error 11 LENERR R/W 0 3 DIR R 0 10 8 9 SEXTTOUT R/W 0 2 RXNACK R 0 1 COLL R/W 0 0 BUSERR R/W 0 This bit is set when the length counter is enabled (LENGTH.LENEN) and a STOP or repeated START is received before or after the length in LENGTH.LEN is reached. This bit is cleared automatically if responding to a new start condition with ACK or NACK (write 3 to CTRLB.CMD) or when INTFLAG.AMATCH is cleared. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the status. Value 0 1 Description No length error has occurred. Length error has occurred. Bit 9 SEXTTOUTClient SCL Low Extend Time-Out This bit is set if a client SCL low extend time-out occurs. This bit is cleared automatically if responding to a new start condition with ACK or NACK (write 3 to CTRLB.CMD) or when INTFLAG.AMATCH is cleared. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the status. Value 0 1 Description No SCL low extend time-out has occurred. SCL low extend time-out has occurred. Bit 7 CLKHOLDClock Hold The client Clock Hold bit (STATUS.CLKHOLD) is set when the client is holding the SCL line low, stretching the I2C clock. Software must consider this bit a read-only status flag that is set when INTFLAG.DRDY or INTFLAG.AMATCH is set. This bit is automatically cleared when the corresponding interrupt is also cleared. Bit 6 LOWTOUTSCL Low Time-out This bit is set if an SCL low time-out occurs. This bit is cleared automatically if responding to a new start condition with ACK or NACK (write 3 to CTRLB.CMD) or when INTFLAG.AMATCH is cleared. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the status. Value 0 1 Description No SCL low time-out has occurred. SCL low time-out has occurred. Bit 4 SRRepeated Start When INTFLAG.AMATCH is raised due to an address match, SR indicates a repeated start or start condition. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 657 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... This flag is only valid while the INTFLAG.AMATCH flag is one. Value 0 1 Description Start condition on last address match Repeated start condition on last address match Bit 3 DIRRead / Write Direction The Read/Write Direction (STATUS.DIR) bit stores the direction of the last address packet received from a host . Value 0 1 Description Host write operation is in progress. Host read operation is in progress. Bit 2 RXNACKReceived Not Acknowledge This bit indicates whether the last data packet sent was acknowledged or not. Value 0 1 Description Host responded with ACK. Host responded with NACK. Bit 1 COLLTransmit Collision If set, the I2C client was not able to transmit a high data or NACK bit, the I2C client will immediately release the SDA and SCL lines and wait for the next packet addressed to it. This flag is intended for the SMBus address resolution protocol (ARP). A detected collision in non-ARP situations indicates that there has been a protocol violation, and must be treated as a bus error. Note:This status will not trigger any interrupt, and must be checked by software to verify that the data were sent correctly. This bit is cleared automatically if responding to an address match with an ACK or a NACK (writing 0x3 to CTRLB.CMD), or INTFLAG.AMATCH is cleared. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the status. Value 0 1 Description No collision detected on last data byte sent. Collision detected on last data byte sent. Bit 0 BUSERRBus Error The Bus Error bit (STATUS.BUSERR) indicates that an illegal bus condition has occurred on the bus, regardless of bus ownership. An illegal bus condition is detected if a protocol violating start, repeated start or stop is detected on the I2C bus lines. A start condition directly followed by a stop condition is one example of a protocol violation. If a time-out occurs during a frame, this is also considered a protocol violation, and will set STATUS.BUSERR. This bit is cleared automatically if responding to an address match with an ACK or a NACK (writing 0x3 to CTRLB.CMD) or INTFLAG.AMATCH is cleared. Writing a 0 to this bit has no effect. Writing a 1 to this bit will clear the status. Value 0 1 Description No bus error detected. Bus error detected. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 658 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.8.8 Synchronization Busy Name:
Offset:
Reset:
Property:
SYNCBUSY 0x1C 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 3 2 Access Reset 1 ENABLE R 0 0 SWRST R 0 Bit 1 ENABLESERCOM Enable Synchronization Busy Enabling and disabling the SERCOM (CTRLA.ENABLE) requires synchronization. Ongoing synchronization is indicated by SYNCBUSY.ENABLE = 1 until synchronization is complete. Value 0 1 Description Enable synchronization is not busy. Enable synchronization is busy. Bit 0 SWRSTSoftware Reset Synchronization Busy Resetting the SERCOM (CTRLA.SWRST) requires synchronization. Ongoing synchronization is indicated by SYNCBUSY.SWRST = 1 until synchronization is complete. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description SWRST synchronization is not busy. SWRST synchronization is busy. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 659 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.8.9 Address Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected ADDR 0x24 0x00000000 Bit 31 30 29 28 27 Access Reset Bit 23 Access Reset R/W 0 Bit 15 Access Reset Bit 7 Access Reset R/W 0 22 R/W 0 14 6 R/W 0 21 R/W 0 13 5 R/W 0 20 ADDRMASK[6:0]
R/W 0 12 4 ADDR[6:0]
R/W 0 19 R/W 0 11 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 ADDRMASK[9:7]
R/W 0 17 R/W 0 9 ADDR[9:7]
R/W 0 1 R/W 0 24 R/W 0 16 8 R/W 0 0 GENCEN R/W 0 Bits 26:17 ADDRMASK[9:0]Address Mask These bits act as a second address match register, an address mask register or the lower limit of an address range, depending on the CTRLB.AMODE setting. Bits 10:1 ADDR[9:0]Address These bits contain the I2C client address used by the client address match logic to determine if a host has addressed the client. When using 7-bit addressing, the client address is represented by ADDR[6:0]. When the address match logic detects a match, INTFLAG.AMATCH is set and STATUS.DIR is updated to indicate whether it is a read or a write transaction. Bit 0 GENCENGeneral Call Address Enable A general call address is an address consisting of all-zeroes, including the direction bit (host write). Value 0 1 Description General call address recognition disabled. General call address recognition enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 660 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.8.10 Data Name:
Offset:
Reset:
Property: Read/Write DATA 0x28 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 DATA[31:24]
R/W 0 20 R/W 0 19 DATA[23:16]
R/W 0 12 R/W 0 4 R/W 0 DATA[15:8]
DATA[7:0]
R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 DATA[31:0]Data The client data register I/O location (DATA.DATA) provides access to the host transmit and receive data buffers. Reading valid data or writing data to be transmitted can be successfully done only when SCL is held low by the client
(STATUS.CLKHOLD is set). An exception occurs when reading the last data byte after the stop condition has been received. Accessing DATA.DATA auto-triggers I2C bus operations. The operation performed depends on the state of CTRLB.ACKACT, CTRLB.SMEN and the type of access (read/write). When CTRLC.DATA32B=1, read and write transactions from/to the DATA register are 32 bit in size. Otherwise, reads and writes are 8 bit. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 661 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.9 Register Summary - I2C Host Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x00 CTRLA 0x04 CTRLB 0x08
... 0x0B Reserved 0x0C BAUD 0x10
... 0x13 0x14 0x15 0x16 0x17 0x18 0x19 Reserved INTENCLR Reserved INTENSET Reserved INTFLAG Reserved 0x1A STATUS 0x1C SYNCBUSY 0x20
... 0x23 Reserved 0x24 ADDR 0x28 DATA 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 7:0 7:0 7:0 15:8 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 0x2C
... 0x2F 0x30 Reserved DBGCTRL 7:0 RUNSTDBY MODE[2:0]
ENABLE SWRST SEXTTOEN MEXTTOEN SDAHOLD[1:0]
LOWTOUT INACTOUT[1:0]
SCLSM PINOUT SPEED[1:0]
QCEN SMEN ACKACT CMD[1:0]
BAUD[7:0]
BAUDLOW[7:0]
ERROR ERROR ERROR CLKHOLD LOWTOUT BUSSTATE[1:0]
SB SB SB MB MB MB RXNACK ARBLOST BUSERR LENERR SEXTTOUT MEXTTOUT SYSOP ENABLE SWRST TENBITEN LENEN ADDR[7:0]
LEN[7:0]
DATA[7:0]
DATA[15:8]
DATA[23:16]
DATA[31:24]
ADDR[10:8]
DBGSTOP 32.10 Register Description I2C Host Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the PAC Write-Protection property in each individual register description. Some registers are synchronized when read and/or written. Synchronization is denoted by the Write-Synchronized or the Read-Synchronized property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 662 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable-
protection is denoted by the Enable-Protected property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 663 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized CTRLA 0x00 0x00000000 Bit 31 Access Reset 30 LOWTOUT R/W 0 Bit 23 SEXTTOEN Access Reset R/W 0 22 MEXTTOEN R/W 0 Bit 15 14 Access Reset R/W 0 13 Bit 7 6 5 RUNSTDBY Access Reset R/W 0 Bit 30 LOWTOUTSCL Low Time-Out 29 28 INACTOUT[1:0]
R/W 0 21 R/W 0 20 SDAHOLD[1:0]
26 27 SCLSM R/W 0 19 18 25 R/W 0 17 SPEED[1:0]
24 R/W 0 16 PINOUT R/W 0 R/W 0 12 4 R/W 0 11 10 9 8 3 MODE[2:0]
R/W 0 2 R/W 0 1 ENABLE R/W 0 0 SWRST R/W 0 This bit enables the SCL low time-out. If SCL is held low for 25ms-35ms, the host will release its clock hold, if enabled, and complete the current transaction. A stop condition will automatically be transmitted. INTFLAG.SB or INTFLAG.MB will be set as normal, but the clock hold will be released. The STATUS.LOWTOUT and STATUS.BUSERR status bits will be set. This bit is not synchronized. Value 0 1 Description Time-out disabled. Time-out enabled. Bits 29:28 INACTOUT[1:0]Inactive Time-Out If the inactive bus time-out is enabled and the bus is inactive for longer than the time-out setting, the bus state logic will be set to idle. An inactive bus arise when either an I2C host or client is holding the SCL low. Enabling this option is necessary for SMBus compatibility, but can also be used in a non-SMBus set-up. Calculated time-out periods are based on a 100kHz baud rate. These bits are not synchronized. Name Value DIS 0x0 55US 0x1 105US 0x2 205US 0x3 Description Disabled 5-6 SCL cycle time-out (50-60s) 10-11 SCL cycle time-out (100-110s) 20-21 SCL cycle time-out (200-210s) Bit 27 SCLSMSCL Clock Stretch Mode This bit controls when SCL will be stretched for software interaction. This bit is not synchronized. Value 0 1 Description SCL stretch according to Figure 32-5 SCL stretch only after ACK bit, Figure 32-6 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 664 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Bits 25:24 SPEED[1:0]Transfer Speed These bits define bus speed. These bits are not synchronized. Value 0x0 0x1 0x2 0x3 Description Standard-mode (Sm) up to 100 kHz and Fast-mode (Fm) up to 400 kHz Fast-mode Plus (Fm+) up to 1 MHz Reserved Reserved Bit 23 SEXTTOENClient SCL Low Extend Time-Out This bit enables the client SCL low extend time-out. If SCL is cumulatively held low for greater than 25ms from the initial START to a STOP, the host will release its clock hold if enabled, and complete the current transaction. A STOP will automatically be transmitted. SB or MB will be set as normal, but CLKHOLD will be release. The MEXTTOUT and BUSERR status bits will be set. This bit is not synchronized. Value 0 1 Description Time-out disabled Time-out enabled Bit 22 MEXTTOENHost SCL Low Extend Time-Out This bit enables the host SCL low extend time-out. If SCL is cumulatively held low for greater than 10ms from START-to-ACK, ACK-to-ACK, or ACK-to-STOP the host will release its clock hold if enabled, and complete the current transaction. A STOP will automatically be transmitted. SB or MB will be set as normal, but CLKHOLD will be released. The MEXTTOUT and BUSERR status bits will be set. This bit is not synchronized. Value 0 1 Description Time-out disabled Time-out enabled Bits 21:20 SDAHOLD[1:0]SDA Hold Time These bits define the SDA hold time with respect to the negative edge of SCL. These bits are not synchronized. Name Value DIS 0x0 75NS 0x1 450NS 0x2 600NS 0x3 Description Disabled 50-100ns hold time 300-600ns hold time 400-800ns hold time Bit 16 PINOUTPin Usage This bit set the pin usage to either two- or four-wire operation:
This bit is not synchronized. Value 0 1 Description 4-wire operation disabled. 4-wire operation enabled. Bit 7 RUNSTDBYRun in Standby This bit defines the functionality in standby sleep mode. This bit is not synchronized. Value 0 1 Description GCLK_SERCOMx_CORE is disabled and the I2C host will not operate in standby sleep mode. GCLK_SERCOMx_CORE is enabled in all sleep modes. Bits 4:2 MODE[2:0]Operating Mode These bits must be written to 0x5 to select the I2C host serial communication interface of the SERCOM. These bits are not synchronized. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 665 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... Bit 1 ENABLEEnable Due to synchronization, there is delay from writing CTRLA.ENABLE until the peripheral is enabled/disabled. The value written to CTRL.ENABLE will read back immediately and the Synchronization Enable Busy bit in the Synchronization Busy register (SYNCBUSY.ENABLE) will be set. SYNCBUSY.ENABLE will be cleared when the operation is complete. This bit is not enable-protected. Value 0 1 Description The peripheral is disabled or being disabled. The peripheral is enabled. Bit 0 SWRSTSoftware Reset Writing 0 to this bit has no effect. Writing 1 to this bit resets all registers in the SERCOM, except DBGCTRL, to their initial state, and the SERCOM will be disabled. Writing 1 to CTRLA.SWRST will always take precedence, meaning that all other writes in the same write-operation will be discarded. Any register write access during the ongoing reset will result in an APB error. Reading any register will return the reset value of the register. Due to synchronization there is a delay from writing CTRLA.SWRST until the reset is complete. CTRLA.SWRST and SYNCBUSY.SWRST will both be cleared when the reset is complete. This bit is not enable-protected. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description There is no reset operation ongoing. The reset operation is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 666 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.2 Control B Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected, Write-Synchronized CTRLB 0x04 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 Access Reset 18 ACKACT R/W 0 Bit 15 14 13 12 11 10 Access Reset 17 W 0 9 QCEN R/W 0 CMD[1:0]
16 W 0 8 SMEN R/W 0 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 18 ACKACTAcknowledge Action This bit defines the I2C Host's acknowledge behavior after a data byte is received from the I2C Client. The acknowledge action is executed when a command is written to CTRLB.CMD, or if Smart mode is enabled
(CTRLB.SMEN is written to one), when DATA.DATA is read. This bit is not enable-protected. This bit is not write-synchronized. Value 0 1 Description Send ACK. Send NACK. Bits 17:16 CMD[1:0]Command Writing these bits triggers a Host operation as described below. The CMD bits are strobe bits, and always read as zero. The acknowledge action is only valid in Host Read mode. In Host Write mode, a command will only result in a repeated Start or Stop condition. The CTRLB.ACKACT bit and the CMD bits can be written at the same time, and then the acknowledge action will be updated before the command is triggered. Commands can only be issued when either the Client on Bus Interrupt flag (INTFLAG.SB) or Host on Bus Interrupt flag (INTFLAG.MB) is '1'. If CMD 0x1 is issued, a repeated start will be issued followed by the transmission of the current address in ADDR.ADDR. If another address is desired, ADDR.ADDR must be written instead of the CMD bits. This will trigger a repeated start followed by transmission of the new address. Issuing a command will set the System Operation bit in the Synchronization Busy register (SYNCBUSY.SYSOP). Table 32-4. Command Description CMD[1:0]
Direction Action 0x0 0x1 0x2 0x3 X X 0 (Write) 1 (Read) X
(No action) Execute acknowledge action succeeded by repeated Start No operation Execute acknowledge action succeeded by a byte read operation Execute acknowledge action succeeded by issuing a Stop condition 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 667 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... These bits are not enable-protected. Bit 9 QCENQuick Command Enable This bit is not write-synchronized. Value 0 1 Description Quick Command is disabled. Quick Command is enabled. Bit 8 SMENSmart Mode Enable When Smart mode is enabled, acknowledge action is sent when DATA.DATA is read. This bit is not write-synchronized. Value 0 1 Description Smart mode is disabled. Smart mode is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 668 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.3 Baud Rate Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-Protected BAUD 0x0C 0x0000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 14 R/W 0 6 R/W 0 13 R/W 0 5 R/W 0 12 11 BAUDLOW[7:0]
R/W 0 4 R/W 0 BAUD[7:0]
R/W 0 3 R/W 0 10 R/W 0 2 R/W 0 9 R/W 0 1 R/W 0 8 R/W 0 0 R/W 0 Bits 15:8 BAUDLOW[7:0]Host Baud Rate Low If this bit field is non-zero, the SCL low time will be described by the value written. For more details on how to calculate the frequency, see Clock Generation Baud-Rate Generator from Related Links. Bits 7:0 BAUD[7:0]Host Baud Rate This bit field is used to derive the SCL high time if BAUD.BAUDLOW is non-zero. If BAUD.BAUDLOW is zero, BAUD will be used to generate both high and low periods of the SCL. For more details on how to calculate the frequency, see Clock Generation Baud-Rate Generator from Related Links. Related Links 29.6.2.3. Clock Generation Baud-Rate Generator 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 669 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.4 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x14 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set register (INTENSET). Bit Access Reset 7 ERROR R/W 0 6 5 4 3 2 1 SB R/W 0 0 MB R/W 0 Bit 7 ERRORError Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Error Interrupt Enable bit, which disables the Error interrupt. Value 0 1 Description Error interrupt is disabled. Error interrupt is enabled. Bit 1 SBClient on Bus Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Client on Bus Interrupt Enable bit, which disables the Client on Bus interrupt. Value 0 1 Description The Client on Bus interrupt is disabled. The Client on Bus interrupt is enabled. Bit 0 MBHost on Bus Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will clear the Host on Bus Interrupt Enable bit, which disables the Host on Bus interrupt. Value 0 1 Description The Host on Bus interrupt is disabled. The Host on Bus interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 670 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.5 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x16 0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear register (INTENCLR). Bit Access Reset 7 ERROR R/W 0 6 5 4 3 2 1 SB R/W 0 0 MB R/W 0 Bit 7 ERRORError Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Error Interrupt Enable bit, which enables the Error interrupt. Value 0 1 Description Error interrupt is disabled. Error interrupt is enabled. Bit 1 SBClient on Bus Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Client on Bus Interrupt Enable bit, which enables the Client on Bus interrupt. Value 0 1 Description The Client on Bus interrupt is disabled. The Client on Bus interrupt is enabled. Bit 0 MBHost on Bus Interrupt Enable Writing '0' to this bit has no effect. Writing '1' to this bit will set the Host on Bus Interrupt Enable bit, which enables the Host on Bus interrupt. Value 0 1 Description The Host on Bus interrupt is disabled. The Host on Bus interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 671 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.6 Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
INTFLAG 0x18 0x00
Bit Access Reset 7 ERROR R/W 0 Bit 7 ERRORError 6 5 4 3 2 1 SB R/W 0 0 MB R/W 0 This flag is cleared by writing '1' to it. This bit is set when any error is detected. Errors that will set this flag have corresponding status bits in the STATUS register. These status bits are LENERR, SEXTTOUT, MEXTTOUT, LOWTOUT, ARBLOST, and BUSERR. Writing '0' to this bit has no effect. Writing '1' to this bit will clear the flag. Bit 1 SBClient on Bus The Client on Bus flag (SB) is set when a byte is successfully received in Host Read mode, for example, no arbitration lost or bus error occurred during the operation. When this flag is set, the host forces the SCL line low, stretching the I2C clock period. The SCL line will be released and SB will be cleared on one of the following actions:
Writing to ADDR.ADDR Writing to DATA.DATA Reading DATA.DATA when Smart mode is enabled (CTRLB.SMEN) Writing a valid command to CTRLB.CMD Writing '1' to this bit location will clear the SB flag. The transaction will not continue or be terminated until one of the above actions is performed. Writing '0' to this bit has no effect. Bit 0 MBHost on Bus This flag is set when a byte is transmitted in Host Write mode. The flag is set regardless of the occurrence of a bus error or an Arbitration Lost condition. MB is also set when arbitration is lost during sending of NACK in Host Read mode, or when issuing a Start condition if the bus state is unknown. When this flag is set and arbitration is not lost, the host forces the SCL line low, stretching the I2C clock period. The SCL line will be released and MB will be cleared on one of the following actions:
Writing to ADDR.ADDR Writing to DATA.DATA Reading DATA.DATA when Smart mode is enabled (CTRLB.SMEN) Writing a valid command to CTRLB.CMD Writing '1' to this bit location will clear the MB flag. The transaction will not continue or be terminated until one of the above actions is performed. Writing '0' to this bit has no effect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 672 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.7 Status STATUS Name:
0x1A Offset:
Reset:
0x0000 Property: Write-Synchronized Bit 15 14 13 12 11 Access Reset Bit 7 CLKHOLD Access Reset R 0 6 LOWTOUT R/W 0 5 4 BUSSTATE[1:0]
R/W 0 R/W 0 3 Bit 10 LENERRTransaction Length Error 10 LENERR R/W 0 2 RXNACK R 0 9 SEXTTOUT R/W 0 1 ARBLOST R/W 0 8 MEXTTOUT R/W 0 0 BUSERR R/W 0 This bit is set when automatic length is used for a DMA transaction and the client sends a NACK before ADDR.LEN bytes have been written by the host. Writing '1' to this bit location will clear STATUS.LENERR. This flag is automatically cleared when writing to the ADDR register. Writing '0' to this bit has no effect. This bit is not write-synchronized. Bit 9 SEXTTOUTClient SCL Low Extend Time-Out This bit is set if a client SCL low extend time-out occurs. This bit is automatically cleared when writing to the ADDR register. Writing '1' to this bit location will clear SEXTTOUT. Normal use of the I2C interface does not require the SEXTTOUT flag to be cleared by this method. Writing '0' to this bit has no effect. This bit is not write-synchronized. Bit 8 MEXTTOUTHost SCL Low Extend Time-Out This bit is set if a Host SCL low time-out occurs. Writing '1' to this bit location will clear STATUS.MEXTTOUT. This flag is automatically cleared when writing to the ADDR register. Writing '0' to this bit has no effect. This bit is not write-synchronized. Bit 7 CLKHOLDClock Hold This bit is set when the host is holding the SCL line low, stretching the I2C clock. Software must consider this bit when INTFLAG.SB or INTFLAG.MB is set. This bit is cleared when the corresponding Interrupt flag is cleared and the next operation is given. Writing '0' to this bit has no effect. Writing '1' to this bit has no effect. This bit is not write-synchronized. Bit 6 LOWTOUTSCL Low Time-Out This bit is set if an SCL low time-out occurs. Writing '1' to this bit location will clear this bit. This flag is automatically cleared when writing to the ADDR register. Writing '0' to this bit has no effect. This bit is not write-synchronized. Bits 5:4 BUSSTATE[1:0]Bus State These bits indicate the current I2C Bus state. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 673 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... When in UNKNOWN state, writing 0x1 to BUSSTATE forces the bus state into the IDLE state. The bus state cannot be forced into any other state. Writing BUSSTATE to idle will set SYNCBUSY.SYSOP. Value 0x0 Name UNKNOWN The Bus state is unknown to the I2C host and will wait for a Stop condition to be detected Description 0x1 0x2 0x3 IDLE OWNER BUSY or wait to be forced into an Idle state by software The Bus state is waiting for a transaction to be initialized The I2C host is the current owner of the bus Some other I2C host owns the bus Bit 2 RXNACKReceived Not Acknowledge This bit indicates whether the last address or data packet sent was acknowledged or not. Writing '0' to this bit has no effect. Writing '1' to this bit has no effect. This bit is not write-synchronized. Value 0 1 Description Client responded with ACK. Client responded with NACK. Bit 1 ARBLOSTArbitration Lost This bit is set if arbitration is lost while transmitting a high data bit or a NACK bit, or while issuing a Start or Repeated Start condition on the bus. The Host on Bus Interrupt flag (INTFLAG.MB) will be set when STATUS.ARBLOST is set. Writing the ADDR.ADDR register will automatically clear STATUS.ARBLOST. Writing '0' to this bit has no effect. Writing '1' to this bit will clear it. This bit is not write-synchronized. Bit 0 BUSERRBus Error This bit indicates that an illegal Bus condition has occurred on the bus, regardless of bus ownership. An illegal Bus condition is detected if a protocol violating start, repeated start or stop is detected on the I2C bus lines. A Start condition directly followed by a Stop condition is one example of a protocol violation. If a time-out occurs during a frame, this is also considered a protocol violation, and will set BUSERR. If the I2C host is the bus owner at the time a bus error occurs, STATUS.ARBLOST and INTFLAG.MB will be set in addition to BUSERR. Writing the ADDR.ADDR register will automatically clear the BUSERR flag. Writing '0' to this bit has no effect. Writing '1' to this bit will clear it. This bit is not write-synchronized. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 674 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.8 Synchronization Busy Name:
Offset:
Reset:
SYNCBUSY 0x1C 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 3 Access Reset Bit 2 SYSOPSystem Operation Synchronization Busy Value 0 1 Description System operation synchronization is not busy. System operation synchronization is busy. Bit 1 ENABLESERCOM Enable Synchronization Busy 2 SYSOP R 0 1 ENABLE R 0 0 SWRST R 0 Enabling and disabling the SERCOM (CTRLA.ENABLE) requires synchronization. When written, the SYNCBUSY.ENABLE bit will be set until synchronization is complete. Value 0 1 Description Enable synchronization is not busy. Enable synchronization is busy. Bit 0 SWRSTSoftware Reset Synchronization Busy Resetting the SERCOM (CTRLA.SWRST) requires synchronization. When written, the SYNCBUSY.SWRST bit will be set until synchronization is complete. Note:During a SWRST, access to registers/bits without SWRST are disallowed until SYNCBUSY.SWRST cleared by hardware. Value 0 1 Description SWRST synchronization is not busy. SWRST synchronization is busy. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 675 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.9 Address ADDR Name:
0x24 Offset:
Reset:
0x0000 Property: Write-Synchronized Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 Access Reset R/W 0 Bit 15 TENBITEN Access Reset R/W 0 Bit 7 Access Reset R/W 0 22 R/W 0 14 6 R/W 0 21 R/W 0 13 LENEN R/W 0 5 R/W 0 LEN[7:0]
ADDR[7:0]
20 R/W 0 12 4 R/W 0 19 R/W 0 11 3 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 17 R/W 0 9 ADDR[10:8]
R/W 0 1 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 23:16 LEN[7:0]Transaction Length These bits define the transaction length of a DMA transaction from 0 to 255 bytes. The Transfer Length Enable
(LENEN) bit must be written to '1' in order to use DMA. Bit 15 TENBITENTen Bit Addressing Enable This bit enables 10-bit addressing. This bit can be written simultaneously with ADDR to indicate a 10-bit or 7-bit address transmission. Value 0 1 Description 10-bit addressing disabled. 10-bit addressing enabled. Bit 13 LENENTransfer Length Enable Value 0 1 Description Automatic transfer length disabled. Automatic transfer length enabled. Bits 10:0 ADDR[10:0]Address When ADDR is written, the consecutive operation will depend on the bus state:
UNKNOWN: INTFLAG.MB and STATUS.BUSERR are set, and the operation is terminated. BUSY: The I2C host will await further operation until the bus becomes IDLE. IDLE: The I2C host will issue a start condition followed by the address written in ADDR. If the address is acknowledged, SCL is forced and held low, and STATUS.CLKHOLD and INTFLAG.MB are set. OWNER: A repeated start sequence will be performed. If the previous transaction was a read, the acknowledge action is sent before the repeated start bus condition is issued on the bus. Writing ADDR to issue a repeated start is performed while INTFLAG.MB or INTFLAG.SB is set. STATUS.BUSERR, STATUS.ARBLOST, INTFLAG.MB and INTFLAG.SB will be cleared when ADDR is written. The ADDR register can be read at any time without interfering with ongoing bus activity, as a read access does not trigger the host logic to perform any bus protocol related operations. The I2C host control logic uses bit 0 of ADDR as the bus protocols read/write flag (R/W); 0 for write and 1 for read. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 676 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.10 Data Name:
Offset:
Reset:
Property: Read/Write DATA 0x28 0x00000000 Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 DATA[31:24]
R/W 0 20 R/W 0 19 DATA[23:16]
R/W 0 12 R/W 0 4 R/W 0 DATA[15:8]
DATA[7:0]
R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 DATA[31:0]Data The host data register I/O location (DATA) provides access to the host transmit and receive data buffers. Reading valid data or writing data to be transmitted can be successfully done only when SCL is held low by the host
(STATUS.CLKHOLD is set). An exception is reading the last data byte after the stop condition has been sent. Accessing DATA.DATA auto-triggers I2C bus operations. The operation performed depends on the state of CTRLB.ACKACT, CTRLB.SMEN and the type of access (read/write). When CTRLC.DATA32B=1, read and write transactions from/to the DATA register are 32 bit in size. Otherwise, reads and writes are 8 bit. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 677 PIC32CX-BZ2 and WBZ45 Family SERCOM Inter-Integrated Circuit (SERCOM I2C... 32.10.11 Debug Control Name:
Offset:
Reset:
Property: PAC Write-Protection DBGCTRL 0x30 0x00 Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DBGSTOPDebug Stop Mode DBGSTOP R/W 0 This bit controls functionality when the CPU is halted by an external debugger. Value 0 1 Description The baud-rate generator continues normal operation when the CPU is halted by an external debugger. The baud-rate generator is halted when the CPU is halted by an external debugger. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 678 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33. Quad Serial Peripheral Interface (QSPI) 33.1 Overview The Quad SPI Interface (QSPI) circuit is a synchronous serial data link that provides communication with external devices in Host mode. The QSPI can be used in SPI mode to interface serial peripherals, such as ADCs, DACs, LCD controllers and sensors, or in Serial Memory Mode to interface serial Flash memories. The QSPI allows the system to execute code directly from a serial Flash memory (XIP) without code shadowing to SRAM. The serial Flash memory mapping is seen in the system as other memories (ROM, SRAM, DRAM, embedded Flash memories, etc.,). With the support of the quad-SPI protocol, the QSPI allows the system to use high performance serial Flash memories which are small and inexpensive, in place of larger and more expensive parallel Flash memories. Note:Traditional Quad SPI Interface (QSPI) documentation uses the terminology Master and Slave. The equivalent Microchip terminology used in this document is Host and Client respectively. 33.2 Features Host SPI Interface:
Programmable clock phase and clock polarity Programmable transfer delays between consecutive transfers, between clock and data, between deactivation and activation of chip select (CS) SPI Mode:
To use serial peripherals, such as ADCs, DACs, LCD controllers, and sensors 8-bit, 16-bit, or 32-bit programmable data length Serial Memory Mode:
To use serial Flash memories operating in single-bit SPI, Dual SPI and Quad SPI Supports execute in place (XIP). The system can execute code directly from a Serial Flash memory Flexible instruction register, to be compatible with all serial Flash memories 32-bit Address mode (default is 24-bit address) to support serial Flash memories larger than 128 Mbit Continuous Read mode Scrambling/Unscrambling On-the-Fly Double data rate support Connection to DMA Channel Capabilities Optimizes Data Transfers One channel for the receiver and one channel for the transmitter Register Write Protection 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 679 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.3 Block Diagram Figure 33-1. QSPI Block Diagram Clock Source Generator
(CLK_GEN) PBx_CLK
(CLK_QSPI_APB) sys_clk
(CLK_QSPI_AHB) Peripheral Bridge APB QSPI CPU DMA AHB MATRIX SCK MOSI/DATA0 MISO/DATA1 DATA2 DATA3 CS 33.4 Signal Description Table 33-1. Quad-SPI Signals Signal SCK CS Description Serial Clock Chip Select Interrupt Control QSPI Interrupt Type Output Output MOSI(DATA0) Data Output (Data Input Output 0) Output (Input/Output) MISO(DATA1) Data Input (Data Input Output 1) Input (Input/Output) DATA2 DATA3 Notes:
Data Input Output 2 Data Input Output 3 Input/Output Input/Output 1. MOSI and MISO are used for single-bit SPI operation. 2. DATA0-DATA1 are used for Dual SPI operation. 3. DATA0-DATA3 are used for Quad SPI operation. See I/O Ports and Peripheral Pin Select (PPS) from Related Links for details on the pin mapping for the QSPI peripheral. Related Links 6. I/O Ports and Peripheral Pin Select (PPS) 33.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 680 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.5.1 I/O Lines Using the QSPI I/O lines requires the I/O pins to be configured. 33.5.2 Power Management The QSPI will continue to operate in any Sleep mode where the selected source clock is running. The QSPI interrupts can be used to wake up the device from sleep modes. See Power Management Unit (PMU) from Related Links for details on the different sleep modes. Related Links 15. Power Management Unit (PMU) 33.5.3 Clocks An AHB clock (CLK_QSPI_AHB) is required to clock the QSPI. This clock can be enabled and disabled in the CRU. A FAST clock (CLK_QSPI2X_AHB) is required to clock the QSPI. This clock can be enabled and disabled in the CFGCON1 register, bit 29 (CFGCON1.QSPIDDRM). When using QSPI DDR mode, the System Clock (SYS_CLK) must be <= 48 MHz. Figure 33-2. QSPI Clock Organization HS Clock Domain: fHS CLK_QSPI2X_AHB QSPI CPU Clock Domain: fCPU CLK_QSPI_AHB CLK_QSPI_APB Important: The CLK_QSPI2x_AHB must be 2 times faster to CLK_QSPI_AHB when the QSPI is operated in DDR mode. In SDR, the CLK_QSPI2x_AHB is not used. CLK_QSPI_APB, CLK_QSPI_AHB and CLK_QSPI2X_AHB, respectively, are all synchronous but can be divided by a prescaler and may run even when the module clock is turned off. 33.5.4 DMA The DMA request lines are connected to the DMA Controller (DMAC). Using the QSPI DMA requests requires the DMA Controller to be configured first. Note:DMAC write access must be 32-bit aligned. If a single byte is to be written in a 32-bit word, the rest of the word must be filled with 'ones'. 33.5.5 Interrupts The interrupt request lines are connected to the interrupt controller. Using the QSPI interrupts requires the interrupt controller to be configured first. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 33.5.6 Events Not applicable. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 681 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.5.7 Debug Operation When the CPU is halted in debug mode the QSPI continues normal operation. If the QSPI is configured in a way that requires it to be periodically serviced by the CPU through interrupts or similar, improper operation or data loss may result during debugging. 33.5.8 Register Access Protection All registers with write-access are optionally write-protected by the peripheral access controller (PAC), except the following registers:
Control A (CTRLA) register Transmit Data (TXDATA) register Scrambling Key (SCRAMBKEY) register Interrupt Flag Status and Clear (INTFLAG) register PAC write-protection is denoted by the PAC Write-Protection property in the register description. Write-protection does not apply to accesses through an external debugger. 33.6 Functional Description 33.6.1 Principle of Operation The QSPI is a high-speed synchronous data transfer interface. It allows high-speed communication between the device and peripheral or serial memory devices. The QSPI operates as a host. It initiates and controls all data transactions. When transmitting, the TXDATA register can be loaded with the next character to be transmitted during the current transmission. When receiving, the data is transferred to the RXDATA register, and the receiver is ready for a new character. 33.6.2 Basic Operation 33.6.2.1 Initialization After Power-On Reset, this peripheral is enabled . 33.6.2.2 Enabling, Disabling and Resetting The peripheral is enabled by writing a 1 to the Enable bit in the Control A register (CTRLA.ENABLE). The peripheral is disabled by writing a 0 to CTRLA.ENABLE. The peripheral is reset by writing a 1 to the Software Reset bit (CTRLA.SWRST). 33.6.3 Transfer Data Rate By default, the QSPI module is enabled in single data rate mode. In this operating mode, the CLK_QSPI2X_AHB clock is not used and must be disabled. The dual data rate operating mode is enabled by writing a 1 to the Double Data Rate Enable bit in the CFGCON1 register (CFGCON1.QSPIDDRM). This operating mode requires the CLK_QSPI2X_AHB clock and must be enabled before writing the DDREN bit. 33.6.4 Serial Clock Baud Rate The QSPI Baud rate clock is generated by dividing the module clock (CLK_QSPI_AHB) by a value between 1 and 255. This allows a maximum operating baud rate at up to Host Clock and a minimum operating baud rate of CLK_QSPI_AHB divided by 255. 33.6.5 Serial Clock Phase and Polarity Four combinations of polarity and phase are available for data transfers. Writing the Clock Polarity bit in the QSPI Baud register (BAUD.CPOL) selects the polarity. The Clock Phase bit in the BAUD register programs the clock phase 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 682 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (...
(BAUD.CPHA). These two parameters determine the edges of the clock signal on which data is driven and sampled. Each of the two parameters has two possible states, resulting in four possible combinations Note: The polarity/phase combinations are incompatible. Thus, the interfaced client must use the same parameter values to communicate. Table 33-2. SPI Transfer Mode Clock Mode BAUD.CPOL BAUD.CPHA Shift SCK Edge Capture SCK 0 1 2 3 0 0 1 1 0 1 0 1 Falling Rising Rising Falling Figure 33-3. QSPI Transfer Modes (BAUD.CPHA = 0, 8-bit transfer) Edge Rising Falling Falling Rising SCK Inactive Level Low Low High High SCK Cycle (for reference) 1 2 3 4 5 6 7 8 SCK
(CPOL = 0) SCK
(CPOL = 1) MOSI
(from host) MISO
(from client) CS
(to client) MSB MSB 6 6 5 5 4 4 3 3 2 2 1 1 LSB LSB
* Not defined, but normally MSB of previous character received 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 683 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Figure 33-4. QSPI Transfer Modes (BAUD.CPHA = 1, 8-bit transfer) SCK Cycle (for reference) 1 2 3 4 5 6 7 8 SCK
(CPOL = 0) MOSI
(from host) MSB MISO
(from client)
MSB 6 6 5 5 4 4 3 3 2 2 1 1 LSB LSB CS
(to client) 33.6.6 Transfer Delays
* Not defined, but normally LSB of previous character received The QSPI supports several consecutive transfers while the chip select is active. Three delays can be programmed to modify the transfer waveforms:
The delay between the inactivation and the activation of CS is programmed by writing the Minimum Inactive CS Delay bit field in the Control B register (CTRLB.DLYCS), allowing to tune the minimum time of CS at high level. The delay between consecutive transfers is programmed by writing the Delay Between Consecutive Transfers bit field in the Control B register (CTRLB.DLYBCT), allowing to insert a delay between two consecutive transfers. In Serial Memory mode, this delay is not programmable and DLYBCT settings are ignored. The delay before SCK is programmed by writing the Delay Before SCK bit field in the BAUD register
(BAUD.DLYBS), allowing to delay the start of SPCK after the chip select has been asserted. These delays allow the QSPI to be adapted to the interfaced peripherals and their speed and bus release time. Figure 33-5. Programmable Delay CS SCK DLYCS DLYBS DLYBCT DLYBCT 33.6.7 QSPI SPI Mode In this mode, the QSPI acts as a regular SPI Host. To activate this mode, the MODE bit in the Control B register must be cleared (CTRLB.MODE=0). 33.6.7.1 SPI Mode Operations The QSPI in standard SPI mode operates on the clock generated by the internal programmable baud rate generator. It fully controls the data transfers to and from the client connected to the SPI bus. The QSPI drives the chip select line to the client (CS) and the serial clock signal (SCK). The QSPI features a single internal shift register and two holding registers: the Transmit Data Register (TXDATA) and the Receive Data Register (RXDATA). The holding registers maintain the data flow at a constant rate. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 684 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... After enabling the QSPI, a data transfer begins when the processor writes to the TXDATA. The written data is immediately transferred into the internal shift register and transfer on the SPI bus starts. While the data in the internal shift register is shifted on the MOSI line, the MISO line is sampled and shifted into the internal shift register. Receiving data cannot occur without transmitting data. If new data is written in TXDATA during the transfer, it stays in TXDATA until the current transfer is completed. Then, the received data is transferred from the internal shift register to the RXDATA, the data in TXDATA is loaded into the internal shift register, and a new transfer starts. The transfer of data written in TXDATA in the internal shift register is indicated by the Transmit Data Register Empty
(DRE) bit in the Interrupt Flag Status and Clear register (INTFLAG.DRE). When new data is written in TXDATA, this bit is cleared. The DRE bit is used to trigger the Transmit DMA channel. The end of transfer is indicated by the Transmission Complete flag (INTFLAG.TXC). If the transfer delay for the last transfer was configured to be greater than 0 (CTRLB.DLYBCT), TXC is set after the completion of the delay. The module clock (CLK_QSPI_AHB) can be switched off at this time. Ongoing transfer of received data from the internal shift register into RXDATA is indicated by the Receive Data Register Full flag (INTFLAG.RXC). When the received data is read, the RXC bit is cleared. If the RXDATA has not been read before new data is received, the Overrun Error flag in INTFLAG register
(INTFLAG.ERROR) is set. As long as this flag is set, data is loaded in RXDATA. The SPI Mode Block Diagram shows a flow chart describing how transfers are handled. 33.6.7.2 SPI Mode Block Diagram Figure 33-6. SPI Mode Block Diagram BAUD BAUD Peripheral Clock Baud Rate Generator SCK Serial Clock BAUD RXDATA DATA RXC ERROR Shift Register MSB MOSI MISO CPHA CPOL LSB CTRLB DATALEN TXDATA DATA DRE Chip Select Controller CS CTRLB CSMODE 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 685 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.6.7.3 SPI Mode Flow Diagram Figure 33-7. SPI Mode Flow Diagram 1 0 QSI Enable DRE ?
0 CS = 0 Delay DLYBS Serializer = TXDATA DRE = 1 Data Transfer RXDATA = Serializer RXC = 1 Delay DLYBCT DRE ?
1 CS = 1 Delay DLYCS 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 686 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Figure 33-8. Interrupt Flags Behaviour 1 2 3 4 5 6 7 8 SCK CS MOSI
(from host) DRE Write in TXDATA RXC MISO
(from client) TXC MSB 6 5 4 3 2 1 LSB RXDATA Read MSB 6 5 4 3 2 1 LSB Shift register empty 33.6.7.4 Peripheral Deselection with DMA When the Direct Memory Access Controller is used, the Chip Select line will remain low during the whole transfer because the Transmit Data Register Empty flag in the Interrupt Flag Status and Clear register (INTFLAG.DRE) is managed by the DMA itself. The reloading of the TXDATA by the DMA is done as soon as the INTFLAG.DRE flag is set. In this case, setting the Chip Select mode bit field in the Control B register (CTRLB.CSMODE) to 0x1 is not mandatory. However, it may happen that when other DMA channels connected to other peripherals are in use as well, the QSPI DMA could be delayed by another DMA transfer with a higher priority on the bus. Having DMA buffers in slower memories, like Flash memory or SDRAM (compared to fast internal SRAM), may lengthen the reload time of the TXDATA by the DMA as well. This means that TXDATA might not be reloaded in time to keep the Chip Select line low. In this case, the Chip Select line may toggle between data transfer and some SPI Client devices, and the communication might get lost. Writing CTRLB.CSMODE=0x1 can prevent this loss. When CTRLB.CSMODE=0x0, the CS does not rise in all cases between two transfers on the same peripheral. During a transfer on a Chip Select, the INTFLAG.DRE flag is raised as soon as the content of the TXDATA is transferred into the internal shifter. When this flag is detected, the TXDATA can be reloaded. If this reload occurs before the end of the current transfer and if the next transfer is performed on the same Chip Select as the current transfer, the Chip Select is not de-asserted between the two transfers. This may lead to difficulties for interfacing with some serial peripherals requiring the Chip Select to be de-asserted after each transfer. To facilitate interfacing with such devices, it is recommended to write CTRLB.CSMODE to 0x2. 33.6.7.5 Peripheral Deselection without DMA During multiple data transfers on a Chip Select without the DMA, the TXDATA is loaded by the processor, and the Transmit Data Register Empty flag in the Interrupt Flag Status and Clear register (INTFLAG.DRE) rises as soon as the content of the RXDATA is transferred into the internal shift register. When this flag is detected high, the TXDATA can be reloaded. If this reload-by-processor occurs before the end of the current transfer and if the next transfer is performed on the same Chip Select as the current transfer, the Chip Select is not de-asserted between the two transfers. Depending on the application software handling the flags or servicing other interrupts or other tasks, the processor may not reload the TXDATA in time to keep the Chip Select active (low). A null Delay Between Consecutive Transfer bit field value in the CTRLB register (CTRLB.DLYBCT) will give even less time for the processor to reload the TXDATA. With some SPI client peripherals, requiring the Chip Select line to remain active (low) during a full set of transfers might lead to communication errors. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 687 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... To facilitate interfacing with such devices, the Chip Select Mode bit field in the CTRLB register (CTRLB.CSMODE) can be written to 0x1. This allows the Chip Select lines to remain in their current state (low = active) until the end of transfer is indicated by the Last Transfer bit in the CTRLA register (CTRLA.LASTXFER). Even if the TXDATA is not reloaded, the Chip Select will remain active. To have the Chip Select line rise at the end of the last data transfer, the LASTXFER bit in the CTRLA must be set before writing the last data to transmit into the TXDATA. 33.6.8 QSPI Serial Memory Mode In this mode the QSPI acts as a serial Flash memory controller. The QSPI can be used to read data from the serial Flash memory allowing the CPU to execute code from it (XIP execute in place). The QSPI can also be used to control the serial Flash memory (Program, Erase, Lock, and so on) by sending specific commands. In this mode, the QSPI is compatible with single-bit SPI, Dual-SPI and Quad-SPI protocols. To activate this mode, the MODE bit in Control B register must be set to one (CTRLB.MODE = 1). In serial memory mode, data cannot be transferred by the TXDATA and the RXDATA, but by writing or reading the QSPI memory space (0x0400 0000 0x0500 0000). Important:QSPI memory space region can be cached to improve data transfer speed. However, external Flash devices which have command/status registers mapped in the QSPI memory space region must be managed carefully by applying any one of the following configurations:
Data cache must be disabled. If data cache is required, then cache line must be invalidated before reading the status register. 33.6.8.1 Instruction Frame In order to control serial Flash memories, the QSPI is able to sent instructions by the SPI bus (ex: READ, PROGRAM, ERASE, LOCK, etc.). Because instruction set implemented in serial Flash memories is memory vendor dependent, the QSPI includes a complete instruction registers, which makes it very flexible and compatible with all serial Flash memories. An instruction frame includes:
An instruction code (size: 8 bits): The instruction can be optional in some cases An address (size: 24 bits or 32 bits): The address is optional but is required by instructions such as READ, PROGRAM, ERASE, LOCK. By default the address is 24 bits long, but it can be 32 bits long to support serial Flash memories larger than 128 Mbit (16 Mbyte). An option code (size: 1/2/4/8 bits): The option code is optional but is useful for activate the XIP mode or the Continuous Read Mode for READ instructions, in some serial Flash memory devices. These modes allow to improve the data read latency. Dummy cycles: Dummy cycles are optional but required by some READ instructions Data bytes are optional: Data bytes are present for data transfer instructions such as READ or PROGRAM The instruction code, the address/option and the data can be sent with Single-bit SPI, Dual SPI or Quad SPI protocols. Figure 33-9. Instruction Frame CS SCK DATA0 DATA1 DATA2 DATA3 A20 A16 A12 A8 A4 A0 O4 O0 D4 D0 D4 D0 A21 A17 A13 A9 A5 A1 O5 O1 D5 D1 D5 D1 A22 A18 A14 A10 A6 A2 O6 O2 D6 D2 D6 D2 Instruction EBh Address Option Dummy cycles Data A23 A19 A15 A11 A7 A3 O7 O3 D7 D3 D7 D3 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 688 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.6.8.2 Instruction Frame Sending To send an instruction frame, the user must first configure the address to send by writing the field ADDR in the Instruction Address Register (INSTRADDR.ADDR). This step is required if the instruction frame includes an address and no data. When data is present, the address of the instruction is defined by the address of the data accesses in the QSPI memory space, and not by the INSTRADDR register. If the instruction frame includes the instruction code and/or the option code, the user must configure the instruction code and/or the option code to send by writing the fields INST and OPTCODE bit fields in the Instruction Control Register (INSTRCTRL.OPTCODE, INSTRCTRL.INSTR). Then, the user must write the Instruction Frame Register (INSTRFRAME) to configure the instruction frame depending on which instruction must be sent. If the instruction frame does not include data, writing in this register triggers the send of the instruction frame in the QSPI. If the instruction frame includes data, the send of the instruction frame is triggered by the first data access in the QSPI memory space. The instruction frame is configured by the following bits and fields of INSTRFRAME:
WIDTH field is used to configure which data lanes are used to send the instruction code, the address, the option code and to transfer the data. It is possible to use two unidirectional data lanes (MISO-MOSI Single-bit SPI), two bidirectional data lanes (DATA0 - DATA1 Dual SPI) or four bidirectional data lanes (DATA0 - DATA3). Table 33-3. WIDTH Encoding INSTRFRAME Instruction Address/Option Data 0 1 2 3 4 5 6 7 Single-bit SPI Single-bit SPI Single-bit SPI Single-bit SPI Single-bit SPI Dual SPI Quad SPI Reserved Single-bit SPI Single-bit SPI Single-bit SPI Dual SPI Quad SPI Dual SPI Quad SPI Single-bit SPI Dual SPI Quad SPI Dual SPI Quad SPI Dual SPI Quad SPI INSTREN bit enables sending an instruction code ADDREN bit enables sending of an address after the instruction code OPTCODEEN bit enables sending of an option code after the address DATAEN bit enables the transfer of data (READ or PROGRAM instruction) OPTCODELEN field configures the option code length (0 -> 1-bit / 1 -> 2-bit / 2 -> 4-bit / 3 -> 8-bit). The value written in OPTCODELEN must be consistent with value written in the field WIDTH. For example: OPTCODELEN
= 0 (1-bit option code) is not coherent with WIDTH = 6 (option code sent with QuadSPI protocol, thus the minimum length of the option code is 4-bit). ADDRLEN bit configures the address length (0 -> 24 bits / 1-> 32 bits) TFRTYPE field defines which type of data transfer must be performed DUMMYLEN field configures the number of dummy cycles when reading data from the serial Flash memory. Between the address/option and the data, with some instructions, dummy cycles are inserted by the serial Flash memory. If data transfer is enabled, the user can access the serial memory by reading or writing the QSPI memory space following these rules:
Reading from the serial memory, but not memory data (for example reading the JEDEC-ID or the STATUS), requires TFRTYPE to be written to 0x0 Reading from the serial memory, and particularly memory data, requires TFRTYPE to be written to '1'
Writing to the serial memory, but not memory data (for example writing the configuration or STATUS), requires TFRTYPE to be written to 0x2 Writing to the serial memory, and particularly memory data, requires TFRTYPE to be written to 0x3 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 689 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... If TFRTYP has a value other than 0x1 and CTRLB.SMEMREG=0, the address sent in the instruction frame is the address of the first system bus accesses. The addresses of the subsequent access actions are not used by the QSPI. At each system bus access, an SPI transfer is performed with the same size. For example, a half-word system bus access leads to a 16-bit SPI transfer, and a byte system bus access leads to an 8-bit SPI transfer. If CTRLB.SMEMREG=1, accesses are made via the QSPI registers and the address sent in the instruction frame is the address defined in the INSTRADDR register. Each time the INSTRFRAME or TXDATA registers are written, an SPI transfer is performed with a byte size. Another byte is read each time RXDATA register is read or written each time TXDATA register is written. The SPI transfer ends by writing the LASTXFER bit in Control A register
(CTRLA.LASTXFER). If TFRTYP=0x1, the address of the first instruction frame is the one of the first read access in the QSPI memory space. Each time the read accesses become non-sequential (addresses are not consecutive), a new instruction frame is sent with the last system bus access address. In this way, the system can read data at a random location in the serial memory. The size of the SPI transfers may differ from the size of the system bus read accesses. When data transfer is not enabled, the end of the instruction frame is indicated when the INSTREND interrupt flag in the INTFLAG register is set. When data transfer is enabled, the user must indicate when data transfer is completed in the QSPI memory space by setting the bit LASTXFR in the CTRLA. The end of the instruction frame is indicated when the INSTREND interrupt flag in the INTFLAG register is set. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 690 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Figure 33-10. Instruction Transmission Flow Diagram START No Instruction frame with address but no data
Yes Write the address in INSTRADDR No Instruction frame with instruction code and/or option code
Yes Write the instruction code and/or the option code in INSTRCTRL Configure and send instruction frame by writing INSTRFRAME No Instruction frame with data
Yes Read INSTRFRAME to synchronize APB and AHB accesses No No Instruction frame with address
Yes Read memory transfer
(TFRTYP = 1)
Yes Read DATA in the QSPI AHB memory space. If accesses are not sequential a new instruction is sent automatically. Read/Write DATA in the QSPI AHB memory space
(SMEMREG = 0) or APB register space (SMEMREG = 1). The address of the first access is sent after the instruction code. Read/Write DATA in the QSPI AHB memory space. Address of accesses are not used by the QSPI. Write CTRLA.LASTXFR to 1 when all data have been transferred. Wait for INTFLAG.INSTREND to rise by polling or interrupt. Depending on CSMODE configuration wait for INTFLAG.CSRISE to rise by polling or interrupt. END 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 691 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.6.8.3 Read Memory Transfer The user can access the data of the serial memory by sending an instruction with DATAEN=1 and TFRTYP=0x1 in the Instruction Frame register (INSTRFRAME). In this mode the QSPI is able to read data at random address into the serial Flash memory, allowing the CPU to execute code directly from it (XIP execute-in-place). In order to fetch data, the user must first configure the instruction frame by writing the INSTRFRAME. Then data can be read at any address in the QSPI address space mapping. The address of the system bus read accesses match the address of the data inside the serial Flash memory. When Fetch Mode is enabled, several instruction frames can be sent before writing the bit LASTXFR in the CTRLA. Each time the system bus read accesses become non-sequential (addresses are not consecutive), a new instruction frame is sent with the corresponding address. 33.6.8.4 Continuous Read Mode The QSPI is compatible with Continuous Read Mode (CRM) which is implemented in some Serial Flash memories. The CRM allows to reduce the instruction overhead by excluding the instruction code from the instruction frame. When CRM is activated in a Serial Flash memory (by a specific option code), the instruction code is stored in the memory. For the next instruction frames, the instruction code is not required, as the memory uses the stored one. In the QSPI, CRM is used when reading data from the memory (INSTFRAME.TFRTYPE=0x1). The addresses of the system bus read accesses are often non-sequential, this leads to many instruction frames with always the same instruction code. By disabling the sending of the instruction code, the CRM reduces the access time of the data. To be functional, this mode must be enabled in both the QSPI and the Serial Flash memory. The CRM is enabled in the QSPI by setting the CRM bit in the INSTRFRAME register (INSTFRAME.CRMODE=1, INSTFRAME.TFRTYPE must be 0x1). The CRM is enabled in the Serial Flash memory by sending a specific option code. CAUTION If CRM is not supported by the Serial Flash memory or disabled, the CRMODE bit must not be set. Otherwise, data read out the Serial Flash memory is not valid. Figure 33-11. Continuous Read Mode CS SCK DATA0 DATA1 DATA2 DATA3 A20 A16 A12 A8 A4 A0 O4 O0 D4 D0 D4 D0 A20 A16 A12 A8 A4 A0 O4 O0 A21 A17 A13 A9 A5 A1 O5 O1 D5 D1 D5 D1 A21 A17 A13 A9 A5 A1 O5 O1 A22 A18 A14 A10 A6 A2 O6 O2 D6 D2 D6 D2 A22 A18 A14 A10 A6 A2 O6 O2 A23 A19 A15 A11 A7 A3 O7 O3 D7 D3 D7 D3 A23 A19 A15 A11 A7 A3 O7 O3 D4 D0 D5 D1 D6 D2 D7 D3 Instruction Address Option to activate the Continuous Read Mode in the serial flash memory Data Address Instruction code is not required Option Data 33.6.8.5 Instruction Frame Transmission Examples All waveforms in the following examples describe SPI transfers in SPI Clock mode 0 (BAUD.CPOL=0 and BAUD.CPHA=0). All system bus accesses described below refer to the system bus address phase. System bus wait cycles and system bus data phases are not shown. Example 33-1.Example 1 Instruction in Single-bit SPI, without address, without option, without data. Command: CHIP ERASE (C7h). Write 0x0000_00C7 to INSTRCTRL register Write 0x0000_0010 to INSTRFRAME register Wait for INTFLAG.INSTREND to rise 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 692 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Figure 33-12. Instruction Transmission Waveform 1 Write INSTRFRAME CS SCK MOSI / DATA0 INTFLAG.INSTREND Instruction C7h Example 33-2.Example 2 Instruction in Quad SPI, without address, without option, without data. Command: POWER DOWN (B9h) Write 0x0000_00B9 to INSTRCTRL register Write 0x0000_0016 to INSTRFRAME register Wait for INTFLAG.INSTREND to rise Figure 33-13. Instruction Transmission Waveform 2 Write INSTRFRAME CS SCK DATA0 DATA1 DATA2 DATA3 INTFLAG.INSTREND Instruction B9h Example 33-3.Example 3 Instruction in Single-bit SPI, with address in Single-bit SPI, without option, without data. Command: BLOCK ERASE (20h) Write the address (of the block to erase) to QSPI_AR Write 0x0000_0020 to INSTRCTRL register Write 0x0000_0030 toINSTRFRAME register Wait for INTFLAG.INSTREND to rise Figure 33-14. Instruction Transmission Waveform 3 Write INSTRADDR Write INSTRFRAME CS SCK MOSI / DATA0 INTFLAG.INSTREND Instruction 20h Address A23 A22 A21 A20 A3 A2 A1 A0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 693 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Example 33-4.Example 4 Instruction in Single-bit SPI, without address, without option, with data write in Single-bit SPI. Command: SET BURST (77h) Write 0x0000_0077 to INSTRCTRL register. Write 0x0000_2090 to INSTRFRAME register. Read INSTRFRAME register (dummy read) to synchronize system bus accesses. Write data to the system bus memory space (0x0400_00000x0500_0000). The address of the system bus write accesses is not used. Write the LASTXFR bit in CTRLA register to '1'. Wait for INTFLAG.INSTREND to rise. Figure 33-15. Instruction Transmission Waveform 4 Write INSTRFRAME CS SCK MOSI / DATA0 INTFLAG.INSTREND Write AHB Set CTRLA.LASTXFER Instruction 77h Data D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0 Example 33-5.Example 5 Instruction in Single-bit SPI, with address in Dual SPI, without option, with data write in Dual SPI. Command: BYTE/PAGE PROGRAM (02h) Write 0x0000_0002 to INSTRCTRL register. Write 0x0000_30B3 to INSTRFRAME register. Read INSTRFRAME register (dummy read) to synchronize system bus accesses. Write data to the QSPI system bus memory space (0x040 000000x0500_0000). The address of the first system bus write access is sent in the instruction frame. The address of the next system bus write accesses is not used. Write LASTXFR bit in CTRLA register to '1'. Wait for INTFLAG.INSTREND to rise. Figure 33-16. Instruction Transmission Waveform 5 Write INSTRFRAME CS SCK DATA0 DATA1 INTFLAG.INSTREND Write AHB Set CTRLA.LASTXFER A22 A20 A18 A16 A14 A12 A10 A8 A6 A4 A2 A0 D6 D4 D2 D0 D6 D4 D2 D0 Instruction 02h Address Data A23 A21 A19 A17 A15 A13 A11 A9 A7 A5 A3 A1 D7 D5 D3 D1 D7 D5 D3 D1 Example 33-6.Example 6 Instruction in Single-bit SPI, with address in Single-bit SPI, without option, with data read in Quad SPI, with eight dummy cycles. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 694 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Command: QUAD_OUTPUT READ ARRAY (6Bh) Write 0x0000_006B to INSTRCTRL register. Write 0x0008_10B2 ti INSTRFRAME register. Read QSPI_IR (dummy read) to synchronize system bus accesses. Read data from the QSPI system bus memory space (0x040 000000x0500_0000). The address of the first system bus read access is sent in the instruction frame. The address of the next system bus read accesses is not used. Write the LASTXFR bit in CTRLA register to '1'. Wait for INTFLAG.INSTREND to rise. Figure 33-17. Instruction Transmission Waveform 6 Write INSTRFRAME C S SCK DATA0 DATA1 DATA2 DATA3 INTFLAG.INSTREND Read AHB Set CTRLA.LASTXFER A23 A22 A21 A20 A3 A2 A1 A0 D4 D0 D4 D0 D5 D1 D5 D1 D6 D2 D6 D2 D7 D3 D7 D3 Instruction 6Bh Address Dummy cycles Data Example 33-7.Example 7 Instruction in Single-bit SPI, with address and option in Quad SPI, with data read from Quad SPI, with four dummy cycles, with fetch and continuous read. Command: FAST READ QUAD I/O (EBh) - 8-BIT OPTION (0x30h) Write 0x0030_00EB to INSTRCTRL register. Write 0x0004_33F4 to INSTRFRAME register. Read INSTRFRAME register (dummy read) to synchronize system bus accesses. Read data from the QSPI system bus memory space (0x040 000000x0500_0000). Fetch is enabled, the address of the system bus read accesses is always used. Write LASTXFR bit in CTRLA register to '1'. Wait for INTFLAG.INSTREND to rise. Figure 33-18. Instruction Transmission Waveform 7 Write INSTRFRAME C S SCK DATA0 DATA1 DATA2 DATA3 Read AHB A20 A16 A12 A8 A4 A0 O4 O0 D4 D0 D4 D0 A20 A16 A12 A8 A4 A0 O4 O0 A21 A17 A13 A9 A5 A1 O5 O1 D5 D1 D5 D1 A21 A17 A13 A9 A5 A1 O5 O1 A22 A18 A14 A10 A6 A2 O6 O2 D6 D2 D6 D2 A22 A18 A14 A10 A6 A2 O6 O2 A23 A19 A15 A11 A7 A3 O7 O3 D7 D3 D7 D3 A23 A19 A15 A11 A7 A3 O7 O3 D4 D0 D5 D1 D6 D2 D7 D3 Instruction EBh Address Option Dummy cycles Data Address Option Dummy cycles Data Example 33-8.Example 8 Instruction in Quad SPI, with address in Quad SPI, without option, with data read from Quad SPI, with two dummy cycles, with fetch. Command: HIGH-SPEED READ (0Bh) Write 0x0000_000B to INSTRCTRL register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 695 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Write 0x0002_20B6 to INSTRFRAME register. Read INSTRFRAME register (dummy read) to synchronize system bus accesses. Read data in the QSPI system bus memory space (0x040 000000x0500_0000). Fetch is enabled, the address of the system bus read accesses is always used. Write LASTXFR bit in CTRLA register to '1'. Wait for INTFLAG.INSTREND to rise. Figure 33-19. Instruction Transmission Waveform 8 Write INSTRFRAME C S SCK DATA0 DATA1 DATA2 DATA3 R e a d A H B A20 A16 A12 A8 A4 A0 D4 D0 D4 D0 A20 A16 A12 A8 A4 A0 D4 D0 A21 A17 A13 A9 A5 A1 D5 D1 D5 D1 A21 A17 A13 A9 A5 A1 D5 D1 A22 A18 A14 A10 A6 A2 D6 D2 D6 D2 A22 A18 A14 A10 A6 A2 D6 D2 A23 A19 A15 A11 A7 A3 D7 D3 D7 D3 A23 A19 A15 A11 A7 A3 D7 D3 Instruction 0Bh Address Dummy cycles Data Instruction 0Bh Address Dummy cycles Data 33.6.9 Scrambling/Unscrambling Function The scrambling/unscrambling function cannot be performed on devices other than memories. Data is scrambled when written to memory and unscrambled when data is read. The external data lines can be scrambled to prevent intellectual property data located in off-chip memories from being easily recovered by analyzing data at the package pin level of either the micro-controller or the QSPI client device (e.g., memory). The scrambling/unscrambling function can be enabled by writing a 1 to the ENABLE bit in the Scrambling Control register (SCRAMBCTRL.ENABLE). The scrambling and unscrambling are performed on-the-fly without impacting the throughput. The scrambling method depends on the user-configurable Scrambling User Key in the Scrambling Key register
(SCRAMBKEY.KEY). This register is only accessible in Write mode. By default, the scrambling and unscrambling algorithm includes the scrambling user key, plus a device-dependent random value. This random value is not included when the Scrambling/Unscrambling Random Value Disable bit in the Scrambling Mode register (SCRAMBCTRL.RANDOMDIS) is written to 1. The random value is neither user-configurable nor readable. If SCRAMBCTRL.RANDOMDIS=0, data scrambled by a given circuit cannot be unscrambled by a different circuit. If SCRAMBCTRL.RANDOMDIS=1, the scrambling/unscrambling algorithm includes only the scrambling user key, making it possible to manage data by different circuits. The scrambling user key must be securely stored in a reliable Non-Volatile Memory to recover data from the off-chip memory. Any data scrambled with a given key cannot be recovered if the key is lost. 33.6.10 DMA Operation The QSPI generates the following DMA requests:
Data received (RX): The request is set when data is available in the RXDATA register, and cleared when RXDATA is read. Data transmit (TX): The request is set when the transmit buffer (TXDATA) is empty, and cleared when TXDATA is written. Note:If DMA and RX memory modes are selected, a QSPI memory space read operation is required to force the first triggering. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 696 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... If the CPU accesses the registers which are source of DMA request set/clear condition, the DMA request can be lost or the DMA transfer can be corrupted. 33.6.11 Interrupts The QSPI has the following interrupt source:
Interrupt Request (INTREQ): Indicates that at least one bit in the Interrupt Flag Status and Clear register
(INTFLAG) is set to '1'. Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear
(INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a '1' to the corresponding bit in the Interrupt Enable Set (INTENSET) register, and disabled by writing a '1' to the corresponding bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt flag is cleared, the interrupt is disabled, or the QSPI is reset. All interrupt requests from the peripheral are ORed together on system level to generate one combined interrupt request to the NVIC. The user must read the INTFLAG register to determine which interrupt condition is present. Note that interrupts must be globally enabled for interrupt requests to be generated. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 697 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.7 Register Summary Offset Name Bit Pos. 7 6 5 4 3 2 1 0 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 0x00 CTRLA 0x04 CTRLB 0x08 BAUD 0x0C RXDATA 0x10 TXDATA 0x14 INTENCLR 0x18 INTENSET 0x1C INTFLAG 0x20 STATUS 0x24
... 0x2F Reserved 0x30 INSTRADDR 0x34 INSTRCTRL 0x38 INSTRFRAME 0x3C
... 0x3F Reserved ENABLE SWRST LASTXFER CSMODE[1:0]
SMEMREG WDRBT LOOPEN MODE DATALEN[3:0]
CPHA CPOL DLYBCT[7:0]
DLYCS[7:0]
BAUD[7:0]
DLYBS[7:0]
DATA[7:0]
DATA[15:8]
DATA[7:0]
DATA[15:8]
ERROR TXC DRE INSTREND ERROR TXC DRE INSTREND ERROR TXC DRE INSTREND RXC CSRISE RXC CSRISE RXC CSRISE ENABLE CSSTATUS ADDR[7:0]
ADDR[15:8]
ADDR[23:16]
ADDR[31:24]
INSTR[7:0]
OPTCODE[7:0]
DATAEN OPTCODEEN ADDREN INSTREN WIDTH[2:0]
DDREN CRMODE TFRTYPE[1:0]
ADDRLEN OPTCODELEN[1:0]
DUMMYLEN[4:0]
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 698 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... ..........continued Offset Name Bit Pos. 7 6 5 4 3 2 1 0 0x40 SCRAMBCTRL 0x44 SCRAMBKEY 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 33.8 Register Description RANDOMDIS ENABLE KEY[7:0]
KEY[15:8]
KEY[23:16]
KEY[31:24]
Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. See Peripheral Access Controller (PAC) from Related Links. Some registers are enable-protected, meaning they can only be written when the QSPI is disabled. Enable-protection is denoted by the Enable-protected property in each individual register description. Related Links 26. Peripheral Access Controller (PAC) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 699 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.1 Control A Name:
Offset:
Reset:
Property:
Control A CTRLA 0x00 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 Access Reset LASTXFER W 0 16 Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 3 2 Access Reset 1 ENABLE W 0 0 SWRST W 0 Bit 24 LASTXFERLast Transfer 0: No effect. 1: The chip select will be de-asserted after the character written in TD has been transferred. Bit 1 ENABLEEnable Writing a '0' to this bit disables the QSPI. Writing a '1' to this bit enables the QSPI to transfer and receive data. As soon as ENABLE is reset, QSPI finishes its transfer. All pins are set in input mode and no data is received or transmitted. If a transfer is in progress, the transfer is finished before the QSPI is disable. Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets the QSPI. A software-triggered hardware reset of the QSPI interface is performed. DMAC channels are not affected by software reset. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 700 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.2 Control B Name:
Offset:
Reset:
Property: PAC Write-Protection CTRLB 0x04 0x00000000 Control B Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset 30 R/W 0 22 R/W 0 14 29 R/W 0 21 R/W 0 13 DLYCS[7:0]
28 R/W 0 20 27 R/W 0 19 DLYBCT[7:0]
R/W 0 12 R/W 0 11 R/W 0 3 SMEMREG R/W 0 26 R/W 0 18 R/W 0 10 25 R/W 0 17 R/W 0 9 DATALEN[3:0]
R/W 0 2 WDRBT R/W 0 R/W 0 1 LOOPEN R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 MODE R/W 0 Bit 7 6 5 4 Access Reset CSMODE[1:0]
R/W 0 R/W 0 Bits 31:24 DLYCS[7:0]Minimum Inactive CS Delay This bit field defines the minimum delay between the inactivation and the activation of CS. The DLYCS time guarantees the client minimum deselect time. If DLYCS is 0x00, one CLK_QSPI_AHB period will be inserted by default. Otherwise, the following equation determines the delay:
DLYCS = Minimum inactive fperipheral clock Bits 23:16 DLYBCT[7:0]Delay Between Consecutive Transfers This field defines the delay between two consecutive transfers with the same peripheral without removing the chip select. The delay is always inserted after each transfer and before removing the chip select if needed. When DLYBCT=0x00, no delay between consecutive transfers is inserted and the clock keeps its duty cycle over the character transfers. In Serial Memory mode (MODE=1), DLYBCT is ignored and no delay is inserted. Otherwise, the following equation determines the delay:
DLYBCT = (Delay Between Consecutive Transfers fperipheral clock) / 32 Bits 11:8 DATALEN[3:0]Data Length The DATALEN field determines the number of data bits transferred. Reserved values must not be used. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9-0xF Description 8-bits transfer 9-bits transfer 10-bits transfer 11-bits transfer 12-bits transfer 13-bits transfer 14-bits transfer 15-bits transfer 16-bits transfer Reserved Name 8BITS 9BITS 10BITS 11BITS 12BITS 13BITS 14BITS 15BITS 16BITS 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 701 Bits 5:4 CSMODE[1:0]Chip Select Mode PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... The CSMODE field determines how the chip select is de-asserted. Value 0x0 Name NORELOAD Description The chip select is de-asserted if TD has not been reloaded before the end of the current transfer. The chip select is de-asserted when the bit LASTXFER is written at 1 and the character written in TD has been transferred. SYSTEMATICALLY The chip select is de-asserted systematically after each transfer. LASTXFER 0x1 0x2 0x3 Reserved Bit 3 SMEMREGSerial Memory Register Mode Value 0 1 Description Serial memory registers are written via AHB access. Serial memory registers are written via APB access. Reset the QSPI. Bit 2 WDRBTWait Data Read Before Transfer This bit determines the Wait Data Read Before Transfer option. Bit 1 LOOPENLocal Loopback Enable This bit defines if the Local Loopback is enabled or disabled. LOOPEN controls the local loopback on the data serializer for testing in SPI Mode only. (MISO is internally connected on MOSI). Value 0 1 Description Local Loopback is disabled. Local Loopback is enabled. Bit 0 MODESerial Memory Mode This bit defines if the QSPI is in SPI Mode or Serial Memory Mode. Value 0 1 Description SPI operating mode Serial Memory operating mode Name SPI MEMORY 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 702 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.3 Baud Rate Name:
Offset:
Reset:
Property: PAC Write-Protection BAUD 0x08 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset 22 R/W 0 14 R/W 0 6 21 R/W 0 13 R/W 0 5 DLYBS[7:0]
BAUD[7:0]
20 R/W 0 12 R/W 0 4 19 R/W 0 11 R/W 0 3 18 R/W 0 10 R/W 0 2 17 R/W 0 9 R/W 0 1 CPHA R/W 0 16 R/W 0 8 R/W 0 0 CPOL R/W 0 Bits 23:16 DLYBS[7:0]Delay Before SCK This field defines the delay from CS valid to the first valid SCK transition. When DLYBS equals zero, the CS valid to SCK transition is 1/2 the SCK clock period. Otherwise, the following equation determines the delay:
Equation 33-1.Delay Before SCK Delay Before SCK =
Bits 15:8 BAUD[7:0]Serial Clock Baud Rate DLYBS MCK The QSPI uses a modulus counter to derive the SCK baud rate from the module clock (MCK) CLK_QSPI_AHB. The Baud rate is selected by writing a value from 1 to 255 in the BAUD field. The following equation determines the SCK baud rate:
Equation 33-2.SCK Baud Rate SCK Baud Rate =
Bit 1 CPHAClock Phase MCK BAUD + 1 CPHA determines which edge of SCK causes data to change and which edge causes data to be captured. CPHA is used with CPOL to produce the required clock/data relationship between host and client devices. Value 0 1 Description Data is captured on the leading edge of SCK and changed on the following edge of SCK. Data is changed on the leading edge of SCK and captured on the following edge of SCK. Bit 0 CPOLClock Polarity CPOL is used to determine the inactive state value of the serial clock (SCK). It is used with CPHA to produce the required clock/data relationship between host and client devices. Value 0 Description The inactive state value of SCK is logic level zero. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 703 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Value 0 Description The inactive state value of SCK is logic level 'one'. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 704 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.4 Receive Data Name:
Offset:
Reset:
Property:
RXDATA 0x0C 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 Access Reset Bit Access Reset R 0 7 R 0 14 R 0 6 R 0 13 R 0 5 R 0 DATA[15:8]
DATA[7:0]
12 R 0 4 R 0 11 R 0 3 R 0 10 R 0 2 R 0 9 R 0 1 R 0 8 R 0 0 R 0 Bits 15:0 DATA[15:0]Receive Data Data received by the QSPI is stored in this register right-justified. Unused bits read zero. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 705 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.5 Transmit Data Name:
Offset:
Reset:
Property:
TXDATA 0x10 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 Access Reset Bit Access Reset W 0 7 W 0 14 W 0 6 W 0 13 W 0 5 W 0 DATA[15:8]
DATA[7:0]
12 W 0 4 W 0 11 W 0 3 W 0 10 W 0 2 W 0 9 W 0 1 W 0 8 W 0 0 W 0 Bits 15:0 DATA[15:0]Transmit Data Data to be transmitted by the QSPI is stored in this register. Information to be transmitted must be written to the transmit data register in a right-justified format. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 706 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.6 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x14 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 Access Reset 10 INSTREND R/W 0 Bit 7 6 5 4 Access Reset 3 ERROR R/W 0 2 TXC R/W 0 9 1 DRE R/W 0 8 CSRISE R/W 0 0 RXC R/W 0 Bit 10 INSTRENDInstruction End Interrupt Disable Writing a '0' to this bit has no effect. Writing a '1' will clear the corresponding interrupt request. Value 0 1 Description The INSTREND interrupt is disabled. The INSTREND interrupt is enabled. Bit 8 CSRISEChip Select Rise Interrupt Disable Writing a '0' to this bit has no effect. Writing a '1' will clear the corresponding interrupt request. Value 0 1 Description The CSRISE interrupt is disabled. The CSRISE interrupt is enabled. Bit 3 ERROROverrun Error Interrupt Disable Writing a '0' to this bit has no effect. Writing a '1' will clear the corresponding interrupt request. Value 0 1 Description The ERROR interrupt is disabled. The ERROR interrupt is enabled. Bit 2 TXCTransmission Complete Interrupt Disable Writing a '0' to this bit has no effect. Writing a '1' will clear the corresponding interrupt request. Value 0 1 Description The TXC interrupt is disabled. The TXC interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 707 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Bit 1 DRETransmit Data Register Empty Interrupt Disable Writing a '0' to this bit has no effect. Writing a '1' will clear the corresponding interrupt request. Value 0 1 Description The DRE interrupt is disabled. The DRE interrupt is enabled. Bit 0 RXCReceive Data Register Full Interrupt Disable Writing a '0' to this bit has no effect. Writing a '1' will clear the corresponding interrupt request. Value 0 1 Description The RXC interrupt is disabled. The RXC interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 708 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.7 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x18 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 Access Reset 10 INSTREND R/W 0 Bit 7 6 5 4 Access Reset 3 ERROR R/W 0 2 TXC R/W 0 9 1 DRE R/W 0 8 CSRISE R/W 0 0 RXC R/W 0 Bit 10 INSTRENDInstruction End Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' will set the corresponding interrupt request. Value 0 1 Description The INSTREND interrupt is disabled. The INSTREND interrupt is enabled. Bit 8 CSRISEChip Select Rise Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' will set the corresponding interrupt request. Value 0 1 Description The CSRISE interrupt is disabled. The CSRISE interrupt is enabled. Bit 3 ERROROverrun Error Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' will set the corresponding interrupt request. Value 0 1 Description The ERROR interrupt is disabled. The ERROR interrupt is enabled. Bit 2 TXCTransmission Complete Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' will set the corresponding interrupt request. Value 0 1 Description The TXC interrupt is disabled. The TXC interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 709 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Bit 1 DRETransmit Data Register Empty Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' will set the corresponding interrupt request. Value 0 1 Description The DRE interrupt is disabled. The DRE interrupt is enabled. Bit 0 RXCReceive Data Register Full Interrupt Enable Writing a '0' to this bit has no effect. Writing a '1' will set the corresponding interrupt request. Value 0 1 Description The RXC interrupt is disabled. The RXC interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 710 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.8 Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
INTFLAG 0x1C 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 Access Reset 10 INSTREND R/W 0 Bit 7 6 5 4 Access Reset 3 ERROR R/W 0 2 TXC R/W 0 9 1 DRE R/W 0 8 CSRISE R/W 0 0 RXC R/W 0 Bit 10 INSTRENDInstruction End This bit is set when an Instruction End has been detected. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the flag. Bit 8 CSRISEChip Select Rise The bit is set when a Chip Select Rise has been detected. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the flag. Bit 3 ERROROverrun Error This bit is set when an ERROR has occurred. An ERROR occurs when RXDATA is loaded at least twice from the serializer. Writing a '0' to this bit has no effect. Writing a '1' to this bit will clear the flag. Bit 2 TXCTransmission Complete 0: As soon as data is written in TXDATA. 1: TXDATA and internal shifter are empty. If a transfer delay has been defined, TXC is set after the completion of such delay. Bit 1 DRETransmit Data Register Empty 0: Data has been written to TXDATA and not yet transferred to the serializer. 1: The last data written in the TXDATA has been transferred to the serializer. This bit is '0' when the QSPI is disabled or at reset. The bit is set as soon as ENABLE bit is set. Bit 0 RXCReceive Data Register Full 0: No data has been received since the last read of RXDATA. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 711 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 1: Data has been received and the received data has been transferred from the serializer to RXDATA since the last read of RXDATA. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 712 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.9 Status Name:
Offset:
Reset:
Property:
STATUS 0x20 0x00000200
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 Access Reset Bit 7 6 5 4 3 2 Access Reset Bit 9 CSSTATUSChip Select Value 0 1 Description Chip Select is asserted. Chip Select is not asserted. Bit 1 ENABLEEnable Value 0 1 Description QSPI is disabled. QSPI is enabled. 8 0 9 CSSTATUS R 1 1 ENABLE R 0 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 713 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.10 Instruction Address Name:
Offset:
Reset:
Property:
INSTRADDR 0x30 0x00000000
Bit 31 Access Reset R/W 0 Bit 23 Access Reset R/W 0 Bit 15 Access Reset R/W 0 Bit 7 Access Reset R/W 0 30 R/W 0 22 R/W 0 14 R/W 0 6 R/W 0 29 R/W 0 21 R/W 0 13 R/W 0 5 R/W 0 28 27 ADDR[31:24]
R/W 0 20 R/W 0 19 ADDR[23:16]
R/W 0 12 R/W 0 4 R/W 0 ADDR[15:8]
ADDR[7:0]
R/W 0 11 R/W 0 3 R/W 0 26 R/W 0 18 R/W 0 10 R/W 0 2 R/W 0 25 R/W 0 17 R/W 0 9 R/W 0 1 R/W 0 24 R/W 0 16 R/W 0 8 R/W 0 0 R/W 0 Bits 31:0 ADDR[31:0]Instruction Address Address to send to the serial Flash memory in the instruction frame. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 714 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.11 Instruction Code Name:
Offset:
Reset:
Property:
INSTRCTRL 0x34 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 Access Reset R/W 0 Bit 15 Access Reset Bit 7 Access Reset R/W 0 22 R/W 0 14 6 R/W 0 21 R/W 0 13 5 R/W 0 20 19 OPTCODE[7:0]
R/W 0 12 4 R/W 0 INSTR[7:0]
R/W 0 11 3 R/W 0 18 R/W 0 10 2 R/W 0 17 R/W 0 9 1 16 R/W 0 8 0 R/W 0 R/W 0 Bits 23:16 OPTCODE[7:0]Option Code These bits define the option code to send to the serial flash memory. Bits 7:0 INSTR[7:0]Instruction Code Instruction code to send to the serial flash memory. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 715 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.12 Instruction Frame Name:
Offset:
Reset:
Property:
INSTRFRAME 0x38 0x00000000
Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 R/W 0 12 Access Reset Bit Access Reset Bit Access Reset 15 DDREN R/W 0 7 DATAEN R/W 0 14 CRMODE R/W 0 13 TFRTYPE[1:0]
R/W 0 R/W 0 6 OPTCODEEN R/W 0 5 ADDREN R/W 0 4 INSTREN R/W 0 19 R/W 0 11 3 18 DUMMYLEN[4:0]
R/W 0 17 R/W 0 16 R/W 0 10 ADDRLEN R/W 0 8 9 OPTCODELEN[1:0]
R/W R/W 0 0 2 R/W 0 1 WIDTH[2:0]
R/W 0 0 R/W 0 Bits 20:16 DUMMYLEN[4:0]Dummy Cycles Length The DUMMYLEN field defines the number of dummy cycles required by the serial Flash memory before data transfer. Bit 15 DDRENDouble Data Rate Enable Note:Double Data Rate operating is only supported in Read. Value 0 1 Description Double Data Rate operating mode is disabled. Double Data Rate operating mode is enabled. Bit 14 CRMODEContinuous Read Mode This bit defines if the Continuous Read Mode is enabled or disabled. Value 0 1 Description Continuous Read Mode is disabled. Continuous Read Mode is enabled. Bits 13:12 TFRTYPE[1:0]Data Transfer Type These bits define the data type transfer. Value 0x0 Name READ Description Read transfer from the serial memory.Scrambling is not performed.Read at random location (fetch) in the serial flash memory is not possible. 0x1 0x2 0x3 READMEMORY Read data transfer from the serial memory.If enabled, scrambling is WRITE WRITEMEMORY Write data transfer into the serial memory. If enabled, scrambling is performed. performed.Read at random location (fetch) in the serial flash memory is possible. Write transfer into the serial memory.Scrambling is not performed. Bit 10 ADDRLENAddress Length The ADDRLEN bit determines the length of the address. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 716 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... Value 0x0 0x1 Name 24BITS 32BITS Description 24-bits address length 32-bits address length Bits 9:8 OPTCODELEN[1:0]Option Code Length The OPTCODELEN field determines the length of the option code. The value written in OPTCODELEN must be coherent with value written in the field WIDTH. For example: OPTCODELEN=0 (1-bit option code) is not coherent with WIDTH=6 (option code sent with QuadSPI protocol, thus the minimum length of the option code is 4-bit). Value 0x0 0x1 0x2 0x3 Description 1-bit length option code 2-bits length option code 4-bits length option code 8-bits length option code Name 1BIT 2BITS 4BITS 8BITS Bit 7 DATAENData Enable Value 0 1 Description No data is sent/received to/from the serial flash memory. Data is sent/received to/from the serial flash memory. Bit 6 OPTCODEENOption Enable Description The option is not sent to the serial flash memory The option is sent to the serial flash memory. Value 0 1 Bit 5 ADDRENAddress Enable Value 0 1 Description The transfer address is not sent to the serial flash memory. The transfer address is sent to the serial flash memory. Bit 4 INSTRENInstruction Enable Description The instruction is not sent to the serial flash memory. The instruction is sent to the serial flash memory. Value 0 1 Bits 2:0 WIDTH[2:0]Instruction Code, Address, Option Code and Data Width This field defines the width of the instruction code, the address, the option and the data. Value 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 Description Instruction: Single-bit SPI / Address-Option: Single-bit SPI / Data: Single-bit SPI Instruction: Single-bit SPI / Address-Option: Single-bit SPI / Data: Dual SPI Instruction: Single-bit SPI / Address-Option: Single-bit SPI / Data: Quad SPI Instruction: Single-bit SPI / Address-Option: Dual SPI / Data: Dual SPI Instruction: Single-bit SPI / Address-Option: Quad SPI / Data: Quad SPI Instruction: Dual SPI / Address-Option: Dual SPI / Data: Dual SPI Instruction: Quad SPI / Address-Option: Quad SPI / Data: Quad SPI Reserved Name SINGLE_BIT_SPI DUAL_OUTPUT QUAD_OUTPUT DUAL_IO QUAD_IO DUAL_CMD QUAD_CMD 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 717 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 33.8.13 Scrambling Mode Name:
Offset:
Reset:
Property: PAC Write-Protection SCRAMBCTRL 0x40 0x00000000 Bit 31 30 29 28 27 26 25 24 Access Reset Bit 23 22 21 20 19 18 17 16 Access Reset Bit 15 14 13 12 11 10 9 8 Access Reset Bit 7 6 5 4 3 2 Access Reset 1 RANDOMDIS R/W 0 0 ENABLE R/W 0 Bit 1 RANDOMDISScrambling/Unscrambling Random Value Disable Value 0 1 Description The scrambling/unscrambling algorithm includes the scrambling user key plus a random value that may differ from chip to chip. The scrambling/unscrambling algorithm includes only the scrambling user key. Bit 0 ENABLEScrambling/Unscrambling Enable This bit defines if the scrambling/unscrambling is enabled or disabled. Value 0 1 Description Scrambling/unscrambling is disabled. Scrambling/unscrambling is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 718 PIC32CX-BZ2 and WBZ45 Family Quad Serial Peripheral Interface (... 28 W 0 20 W 0 12 W 0 4 W 0 KEY[31:24]
KEY[23:16]
KEY[15:8]
KEY[7:0]
27 W 0 19 W 0 11 W 0 3 W 0 26 W 0 18 W 0 10 W 0 2 W 0 25 W 0 17 W 0 9 W 0 1 W 0 24 W 0 16 W 0 8 W 0 0 W 0 33.8.14 Scrambling Key Name:
Offset:
Reset:
Property: PAC Write-Protection SCRAMBKEY 0x44 0x00000000 Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 W 0 23 W 0 15 W 0 7 W 0 30 W 0 22 W 0 14 W 0 6 W 0 29 W 0 21 W 0 13 W 0 5 W 0 Bits 31:0 KEY[31:0]Scrambling User Key This field defines the user key value. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 719 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) 34. Configurable Custom Logic (CCL) 34.1 Overview The Configurable Custom Logic (CCL) is a programmable logic peripheral which can be connected to the device pins, to events, or to other internal peripherals. This allows the user to eliminate logic gates for simple glue logic functions on the PCB. Each LookUp Table (LUT) consists of three inputs, a truth table, an optional synchronizer/filter, and an optional edge detector. Each LUT can generate an output as a user programmable logic expression with three inputs. Inputs can be individually masked. The output can be combinatorially generated from the inputs, and can be filtered to remove spikes. Optional sequential logic can be used. The inputs of the sequential module are individually controlled by two independent, adjacent LUT (LUT0/LUT1) outputs, enabling complex waveform generation. 34.2 Features Glue logic for general purpose PCB design Two programmable Look-up Tables (LUTs) Combinatorial logic functions: AND, NAND, OR, NOR, XOR, XNOR, NOT Sequential logic functions: Gated D Flip-Flop, JK Flip-Flop, gated D Latch, RS Latch Flexible LUT inputs selection:
I/Os Events Internal peripherals Subsequent LUT output Output can be connected to the I/O pins or the Event System Optional synchronizer, filter or edge detector available on each LUT output 34.3 Block Diagram Figure 34-1. Configurable Custom Logic LUTCTRL0
(INSEL) LUT0 LUTCTRL0
(FILTSEL) LUTCTRL0
(EDGESEL) SEQCTRL
(SEQSEL0) CTRL
(ENABLE) Filter / Synch CLR Edge Detector CLR Sequential CLR Event System OUT0 I/O Internal Events I/O Peripherals Truth Table 8 LUTCTRL0
(ENABLE) D Q CLK_CCL_APB GCLK_CCL LUTCTRL1
(INSEL) Internal Events I/O Peripherals CLK_CCL_APB GCLK_CCL LUT1 LUTCTRL1
(FILTSEL) LUTCTRL1
(EDGESEL) Truth Table 8 Filter / Synch CLR Edge Detector CLR LUTCTRL1
(ENABLE) D Q CTRL
(ENABLE) Event System OUT1 I/O UNIT 0 UNIT 1 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 720 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) 34.4 Signal Description Pin Name OUT[1:0]
IN[5:0]
Type Digital output Digital input Description Output from lookup table Input to lookup table For details on the pin mapping for this peripheral, see I/O Ports and Peripheral Pin Select (PPS) from Related Links. One signal can be mapped on several pins. Related Links 6. I/O Ports and Peripheral Pin Select (PPS) 34.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described below. 34.5.1 I/O Lines The CCL can take inputs and generate output through I/O pins. For this to function properly, the I/O pins must be configured to be used by a Look Up Table (LUT). 34.5.2 Power Management This peripheral can continue to operate in any Sleep mode where its source clock is running. Events connected to the event system can trigger other operations in the system without exiting Sleep modes. 34.5.3 Clocks A generic clock (GCLK_CCL) is optionally required to clock the CCL. This clock must be configured and enabled in the Generic Clock Controller (GCLK) before using input events, filter, edge detection or sequential logic. GCLK_CCL is required when input events, a filter, an edge detector or a sequential sub-module is enabled. This generic clock is asynchronous to the user interface clock (PB2_CLK). 34.5.4 DMA Not applicable. 34.5.5 Interrupts Not applicable. 34.5.6 Events The CCL can use events from other peripherals and generate events that can be used by other peripherals. For this feature to function, the events have to be configured properly. Refer to the Related Links below for more information about the event users and event generators. Related Links 28. Event System (EVSYS) 34.5.7 Debug Operation When the CPU is halted in Debug mode the CCL continues normal operation. However, the CCL cannot be halted when the CPU is halted in Debug mode. If the CCL is configured in a way that requires it to be periodically serviced by the CPU, improper operation or data loss may result during debugging. 34.5.8 Register Access Protection All registers with write access can be write-protected optionally by the Peripheral Access Controller (PAC). See Peripheral Access Controller (PAC) from Related Links. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 721 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. PAC write protection does not apply to accesses through an external debugger. Related Links 26. Peripheral Access Controller (PAC) 34.5.9 Analog Connections Not applicable. 34.6 Functional Description 34.6.1 Principle of Operation Configurable Custom Logic (CCL) is a programmable logic block that can use the device port pins, internal peripherals, and the internal Event System as both input and output channels. The CCL can serve as glue logic between the device and external devices. The CCL can eliminate the need for external logic component and can also help the designer overcome challenging real-time constrains by combining core independent peripherals in clever ways to handle the most time critical parts of the application independent of the CPU. 34.6.2 Operation 34.6.2.1 Initialization The following bits are enable-protected, meaning that they can only be written when the corresponding even LUT is disabled (LUTCTRLx.ENABLE=0):
Sequential Selection bits in the Sequential Control x (SEQCTRLx.SEQSEL) register The following registers are enable-protected, meaning that they can only be written when the corresponding LUT is disabled (LUTCTRLx.ENABLE=0):
LUT Control x (LUTCTRLx) register, except the ENABLE bit Enable-protected bits in the LUTCTRLx registers can be written at the same time as LUTCTRLx.ENABLE is written to
'1', but not at the same time as LUTCTRLx.ENABLE is written to '0'. Enable-protection is denoted by the Enable-Protected property in the register description. 34.6.2.2 Enabling, Disabling, and Resetting The CCL is enabled by writing a '1' to the Enable bit in the Control register (CTRL.ENABLE). The CCL is disabled by writing a '0' to CTRL.ENABLE. Each LUT is enabled by writing a '1' to the Enable bit in the LUT Control x register (LUTCTRLx.ENABLE). Each LUT is disabled by writing a '0' to LUTCTRLx.ENABLE. The CCL is reset by writing a '1' to the Software Reset bit in the Control register (CTRL.SWRST). All registers in the CCL will be reset to their initial state, and the CCL will be disabled. Refer to 34.8.1. CTRL for details. 34.6.2.3 Lookup Table Logic The lookup table in each LUT unit can generate any logic expression OUT as a function of three inputs (IN[2:0]), as shown in Figure 34-2. One or more inputs can be masked. The truth table for the expression is defined by TRUTH bits in LUT Control x register (LUTCTRLx.TRUTH). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 722 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) Figure 34-2. Truth Table Output Value Selection LUT TRUTH[0]
TRUTH[1]
TRUTH[2]
TRUTH[3]
TRUTH[4]
TRUTH[5]
TRUTH[6]
TRUTH[7]
OUT LUTCTRL
(ENABLE) Table 34-1. Truth Table of LUT IN[2:0]
IN[2]
IN[1]
IN[0]
0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 OUT TRUTH[0]
TRUTH[1]
TRUTH[2]
TRUTH[3]
TRUTH[4]
TRUTH[5]
TRUTH[6]
TRUTH[7]
34.6.2.4 Truth Table Inputs Selection Input Overview The inputs can be individually:
Masked Driven by peripherals:
Analog comparator output (AC) Timer/Counters waveform outputs (TC) Serial Communication output transmit interface (SERCOM) Driven by internal events from Event System Driven by other CCL sub-modules The Input Selection for each input y of LUT x is configured by writing the Input y Source Selection bit in the LUT x Control register (LUTCTRLx.INSELy). Masked Inputs (MASK) When a LUT input is masked (LUTCTRLx.INSELy = MASK), the corresponding TRUTH input (IN) is internally tied to zero, as shown in this figure:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 723 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) Figure 34-3. Masked Input Selection Internal Feedback Inputs (FEEDBACK) When selected (LUTCTRLx.INSELy = FEEDBACK), the Sequential (SEQ) output is used as input for the corresponding LUT. The output from an internal sequential sub-module can be used as input source for the LUT, see figure below for an example for LUT0 and LUT1. The sequential selection for each LUT follows the formula:
IN 2N i = SEQ N With N representing the sequencer number and i=0,1,2 representing the LUT input index. IN 2N+1 i = SEQ N See Sequential Logic from Related Links. Figure 34-4. Feedback Input Selection Linked LUT (LINK) When selected (LUTCTRLx.INSELy=LINK), the subsequent LUT output is used as the LUT input (for example, LUT2 is the input for LUT1), as shown in the figure below:
2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 724 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) Figure 34-5. Linked LUT Input Selection LUT0 SEQ 0 CTRL
(ENABLE) LUT1 LUT2 SEQ 1 CTRL
(ENABLE) LUT3 LUT(2n 2) SEQ n CTRL
(ENABLE) LUT(2n-1) Internal Events Inputs Selection (EVENT) Asynchronous events from the Event System can be used as input selection, as shown in the following figure. For each LUT, one event input line is available and can be selected on each LUT input. Before enabling the event selection by writing LUTCTRLx.INSELy=EVENT, the Event System must be configured first. By default, CCL includes an edge detector. When the event is received, an internal strobe is generated when a rising edge is detected. The pulse duration is one GCLK_CCL clock cycle. Writing the LUTCTRLx.INSELy=ASYNCEVENT will disable the edge detector. In this case, it is possible to combine an asynchronous event input with any other input source. This is typically useful with event levels inputs for example, (external I/O pin events). The following steps ensure proper operation:
Enable the GCLK_CCL clock. 1. 2. Configure the Event System to route the event asynchronously. 3. 4. Select the event input type (LUTCTRLx.INSEL = ASYNCEVENT). If a strobe must be generated on the event input falling edge, write a '1' to the Inverted Event Input Enable bit in the LUT Control register (LUTCTRLx.INVEI) . Enable the event input by writing the Event Input Enable bit in the LUT Control register (LUTCTRLx.LUTEI) to
'1'. 5. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 725 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) Figure 34-6. Event Input Selection I/O Pin Inputs (IO) When the I/O pin is selected as LUT input (LUTCTRLx.INSELy = IO), the corresponding LUT input will be connected to the pin, as shown in the figure below. Figure 34-7. I/O Pin Input Selection Analog Comparator Inputs (AC) The AC outputs can be used as input source for the LUT (LUTCTRLx.INSELy=AC). The analog comparator outputs are distributed following the formula:
With N representing the LUT number and i=[0,1,2] representing the LUT input index. IN N i = AC N % ComparatorOutput_Number Before selecting the comparator output, the AC must be configured first. Figure 34-8. AC Input Selection Timer/Counter Inputs (TC) The TC waveform output WO[0] can be used as input source for the LUT (LUTCTRLx.INSELy = TC). Only consecutive instances of the TC, that is, TCx and the subsequent TC(x+1), are available as default and alternative TC selections (for example, TC0 and TC1 are sources for LUT0, TC1 and TC2 are sources for LUT1). See the figure below for an example for LUT0. More general, the Timer/Counter selection for each LUT follows the formula:
IN N i = DefaultTC N % TC_Instance_Number Where N represents the LUT number and i represents the LUT input index (i=0,1,2). IN N i = AlternativeTC N + 1 % TC_Instance_Number Before selecting the waveform outputs, the TC must be configured first. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 726 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) Figure 34-9. TC Input Selection Timer/Counter for Control Application Inputs (TCC) The TCC waveform outputs can be used as input source for the LUT. Only WO[2:0] outputs can be selected and routed to the respective LUT input (that is, IN0 is connected to WO0, IN1 to WO1, and IN2 to WO2), as shown in the figure below. Before selecting the waveform outputs, the TCC must be configured first. Figure 34-10. TCC Input Selection OUT0 Serial Communication Output Transmit Inputs (SERCOM) The serial engine transmitter output from Serial Communication Interface (SERCOM TX, TXd for USART, MOSI for SPI) can be used as input source for the LUT. The figure below shows an example for LUT0 and LUT1. The SERCOM selection for each LUT follows the formula:
With N representing the LUT number and i=0,1,2 representing the LUT input index. IN N i = SERCOM[N % SERCOM_Instance_Number Before selecting the SERCOM as input source, the SERCOM must be configured first: the SERCOM TX signal must be output on SERCOMn/pad[0], which serves as input pad to the CCL. Figure 34-11. SERCOM Input Selection Related Links 34.6.2.7. Sequential Logic 34.6.2.5 Filter By default, the LUT output is a combinatorial function of the LUT inputs. This may cause some short glitches when the inputs change value. These glitches can be removed by clocking through filters, if demanded by application needs. The Filter Selection bits in LUT Control register (LUTCTRLx.FILTSEL) define the synchronizer or digital filter options. When a filter is enabled, the OUT output will be delayed by two to five GCLK cycles. One APB clock after the corresponding LUT is disabled, all internal filter logic is cleared. Note:Events used as LUT input will also be filtered, if the filter is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 727 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) Figure 34-12. Filter FILTSEL OUT D Q D Q D Q G D Q R R R R Input GCLK_CCL CLR 34.6.2.6 Edge Detector The edge detector can be used to generate a pulse when detecting a rising edge on its input. To detect a falling edge, the TRUTH table must be inverted. The edge detector is enabled by writing 1 to the Edge Selection bit in LUT Control register (LUTCTRLx.EDGESEL). In order to avoid unpredictable behavior, either the filter or synchronizer must be enabled. Edge detection is disabled by writing a 0 to LUTCTRLx.EDGESEL. After disabling a LUT, the corresponding internal Edge Detector logic is cleared one APB clock cycle later. Figure 34-13. Edge Detector 34.6.2.7 Sequential Logic Each LUT pair can be connected to the internal sequential logic, which can be configured to work as D flip flop, JK flip flop, gated D-latch or RS-latch by writing the Sequential Selection bits on the corresponding Sequential Control x register (SEQCTRLx.SEQSEL). Before using sequential logic, the GCLK_CCL clock and optionally each LUT filter or edge detector must be enabled. Note:While configuring the sequential logic, the even LUT must be disabled. When configured, the even LUT must be enabled. Gated D Flip-Flop (DFF) When the DFF is selected, the D-input is driven by the even LUT output LUT0, and the G-input is driven by the odd LUT output LUT1, as shown in the following figure. Figure 34-14. D Flip Flop 0 When the even LUT is disabled LUTCTRL0.ENABLE=0, the flip-flop is asynchronously cleared. The reset command
(R) is kept enabled for one APB clock cycle. In all other cases, the flip-flop output (OUT) is refreshed on rising edge of the GCLK_CCL, as shown in the following table. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 728 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) Table 34-2. DFF Characteristics R 1 0 G X 1 0 D X 1 0 X OUT Clear Set Clear Hold state (no change) JK Flip-Flop (JK) When this configuration is selected, the J-input is driven by the even LUT output LUT0, and the K-input is driven by the odd LUT output LUT1, as shown in the following figure. Figure 34-15. JK Flip Flop 0 When the even LUT is disabled LUTCTRL0.ENABLE=0, the flip-flop is asynchronously cleared. The reset command
(R) is kept enabled for one APB clock cycle. In all other cases, the flip-flop output (OUT) is refreshed on rising edge of the GCLK_CCL, as shown in the following table. Table 34-3. JK Characteristics R 1 0 0 0 0 J X 0 0 1 1 K X 0 1 0 1 OUT Clear Hold state (no change) Clear Set Toggle Gated D-Latch (DLATCH) When the DLATCH is selected, the D-input is driven by the even LUT output LUT0, and the G-input is driven by the odd LUT output LUT1, as shown in the following figure. Figure 34-16. D-Latch even LUT odd LUT D G Q OUT When the even LUT is disabled LUTCTRL0.ENABLE=0, the latch output will be cleared. The G-input is forced enabled for one more APB clock cycle, and the D-input to zero. In all other cases, the latch output (OUT) is refreshed as shown in the following table. Table 34-4. D-Latch Characteristics G 0 1 D X 0 OUT Hold state (no change) Clear 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 729 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL)
...........continued G 1 D 1 OUT Set RS Latch (RS) When this configuration is selected, the S-input is driven by the even LUT output LUT0, and the R-input is driven by the odd LUT output LUT1, as shown in the following figure. Figure 34-17. RS-Latch even LUT odd LUT S R Q OUT When the even LUT is disabled LUTCTRL0.ENABLE=0, the latch output will be cleared. The R-input is forced enabled for one more APB clock cycle and S-input to zero. In all other cases, the latch output (OUT) is refreshed as shown in the following table. Table 34-5. RS-Latch Characteristics S 0 0 1 1 R 0 1 0 1 OUT Hold state (no change) Clear Set Forbidden state 34.6.3 Events The CCL can generate the following output events:
LUTn where n=0-1: Lookup Table Output Value Writing a '1' to the LUT Control Event Output Enable bit (LUTCTRL.LUTEO) enables the corresponding output event. Writing a '0' to this bit disables the corresponding output event. The CCL can take the following actions on an input event:
INSELx where x=0-2: The event is used as input for the TRUTH table. For additional information, refer to 34.5.6. Events. Writing a '1' to the LUT Control Event Input Enable bit (LUTCTRL.LUTEI) enables the corresponding action on input event. Writing a '0' to this bit disables the corresponding action on input event. Related Links 28. Event System (EVSYS) 34.6.4 Sleep Mode Operation When using the GCLK_CCL internal clocking, writing the Run In Standby bit in the Control register
(CTRL.RUNSTDBY) to '1' will allow GCLK_CCL to be enabled in Standby Sleep mode. If CTRL.RUNSTDBY=0, the GCLK_CCL will be disabled in Standby Sleep mode. If the Filter, Edge Detector or Sequential logic are enabled, the LUT output will be forced to zero in STANDBY mode. In all other cases, the TRUTH table decoder will continue operation and the LUT output will be refreshed accordingly. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 730 Offset Name CTRL Reserved 0x00 0x01
... 0x03 0x04 0x05
... 0x07 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) 34.7 Register Summary Bit Pos. 7:0 7 6 5 4 3 2 1 0 RUNSTDBY ENABLE SWRST SEQCTRLX 7:0 Reserved SEQSEL[3:0]
0x08 LUTCTRL0 0x0C LUTCTRL1 7:0 15:8 23:16 31:24 7:0 15:8 23:16 31:24 EDGESEL FILTSEL[1:0]
ENABLE INSEL2[3:0]
INSEL1[3:0]
LUTEO LUTEI INVEI TRUTH[7:0]
EDGESEL FILTSEL[1:0]
ENABLE INSEL2[3:0]
INSEL1[3:0]
LUTEO LUTEI INVEI TRUTH[7:0]
34.8 Register Description Registers can be 8, 16, or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers are optionally write-protected by the Peripheral Access Controller (PAC). Optional PAC write protection is denoted by the "PAC Write-Protection" property in each individual register description. See Register Access Protection from Related Links. Some registers are enable-protected, meaning they can only be written when the peripheral is disabled. Enable-
protection is denoted by the "Enable-Protected" property in each individual register description. Related Links 34.5.8. Register Access Protection 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 731 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) 34.8.1 Control Name:
Offset:
Reset:
Property: PAC Write-Protection CTRL 0x00 0x00 Note:CTRL register (except the bits ENABLE & SWRST) is Enable Protected when CCL.CTRL.ENABLE = 1. Bit 7 Access Reset 6 RUNSTDBY R/W 0 Bit 6 RUNSTDBYRun in Standby 5 4 3 2 1 ENABLE R/W 0 0 SWRST W 0 This bit indicates if the GCLK_CCL clock must be kept running in standby mode. The setting is ignored for configurations where the generic clock is not required. For details refer to 34.6.4. Sleep Mode Operation. Important:This bit must be written before enabling the CCL. Value 0 1 Description Generic clock is not required in standby sleep mode. Generic clock is required in standby sleep mode. Bit 1 ENABLEEnable Value 0 1 Description The peripheral is disabled. The peripheral is enabled. Bit 0 SWRSTSoftware Reset Writing a '0' to this bit has no effect. Writing a '1' to this bit resets all registers in the CCL to their initial state. Value 0 1 Description There is no reset operation ongoing. The reset operation is ongoing. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 732 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) 34.8.2 Sequential Control X Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-protected SEQCTRLX 0x04 0x00 Note:SEQCTRLX register is Enable-protected when CCL.LUTCTRL0.ENABLE = 1. Bit 7 6 5 4 Access Reset Bits 3:0 SEQSEL[3:0]Sequential Selection 3 R/W 0 2 1 SEQSEL[3:0]
R/W 0 R/W 0 0 R/W 0 These bits select the sequential configuration:
Sequential Selection Value 0x0 0x1 0x2 0x3 0x4 0x5 -
0xF Name DISABLE DFF JK LATCH RS Description Sequential logic is disabled D flip flop JK flip flop D latch RS latch Reserved 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 733 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) 34.8.3 LUT Control n Name:
Offset:
Reset:
Property: PAC Write-Protection, Enable-protected LUTCTRL 0x08 + n*0x04 [n=0..1]
0x00000000 Note:The LUTCTRLn register is Enable Protected when CCL.LUTCTRLn.ENABLE = 1. Bit 31 Access Reset R/W 0 Bit 23 Access Reset 30 R/W 0 22 LUTEO R/W 0 29 R/W 0 21 LUTEI R/W 0 27 R/W 0 19 TRUTH[7:0]
28 R/W 0 20 INVEI R/W 0 26 R/W 0 18 25 R/W 0 17 Bit 15 14 Access Reset Bit 7 EDGESEL Access Reset R/W 0 13 R/W 0 6 5 12 11 INSEL2[3:0]
R/W 0 R/W 0 4 10 R/W 0 3 FILTSEL[1:0]
R/W 0 R/W 0 9 R/W 0 8 INSEL1[3:0]
R/W 0 2 1 ENABLE R/W 0 24 R/W 0 16 0 Bits 31:24 TRUTH[7:0]Truth Table These bits define the value of truth logic as a function of inputs IN[2:0]. Bit 22 LUTEOLUT Event Output Enable Value 0 1 Description LUT event output is disabled. LUT event output is enabled. Bit 21 LUTEILUT Event Input Enable Value 0 1 Description LUT incoming event is disabled. LUT incoming event is enabled. Bit 20 INVEIInverted Event Input Enable Value 0 1 Description Incoming event is not inverted. Incoming event is inverted. Bits 8:11, 9:12, 10:13 INSELxLUT Input x Source Selection These bits select the LUT input x source:
Value 0x0 0x1 0x2 0x3 0x4 0x5 Name MASK FEEDBACK LINK EVENT IO AC Description Masked input Feedback input source Linked LUT input source Event input source I/O pin input source AC input source: CMP[0] (LUT0) / CMP[1] (LUT1) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 734 PIC32CX-BZ2 and WBZ45 Family Configurable Custom Logic (CCL) Value 0x6 0x7 0x8 0x9 0xA 0xB 0xC -
0xF Name TC ALTTC TCC SERCOM ALT2TC ASYNCEVENT Reserved Description TC input source: TC0 WO[0] (LUT0) / TC1 WO[0] (LUT1) Alternative TC input source: TC1 WO[0] (LUT0) / TC2 WO[0] (LUT1) TCC input source: TCC0 (LUT0) / TCC1 (LUT1) SERCOM input source: SERCOM0 PAD0 (LUT0) / SERCOM1 PAD0 (LUT1) 1'b0 1'b0 Reserved Bit 7 EDGESELEdge Selection Value 0 1 Description Edge detector is disabled. Edge detector is enabled. Bits 5:4 FILTSEL[1:0]Filter Selection These bits select the LUT output filter options:
Filter Selection Value 0x0 0x1 0x2 0x3 Name DISABLE SYNCH FILTER
Description Filter disabled Synchronizer enabled Filter enabled Reserved Bit 1 ENABLELUT Enable Value 0 1 Description The LUT is disabled. The LUT is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 735 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) 35. True Random Number Generator (TRNG) 35.1 Overview The True Random Number Generator (TRNG) generates unpredictable random numbers that are not generated by an algorithm. It passes the American NIST Special Publication 800-22 and Diehard Random Tests Suites. The TRNG may be used as an entropy source for seeding an NIST approved DRNG (Deterministic RNG) as required by FIPS PUB 140-2 and 140-3. 35.2 Features Passed NIST Special Publication 800-22 Tests Suite Passed Diehard Random Tests Suite May be used as Entropy Source for seeding an NIST approved DRNG (Deterministic RNG) as required by FIPS PUB 140-2 and 140-3 Provides a 32-bit random number every 84 clock cycles 35.3 Block Diagram Figure 35-1. TRNG Block Diagram. TRNG Control Logic Interrupt Controller Event Controller CLKGEN User Interface Entropy Source APB 35.4 Signal Description Not applicable. 35.5 Product Dependencies In order to use this peripheral, other parts of the system must be configured correctly, as described as follows. 35.5.1 I/O Lines Not applicable. 35.5.2 Power Management The functioning of TRNG depends on the sleep mode of device. The TRNG interrupts can be used to wake up the device from sleep modes. Events connected to the event system can trigger other operations in the system without exiting sleep modes. Related Links 35.6.5. Sleep Mode Operation 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 736 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) 35.5.3 Clocks The TRNG bus clock () can be enabled and disabled in the CRU module or PMD3.RNGMD bit (see Peripheral Module Disable Register (PMD) from Related Links). Related Links 20. Peripheral Module Disable Register (PMD) 35.5.4 DMA Not applicable. 35.5.5 Interrupts The interrupt request line is connected to the interrupt controller. Using the TRNG interrupt(s) requires the interrupt controller to be configured first. See Nested Vector Interrupt Controller (NVIC) from Related Links. Related Links 10.2. Nested Vector Interrupt Controller (NVIC) 35.5.6 Events TRNG can generate Events that are used by the Event System (EVSYS) and EVSYS users. TRNG cannot use any Events from other peripherals, as it is not an Event User. Related Links 28. Event System (EVSYS) 35.5.7 Debug Operation When the CPU is halted in debug mode the TRNG continues normal operation. If the TRNG is configured in a way that requires it to be periodically serviced by the CPU through interrupts or similar, improper operation or data loss may result during debugging. 35.5.8 Register Access Protection All registers with write access are optionally write-protected by the Peripheral Access Controller (PAC), except the following register:
Interrupt Flag Status and Clear (INTFLAG) register Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. 35.5.9 Analog Connections Not applicable. 35.6 Functional Description 35.6.1 Principle of Operation When the TRNG is enabled, the peripheral starts providing new 32-bit random numbers every 84 PB2_CLK clock cycles. The TRNG can be configured to generate an interrupt or event when a new random number is available. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 737 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) Figure 35-2. TRNG Data Generation Sequence Clock ENABLE Interrupt 84 clock cycles 84 clock cycles 84 clock cycles Read TRNG_ISR Read TRNG_ISR Read DATA Read DATA 35.6.2 Basic Operation 35.6.2.1 Initialization To operate the TRNG, do the following:
Ensure PB2_CLK is enabled in the CRU and TRNG is enabled in the PMD3 register, PMD3.RNGMD bit. Optional: Enable the output event by writing a 1 to the EVCTRL.DATARDYEO bit. Optional: Enable the TRNG to Run in Standby sleep mode by writing a 1 to CTRLA.RUNSTDBY. Enable the TRNG operation by writing a 1 to CTRLA.ENABLE. 35.6.2.2 Enabling, Disabling and Resetting The TRNG is enabled by writing '1' to the Enable bit in the Control A register (CTRLA.ENABLE). The TRNG is disabled by writing a zero to CTRLA.ENABLE. 35.6.3 Interrupts The TRNG has the following interrupt source:
Data Ready (DATARDY): Indicates that a new random number is available in the DATA register and ready to be read. This interrupt is a synchronous wake-up source. See Sleep Mode Controller for details. The interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear register (INTFLAG.DATARDY) is set to 1 when the interrupt condition occurs. The interrupt can be enabled by writing a 1 to the corresponding bit in the Interrupt Enable Set register (INTENSET.DATARDY), and disabled by writing a 1 to the corresponding bit in the Interrupt Enable Clear (INTENCLR) register. An interrupt request is generated when the interrupt flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt flag is cleared, or the interrupt is disabled. See INTFLAG register from Related Links for details on how to clear interrupt flags. Note that interrupts must be globally enabled for interrupt requests to be generated. Related Links 35.8.5. INTFLAG 35.6.4 Events The TRNG can generate the following output event:
Data Ready (DATARDY): Generated when a new random number is available in the DATA register. Writing '1' to the Data Ready Event Output bit in the Event Control Register (EVCTRL.DATARDYEO) enables the DTARDY event. Writing a '0' to this bit disables the corresponding output event. Refer to EVSYS Event System for details on configuring the Event System. Related Links 28. Event System (EVSYS) 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 738 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) 35.6.5 Sleep Mode Operation The Run in Standby bit in Control A register (CTRLA.RUNSTDBY) controls the behavior of the TRNG during standby sleep mode:
When this bit is '0', the TRNG is disabled during sleep, but maintains its current configuration. When this bit is '1', the TRNG continues to operate during sleep and any enabled TRNG interrupt source can wake up the CPU. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 739 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) 35.7 Register Summary Bit Pos. 7 6 5 4 3 2 1 0 7:0 RUNSTDBY ENABLE Name CTRLA Reserved Offset 0x00 0x01
... 0x03 0x04 0x05
... 0x07 0x08 0x09 0x0A 0x0B
... 0x1F EVCTRL 7:0 Reserved INTENCLR INTENSET INTFLAG Reserved 0x20 DATA 7:0 7:0 7:0 7:0 15:8 23:16 31:24 DATA[7:0]
DATA[15:8]
DATA[23:16]
DATA[31:24]
DATARDYEO DATARDY DATARDY DATARDY 35.8 Register Description Registers can be 8, 16 or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly. Some registers require synchronization when read and/or written. Synchronization is denoted by the Read-
Synchronized and/or Write-Synchronized property in each individual register description. Optional write protection by the Peripheral Access Controller (PAC) is denoted by the "PAC Write Protection" property in each individual register description. Some registers are enable-protected, meaning they can only be written when the module is disabled. Enable-
protection is denoted by the Enable-Protected property in each individual register description. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 740 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) 35.8.1 Control A Name:
Offset:
Reset:
Property: PAC Write-Protection CTRLA 0x00 0x00 Bit 7 Access Reset 6 RUNSTDBY R/W 0 Bit 6 RUNSTDBYRun in Standby 5 4 3 2 0 1 ENABLE R/W 0 This bit controls how the TRNG behaves during standby sleep mode:
Value 0 1 Description The TRNG is halted during standby sleep mode. The TRNG is not stopped in standby sleep mode. Bit 1 ENABLEEnable Value 0 1 Description The TRNG is disabled. The TRNG is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 741 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) 35.8.2 Event Control Name:
Offset:
Reset:
Property: PAC Write-Protection EVCTRL 0x04 0x00 Bit 7 6 5 4 3 2 1 Access Reset Bit 0 DATARDYEOData Ready Event Output 0 DATARDYEO R/W 0 This bit indicates whether the Data Ready event output is enabled and whether an output event will be generated when a new random value is ready. Value 0 1 Description Data Ready event output is disabled and an event will not be generated. Data Ready event output is enabled and an event will be generated. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 742 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) 35.8.3 Interrupt Enable Clear Name:
Offset:
Reset:
Property: PAC Write-Protection INTENCLR 0x08 0x00 This register allows the user to disable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Set (INTENSET) register. Bit 7 6 5 4 3 2 1 0 Access Reset DATARDY R/W 0 Bit 0 DATARDYData Ready Interrupt Enable Writing a '1' to this bit will clear the Data Ready Interrupt Enable bit, which disables the corresponding interrupt request. Value 0 1 Description The DATARDY interrupt is disabled. The DATARDY interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 743 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) 35.8.4 Interrupt Enable Set Name:
Offset:
Reset:
Property: PAC Write-Protection INTENSET 0x09 0x00 This register allows the user to enable an interrupt without doing a read-modify-write operation. Changes in this register will also be reflected in the Interrupt Enable Clear (INTENCLR) register. Bit 7 6 5 4 3 2 1 0 Access Reset DATARDY R/W 0 Bit 0 DATARDYData Ready Interrupt Enable Writing a '1' to this bit will set the Data Ready Interrupt Enable bit, which enables the corresponding interrupt request. Value 0 1 Description The DATARDY interrupt is disabled. The DATARDY interrupt is enabled. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 744 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) 35.8.5 Interrupt Flag Status and Clear Name:
Offset:
Reset:
Property:
INTFLAG 0x0A 0x00
Bit 7 6 5 4 3 2 1 0 Access Reset Bit 0 DATARDYData Ready DATARDY R/W 0 This flag is set when a new random value is generated, and an interrupt will be generated if INTENCLR/
SET.DATARDY=1. This flag is cleared by writing a 1 to the flag or by reading the DATA register. Writing a 0 to this bit has no effect. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 745 PIC32CX-BZ2 and WBZ45 Family True Random Number Generator (TRNG) 35.8.6 Output Data Name:
Offset:
Reset:
Property:
DATA 0x20
Bit Access Reset Bit Access Reset Bit Access Reset Bit Access Reset 31 R 23 R 15 R 7 R 30 R 22 R 14 R 6 R 29 R 21 R 13 R 5 R DATA[31:24]
DATA[23:16]
DATA[15:8]
DATA[7:0]
28 R 20 R 12 R 4 R 27 R 19 R 11 R 3 R 26 R 18 R 10 R 2 R 25 R 17 R 9 R 1 R 24 R 16 R 8 R 0 R Bits 31:0 DATA[31:0]Output Data These bits hold the 32-bit randomly generated output data. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 746 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36. Advanced Encryption Standard (AES) 36.1 Overview The Advanced Encryption Standard peripheral (AES) provides a means for symmetric-key encryption of 128-bit blocks, in compliance to NIST specifications. The symmetric-key algorithm requires the same key for both encryption and decryption. Different key sizes are supported. The key size determines the number of repetitions of transformation rounds that convert the input (called the "plaintext") into the final output ("ciphertext"). The number of rounds of repetition is as follows:
10 rounds of repetition for 128-bit keys 12 rounds of repetition for 192-bit keys 14 rounds of repetition for 256-bit keys 36.2 Features Compliant with FIPS Publication 197, Advanced Encryption Standard (AES) 128/192/256 bit cryptographic key supported Encryption time of 57/67/77 cycles with 128-bit/192-bit/256-bit cryptographic key Five confidentiality modes of operation as recommended in NIST Special Publication 800-38A Electronic Code Book (ECB) Cipher Block Chaining (CBC) Cipher Feedback (CFB) Output Feedback (OFB) Counter (CTR) Supports Counter with CBC-MAC (CCM/CCM*) mode for authenticated encryption 8, 16, 32, 64, 128-bit data sizes possible in CFB mode Galois Counter mode (GCM) encryption and authentication 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 747 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.3 Block Diagram Figure 36-1. AES Block Diagram PLAINTEXT CIPHERTEXT ADD ROUND KEY ADD ROUND KEY SUBBYTES INV SHIFT ROWS D N U O R N O T P Y R C N E I SHIFT ROWS MIX COLUMNS Nr-1 rounds D N U O R N O T P Y R C E D I INV SUBBYTES ADD ROUND KEY Nr-1 rounds ENCRYPTION ADD ROUND KEY DECRYPTION INV MIX COLUMNS SUBBYTES INV SHIFT ROWS D N U O R L A N F I SHIFT ROWS D N U O R L A N F I INV SUBBYTES ADD ROUND KEY ADD ROUND KEY CIPHERTEXT PLAINTEXT 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 748 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.4 Signal Description Not applicable. 36.5 Product Dependencies In order to use this AES module, other parts of the system must be configured correctly, as described below. 36.5.1 I/O Lines Not applicable. 36.5.2 Power Management The AES will continue to operate in Standby sleep mode, if it's source clock is running. The AES interrupts can be used to wake up the device from Standby sleep mode. Refer to the Power Manager chapter for details on the different sleep modes. AES is clocked only on the following conditions:
When the DMA is enabled. Whenever there is an APB access for any read and write operation to the AES registers. (Not in Standby sleep mode.) When the AES is enabled & encryption/decryption is ongoing. Related Links 15. Power Management Unit (PMU) 36.5.3 Clocks The AES bus clock (PB2_CLK) can be enabled and disabled in the CRU module. 36.5.4 DMA The AES has two DMA request lines; one for input data and one for output data. They are both connected to the DMA Controller (DMAC). These DMA request triggers will be acknowledged by the DMAC ACK signals. Using the AES DMA requests requires the DMA Controller to be configured first. See Direct Memory Access Controller (DMAC) from Related Links. Related Links 22. Direct Memory Access Controller (DMAC) 36.5.5 Interrupts The interrupt request line is connected to the interrupt controller. Using the AES interrupt requires the interrupt controller to be configured first. Refer to the Processor and Architecture chapter for details. All the AES interrupts are synchronous wake-up sources. See Sleep Mode Controller for details. Related Links 10. Processor and Architecture 36.5.6 Events Not applicable. 36.5.7 Debug Operation When the CPU is halted in debug mode, the AES module continues normal operation. If the AES module is configured in a way that requires it to be periodically serviced by the CPU through interrupts or similar, improper operation or data loss may result during debugging. The AES module can be forced to halt operation during debugging. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 749 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.5.8 Register Access Protection All registers with write access are optionally write-protected by the peripheral access controller (PAC), except the following register:
Interrupt Flag Register (INTFLAG) Write protection is denoted by the Write-Protected property in the register description. Write protection does not apply to accesses through an external debugger. See Peripheral Access Controller (PAC) from Related Links. Related Links 26. Peripheral Access Controller (PAC) 36.5.9 Analog Connections Not applicable. 36.6 Functional Description 36.6.1 Principle of Operation The following is a high level description of the algorithm. These are the steps:
KeyExpansion: Round keys are derived from the cipher key using Rijndael's key schedule. InitialRound:
AddRoundKey: Each byte of the state is combined with the round key using bitwise XOR. Rounds:
SubBytes: A non-linear substitution step where each byte is replaced with another according to a lookup table. ShiftRows: A transposition step where each row of the state is shifted cyclically a certain number of steps. MixColumns: A mixing operation which operates on the columns of the state, combining the four bytes in each column. AddRoundKey Final Round (no MixColumns):
SubBytes ShiftRows AddRoundKey The relationship between the module's clock frequency and throughput (in bytes per second) is given by:
Clock Frequency = (Throughput/2) x (Nr+1) for 2 byte parallel processing Clock Frequency = (Throughput/4) x (Nr+1) for 4 byte parallel processing where Nr is the number of rounds, depending on the key length. 36.6.2 Basic Operation 36.6.2.1 Initialization The following register is enable-protected:
Control A (CTRLA) Enable-protection is denoted by the Enable-Protected property in the register description. 36.6.2.2 Enabling, Disabling, and Resetting The AES module is enabled by writing a one to the Enable bit in the Control A register (CTRLA.ENABLE). The module is disabled by writing a zero to CTRLA.ENABLE. The module is reset by writing a one to the Software Reset bit in the Control A register (CTRLA.SWRST). 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 750 36.6.2.3 Basic Programming PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) The CIPHER bit in the Control A Register (CTRLA.CIPHER) allows selection between the encryption and the decryption processes. The AES is capable of using cryptographic keys of 128/192/256 bits to encrypt and decrypt data in blocks of 128 bits. The Key Size (128/192/256) can be programmed in the KEYSIZE field in the Control A Register (CTRLA.KEYSIZE). This 128-bit/192-bit/256-bit key is defined in the Key Word Registers (KEYWORD). By setting the XORKEY bit of CTRLA register, keyword can be updated with the resulting XOR value of user keyword and previous keyword content. The input data for processing is written to a data buffer consisting of four 32-bit registers through the Data register address. The data buffer register (note that input and output data shares the same data buffer register) that is written to when the next write is performed is indicated by the Data Pointer in the Data Buffer Pointer (DATABUFPTR) register. This field is incremented by one or wrapped by hardware when a write to the INDATA register address is performed. This field can also be programmed, allowing the user direct control over which input buffer register to write. Note that when AES module is in the CFB operation mode with the data segment size less than 128 bits, the input data must be written to the first (DATABUFPTR = 0) and second (DATABUFPTR = 1) input buffer registers (see Table 36-1). The input to the encryption processes of the CBC, CFB and OFB modes includes, in addition to the plaintext, a 128-bit data block called the Initialization Vector (IV), which must be set in the Initialization Vector Registers
(INTVECT). Additionally, the GCM mode 128-bit authentication data needs to be programmed. The Initialization Vector is used in the initial step in the encryption of a message and in the corresponding decryption of the message. The Initialization Vector Registers are also used by the Counter mode to set the counter value. It is necessary to notify AES module whenever the next data block it is going to process is the beginning of a new message. This is done by writing a one to the New Message bit in the Control B register (CTRLB.NEWMSG). The AES modes of operation are selected by setting the AESMODE field in the Control A Register
(CTRLA.AESMODE). In Cipher Feedback Mode (CFB), five data sizes are possible (8, 16, 32, 64 or 128 bits), configurable by means of the CFBS field in the Control A Register (CTRLA.CFBS). In Counter mode, the size of the block counter embedded in the module is 16 bits. Therefore, there is a rollover after processing 1 megabyte of data. The data pre-processing, post-processing and data chaining for the concerned modes are automatically performed by the module. When data processing has completed, the Encryption Complete bit in the Interrupt Flag register (INTFLAG.ENCCMP) is set by hardware (which triggers an interrupt request if the corresponding interrupt is enabled). The processed output data is read out through the Output Data register (INDATA) address from the data buffer consisting of four 32-bit registers. The data buffer register that is read when the next read is performed is indicated by the Data Pointer field in the Data Buffer Pointer register (DATABUFPTR). This field is incremented by one or wrapped by hardware when a read from the INDATA register address is performed. This field can be programmed, giving the user direct control over which output buffer register to read from. Note that when AES module is in the CFB operation mode with the data segment size less than 128 bits, the output data must be read from the first (DATABUFPTR = 0) and second
(DATABUFPTR = 1) output buffer registers (see Table 36-1). The Encryption Complete bit (INTFLAG.ENCCMP) is cleared by hardware after the processed data has been read from the relevant output buffer registers. Table 36-1. Relevant Input/Output Data Registers for Different Confidentiality Modes Confidentiality Mode Relevant Input / Output Data Registers ECB CBC OFB 128-bit CFB 64-bit CFB 32-bit CFB 16-bit CFB 8-bit CFB CTR All All All All First and Second First First First All 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 751 36.6.2.4 Start Modes PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) The Start mode field in the Control A Register (CTRLA.STARTMODE) allows the selection of encryption start mode. 1. Manual Start Mode In the Manual Start Mode the sequence is as follows:
a. Write the 128/192/256 bit key in the Key Register (KEYWORD) b. Write the initialization vector or counter in the Initialization Vector Register (INTVECT). The initialization c. vector concerns all modes except ECB Enable interrupts in Interrupt Enable Set Register (INTENSET), depending on whether an interrupt is required or not at the end of processing. d. Write the data to be encrypted or decrypted in the Data Registers (INDATA). e. Set the START bit in Control B Register (CTRLB.START) to begin the encryption or the decryption process. f. When the processing completes, the Encryption Complete bit in the Interrupt Flag Register
(INTFLAG.ENCCMP) raises. If Encryption Complete interrupt has been enabled, the interrupt line of the AES is activated. g. When the software reads one of the Output Data Registers (INDATA), INTFLAG.ENCCMP bit is automatically cleared. 2. 3. Auto start Mode The Auto Start Mode is similar to the manual one, but as soon as the correct number of input data registers is written, processing is automatically started without setting the START bit in the Control B Register. DMA operation uses this mode. Last Output Data Mode (LOD) This mode is used to generate message authentication code (MAC) on data in CCM mode of operation. The CCM mode combines counter mode for encryption and CBC-MAC generation for authentication. When LOD is disabled in CCM mode then counter mode of encryption is performed on the input data block. When LOD is enabled in CCM mode then CBC-MAC generation is performed. Zero block is used as the initialization vector by the hardware. Reading from the Output Data Register (INDATA) is not required to clear the ENCCMP flag. The ENCCMP flag is automatically cleared by writing into the Input Data Register (INDATA). This allows retrieval of only the last data in several encryption/decryption processes. No output data register reads are necessary between each block of encryption/decryption process. Note that assembling message depending on the security level identifier in CCM* has to be done in software. 36.6.2.5 Computation of last Nk words of expanded key The AES algorithm takes the cryptographic key provided by the user and performs a Key Expansion routine to generate an expanded key. The expanded key contains a total of 4(Nr + 1) 32-bit words, where the first Nk (4/6/8 for a 128-/192-/256-bit key) words are the user-provided key. For data encryption, the expanded key is used in the forward direction, i.e., the first four words are used in the initial round of data processing, the second four words in the first round, the third four words in the second round, and so on. On the other hand, for data decryption, the expanded key is used in the reverse direction, i.e.,the last four words are used in the initial round of data processing, the last second four words in the first round, the last third four words in the second round, and so on. To reduce gate count, the AES module does not generate and store the entire expanded key prior to data processing. Instead, it computes on-the-fly the round key (four 32-bit words) required for the current round of data processing. In general, the round key for the current round of data processing can be computed from the Nk words of the expanded key generated in the previous rounds. When AES module is operating in the encryption mode, the round key for the initial round of data processing is simply the user-provided key written to the KEY registers. On the other hand, when AES module is operating in the decryption mode, the round key for the initial round of data processing is the last four words of the expanded key, which is not available unless AES module has performed at least one encryption process prior to operating in the decryption mode. In general, the last Nk words of the expanded key must be available before decryption can start. If desired, AES module can be instructed to compute the last Nk words of the expanded key in advance by writing a one to the Key Generate (KEYGEN) bit in the CTRLA register (CTRLA.KEYGEN). The computation takes Nr clock cycles. Alternatively, the last Nk words of the expanded key can be automatically computed by AES module when a decryption process is initiated if they have not been computed in advance or have become invalid. Note that this will introduce a latency of Nr clock cycles to the first decryption process. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 752 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.6.2.6 Hardware Countermeasures against Differential Power Analysis Attacks The AES module features four types of hardware countermeasures that are useful for protecting data against differential power analysis attacks:
Type 1: Randomly add one cycle to data processing Type 2: Randomly add one cycle to data processing (other version) Type 3: Add a random number of clock cycles to data processing, subject to a maximum of 11/13/15 clock cycles for key sizes of 128/192/256 bits Type 4: Add random spurious power consumption during data processing By default, all countermeasures are enabled, but require a write in DRNGSEED register to be effective. One or more of the countermeasures can be disabled by programming the Countermeasure Type field in the Control A (CTRLA.CTYPE) register. The countermeasures use random numbers generated by a deterministic random number generator embedded in AES module. The seed for the random number generator is written to the RANDSEED register. Note also that a new seed must be written after a change in the keysize. Note that enabling countermeasures reduces AES modules throughput. In short, the throughput is highest with all the countermeasures disabled. On the other hand, with all of the countermeasures enabled, the best protection is achieved but the throughput is worst. 36.6.3 Galois Counter Mode (GCM) GCM is comprised of the AES engine in CTR mode along with a universal hash function (GHASH engine) that is defined over a binary Galois field to produce a message authentication tag. The GHASH engine processes data packets after the AES operation. GCM provides assurance of the confidentiality of data through the AES Counter mode of operation for encryption. Authenticity of the confidential data is assured through the GHASH engine. Refer to the NIST Special Publication 800-38D Recommendation for more information. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 753 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) Counter 0 Incr32 Counter 1 Incr32 Counter 2 CIPH(K) CIPH(K) CIPH(K) Plaintext 1
Plaintext 2
Encryption Ciphertext 1 Ciphertext 2
GF128Mult(H) GF128Mult(H) GF128Mult(H) Auth Data 1 Len (A) || Len (C)
GF128Mult(H)
Auth Tag Authentication 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 754 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.6.3.1 GCM Operation 36.6.3.1.1 Hashkey Generation Configure CTRLA register as follows:
a. CTRLA.STARTMODE as Manual (Auto for DMAC) b. CTRLA.CIPHER as Encryption c. CTRLA.KEYSIZE as per the key used d. CTRLA.AESMODE as ECB e. CTRLA.CTYPE as per the countermeasures required. Set CTRLA.ENABLE Write zero to CIPLEN reg. Write the key in KEYWORD register Write the zeros to INDATA reg Set CTRLB.Start. Wait for INTFLAG.ENCCMP to be set AES Hardware generates Hash Subkey in HASHKEY register. 36.6.3.1.2 Authentication Header Processing Configure CTRLA register as follows:
a. CTRLA.STARTMODE as Manual b. CTRLA.CIPHER as Encryption c. CTRLA.KEYSIZE as per the key used d. CTRLA.AESMODE as GCM e. CTRLA.CTYPE as per the countermeasures required. Set CTRLA.ENABLE Write the key in KEYWORD register Set CTRLB.GFMUL Write the Authdata to INDATA reg Set CTRLB.START as1 Wait for INTFLAG.GFMCMP to be set. AES Hardware generates output in GHASH register Continue steps 4 to 7 for remaining Authentication Header. Note: If the Auth data is less than 128 bit, it has to be padded with zero to make it 128 bit aligned. GHASH AUTHDAT
GF128Mult(H) GHASH 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 755 PIC32CX-BZ2 and WBZ45 Family Advanced Encryption Standard (AES) 36.6.3.1.3 Plain text Processing Set CTRLB.NEWMSG for the new set of plain text processing. Load CIPLEN reg. Load (J0+1) in INTVECT register. As described in NIST documentation J 0 = IV || 0 31 || 1 when len(IV)=96 and J0 =GHASHH (IV || 0 s+64 ||
Intermediate GHASH is stored in GHASH register and Cipher Text available in INDATA register.
[len(IV)] 64 ) (s is the minimum number of zeroes that must be padded with the Initialization Vector to make it a multiple of 128) if len(IV) != 96. Load plain text in INDATA register. Set CTRLB.START as 1. Wait for INTFLAG.ENCCMP to be set. AES Hardware generates output in INDATA register. Continue 3 to 6 till the input of plain text to get the cipher text and the Hash keys. At the last input, set CTRLB.EOM. Write last in-data to INDATA reg. Set CTRLB.START as 1. Wait for INTFLAG.ENCCMP to be set. AES Hardware generates output in INDATA register and final Hash key in GHASH register. Load [LEN(A)]64||[LEN(C)]64 in INDATA register and set CTRLB.GFMUL and CTRLB.START as 1. Wait for INTFLAG.GFMCMP to be set. AES Hardware generates final GHASH value in GHASH register. 36.6.3.1.4 Plain text processing with DMAC Intermediate GHASH is stored in GHASH register and Cipher Text available in INDATA register. Set CTRLB.NEWMSG for the new set of plain text processing. Load CIPLEN reg. Load (J0+1) in INTVECT register. Load plain text in INDATA register. Wait for INTFLAG.ENCCMP to be set. AES Hardware generates output in INDATA register. Continue 3 to 5 till the input of plain text to get the cipher text and the Hash keys. At the last input, set CTRLB.EOM. Write last in-data to INDATA reg. Wait for INTFLAG.ENCCMP to be set. AES Hardware generates output in INDATA register and final Hash key in GHASH register. Load [LEN(A)]64||[LEN(C)]64 in INDATA register and set CTRLB.GFMUL and CTRLB.START as 1. Wait for INTFLAG.GFMCMP to be set. AES Hardware generates final GHASH value in GHASH register. 36.6.3.1.5 Tag Generation Configure CTRLA a. b. c. Set CTRLA.ENABLE to 0 Set CTRLA.AESMODE as CTR Set CTRLA.ENABLE to 1 Load J0 value to INITVECTV reg. Load GHASH value to INDATA reg. Set CTRLB.NEWMSG and CTRLB.START to start the Counter mode operation. Wait for INTFLAG.ENCCMP to be set. AES Hardware generates the GCM Tag output in INDATA register. 2023 Microchip Technology Inc. and its subsidiaries Draft Advance Information Data Sheet A-page 756
1 | ID Label and Location | ID Label/Location Info | 267.47 KiB | January 09 2023 / February 05 2023 |
AY WBZ450 PE FCC 1D: 2ADHKWBZ450 IC: 20266-WBZ450-
OCMIT IDF OORKOOROOK a. XXXII Ss WBZ450UE FCC iD: 2ADHKWBZ450 IC: 20266-WBZ450 CMT ID: XXXXXXKKKK te XXXKXKKRRK ny WBZ450Uc FCC ID: 2ADHKWBZ450 IC: 20266-WBZ450 CMT 1D: XXXXXXXXXXK Wasa Ss WBZ450 PC FCC ID: 2ADHKWBZ450 IC: 20266-W82450 CMHIT ID: XOOXXKXKKXKX antl > XXXX KKK
1 | Agency Letter | Cover Letter(s) | 209.56 KiB | January 09 2023 / February 05 2023 |
Authority to Act as Agent Date: 2022-12-08 TUV Rheinland of North America, Inc. 1279 Quarry Lane., Suite. A Pleasanton, CA 94566 To Whom It May Concern:
I appoint __________TUV Taiwan_______ to act as our agent in the preparation of this application for equipment certification. I certify that submitted documents properly describe the device or system for which equipment certification is sought. I also certify that each unit manufactured, imported or marketed, as defined in the FCC or Industry Canadas regulations will have affixed to it a label identical to that submitted for approval with this application. For instances where our authorized agent signs the application for certification on our behalf, I acknowledge that all responsibility for complying with the terms and conditions for Certification, as specified by TUV Rheinland Group, still resides with ____Applicant Name and Address_________. For TCB applications, We certify that we are not subject to denial of federal benefits, that includes FCC benefits, pursuant to Section 5301 of the Anti-Drug Abuse Act of 1988, 21 U.S.C. 862. Further, no party, as defined in 47 CFR 1.2002 (b), to the application is subject to denial of federal benefits, that includes FCC benefits. Thank you, Agency Agreement Date:
__December 8, 2022__ Agreement is valid for 12 months from the above date. By:
(Signature) HRUSHIKESH VASUKI __ __
(Print name) Director-Marketing & Applications _
(Title) 480-792-0762_
(Telephone) ______ On behalf of:
Microchip Technology Inc._ ____
(Company Name) Page 1 of 1
1 | Antenna Gain Info | Cover Letter(s) | 3.56 MiB | January 09 2023 / February 05 2023 |
Report Nos TEOT22040001 6584 Pagel of 8 Antenna Test Report Report No.: TEOT2204000165E4 Test Plan: Non-compliance with ISO17025 Applicant Name:
Manufacturer Name:
srochip technology licrochip technology Product Name: WBZ450 LGA, Model Number: WBZ4S0 LGA. Measurements performed at SGS Taiwan Led. Howaya Distrit, Taiwan Issued Date: May 06, 2022 Saar [hae Se Dian Fp shan Yen Shown Yen Suen May 062022 Removal Dragan Wu i Dragan wet socsigee (eee son Report No TEOT2204000165E4 Page No: 208 Measurement System Information General Information esting Condition:
Temperature 215C Humiaiy: 30%
Measurement Facility:
{ Measurement Chamber: MYG3D fllyaneshoic chamber ad ts measuring sytem
(Stargate 24-1)
' Base Staton Simulator: Antsy MT8NIOC for R&S CMU200)
( Network Analynar:Agitent ESOTIC Report No TEOT22040001655E4 Page No. 30f 8 Measurements are performed in 3 MVG Stargate-244L with the tarAet interface fora base stun simulator The Stargate-24L has 28 probe antennas mounted wits equal spciag ot 4 ireula arch. Electronic sitehing ofthe pro antennas proves oustanding measurement sped The geomeuy of the seup, wih only 4 Styrofoam colua witha 1-6 meters of the EUT, ensues rinimam interference and ew nipple on the messed radiation pattems, The DUT i placed on top ofthe pedestal, in the eater of te sstem, Typical Setup for Instruments View Inside View Report No TEOT2204000165E4 Page No: 408 Testing Laboratory: Ldenification ofthe Responsible Test Laboratory OTA Laboratory:
SGS Taiwan Ltd, Wireless Laboratory
[No 134, War Kang Road, New Tip Industral Pat, Wak District, Now Tapes City, Taiwan 24403 kone 2259279
$46 22298 O48 Nene ieee tear Teitng Location:
No.2. Koj "Ra Haya Technology Park, Guishan Dist, Taoyuan City, Taiwan 33383, Details of Aplicat Applicant's name: Microchip technology Applicant's address F-No.242,ndustey F- RD: Hsin Selonee Park, Hsinchu 30077, Taiwan Details of Manufacturer
| Manufacturers na Manufacturer's addres:
Path HsinChu 3007, Tainan Conta person Yeung Kal Hong Telephone: HANG ST7ANOG ct ATER x Email hong. yeungmirochip.com Report No TEOT2204000165E4 Page No: $08 WBZAS0LGA Microchip to WHZAS0LGA loge IN NA 400NITE~ 25002 Step sie: 0M, c ternal sntenas PCB antenna Caroaty board Matching. as 25pF GIMONSCINIRSOT cs 23a Lgresnigansnoz 125 19 board Matching an 32ph (GsM3 5C1HSRTREOT Gs 2a LQPOaIQ22N3B02 Duration of Test:
| Simple Reveive Date awe est Starting Date! 2092-0627 Report No TEOT2204000165E4 Page No: 698 List of Equipment cuneate, | amis | wranzoc | zeanone | azanont Neweanar | Agi |BAorG | aoeavina | avon See Ope we sono | amzover | _azsovne a ge om we ee Dp aroma | _ETEAnien | atae700 | ataonona | amzaona faagonzeipobora) a | Stpwnzei | zornvny | amare Meaerarteaware | wo | suvig | WA a oe eae
-SGS_ Report No: TEOT2204000165E4 Page No: 7 of 8 Antenna Gain and Efficiency WAZA50 LGA. Frege) Peak Guin. dt Emeiency Averoge abi unm 3 ait Test Setup Eront View Side View SGS_ Antenna 30 Plot Matrix 1 EIRP (EIRPO + EIRP9) with the -aNs pointing ot of he age, ys pointing ih, and r-as poking uy Five Space Five Space IP (2480 M112) =3D EARP (2480 M2) XY cut Tie Spave Free Spave EARP (2480 MHz) XZ. ent EIRP (2450 li) VZ out End of Report
@LSR 2.4 GHz Dipole Antenna te Datasheet 2.4 GHz 2.5 GHz Dipole 2dBi Antenna for Reverse Polarity SMA ORDERING INFORMATION ort | eseraon a oenonnt UPL oR Pony Aca 150m |
SPECIFICATIONS
[senator | vn
= Bina |
Tee Cie |
veo 25 1 omen Free oe weer a ne |
"ie 2 Secon hestamaton nis donuert ie ibect9cange iho nat Contr dala cert downoad he tat oso fom a com, sowore R18 Copyright 20082018 Ls ge tot 2.4 GHz Dipole Antenna Datasheet PHYSICAL DIMENSIONS (MM) 97.80
E E is H 3S 8 99.30 __ *]
8 e|
Pa a
: Reverse SMA Plug igre + Physiea!bimansions hestamaton nis donuert ie ibect9cange iho nat Contr dala cert downoad he tat oso fom a com, sowore R18 Copyigh 20002018158 Pope 2018 SR 2.4 GHz Dipole Antenna Datashe TYPICAL ANTENNA REFLECTION PERFORMANCE Figure 2 Reflection Peremeters or Extended Configuration (311) Figure 3 Reflection Pramtors or Felded Coniguratin (S11) hestamaton nis donuert ie ibect9cange iho nat Contr dala cert downoad he tat oso fom a com, Copyigh 20002018158 ge sat ZLSR 2.4 GHz Dipole Antenna ea Datashe TYPICAL ANTENNA RADIATION PERFORMANCE LSR ANTENNA STRAIGHT 2405 MHz hestamaton nis donuert ie ibect9cange iho nat Contr dala cert downoad he tat oso fom a com, Copyright 20082018 Ls Pog bat 2LSR 2.4 GHz Dipole Antenna rn Datash LSR ANTENNA STRAIGHT 2440 MHz LSR ANTENNA STRAIGHT 2480 MHz hestamaton nis donuert ie ibect9cange iho nat Contr dala cert downoad he tat oso fom a com, Copyright 20082018 Ls ZLSR 2.4 GHz Dipole Antenna ea Datashe LSR ANTENNA BENT 2405 MHz hestamaton nis donuert ie ibect9cange iho nat Contr dala cert downoad he tat oso fom a com, Copyright 20082018 Ls Pega Bott a SR 2.4 GHz Dipole Antenna Datas!
LSR ANTENNA BENT 2440 MHz hestamaton nis donuert ie ibect9cange iho nat Contr dala cert downoad he tat oso fom a com, sowore R18 Copyright 20082018 Ls ZLSR 2.4 GHz Dipole Antenna s Datasheet CONTACTING LS RESEARCH Headquarters Ls Research, Lic We 220 Commerce Cour CCodarburg, Wi 59012-2636 Osa Tet 1282) 375-4400, Fa 1202) 3754248 Website ws com Technical Support forumisrcom Sales Contact sales @ir.com coe aed hs ean an ng neon ary antag bee The nfomatanin ne doomnente jest charge whos ates Contr dala cert downoad he tat oso fom a com, sowore R18 Copyigh 20002018158 ge Bat FlexPIFA Laird >
FEATURES AND BENEFITS and ae 24 Gans + Cand ed me bung aye cece copes gaat Wipe set mestmaabacran tne rah nog FlexPIFA Foie 1 FexPIA mechani ing weeatanc en copsap esi thy tana gure: Antena chamber FlexPIFA Fiat SURFACE ANTENNA MEASUREMENTS Return Loss Antena measured on 215 mm plate of patearbonte semen ey rece en ta nL ig ont tome suena weeatancenncopsac cain, thy tana Valdxels FlexPIFA gure 1 Tota gin pats 30 Prots at 2440 FlexPIFA 5 nd Acimuthal Conical Cuts at 4900 MH Azimuth Gain Pattern Cuts - Total Gain at 4900 MH Valdxels FlexPIFA H
=I Hl
ogni DA J0j0Wweip 20UU) wi Z6 OpIsLY WleHOL FlexPIFA FlexPIFA FlexPIFA Azimuth Conical Cuts at $900 MHz Azimuth Gain Pattern Cuts - Total Gain at 8900 MHE ore 2 Tota gin pats FlexPIFA OPTIMAL INSTALLATION GuNPr We hbo gure 31d rainton Pa FexPIFA ah rom CST sinaiaton
{Eien cscs uy Spe choose Sa wh ange oh Pe EEE von gre 32: Tepeernce Sid crane round Wat harance FlexPIFA Taal tio teh nour FaAPIA 1 Sst Bk polar mann prema Home. ply TEPER ache he trl ens a Spo poe oa cond ai faacng he Fes sh es ny an haar Do te cal al ov op he Feo rane ne man met Tec sho un purr ne na the PsSPA es wy cae oes roi) a any tom he ea vl Tee oor me sown hn Faure 34 Recorded cai routing Ein Toran te om ne srr entanean be a of en ane nse caren Pr pote bt 1 Spurs Tas errs mgnee ae
{Bate eeten Prana ay ny sten ~The ss aon a Pogue 36 Goncavemounted FlexPIFA 10mm gu 2: Meta nar main tot Foxton spears te scan nte reannce lh haan ody We do otecarmen a yu eth ae help onbooy beatae arring es PesP A. Adaonay human tay a xara ot 24 Ge AF arth rae gat econ fang nh cece 8 hotnemascregirsooioe we hemantsamart coveted rears human bay nat eesti eer Spe Unencebtmoar tt caer ard Bays shown Fe 3 Atanas esi oe ay oe en ne pt ort een ty i een roy namo pevert FlexPIFA PRODUCT REVISION HistoRY 001-0016 ams sarc Meecrco16 we Bille SLSR vore02t
@LsR eo 2 Undated PN Cerone Pain)
@LsR FlexPIFA ADOITIONAL ASSISTANCE Pas sont! oral Lad Comes sales sen op ean anaes Supporter nigvicanaciviyortachcanesuressupeon ema wees supposes com Prone Sie tate onion: S323 0610 iaanipaaarracacnnici rons Seis aor ee sae es a Secreta oeeen tenia Bee sin Lopdatc thy tana APPLICATION SPECIFICATION TWTLE WIFI 6E FLEX CABLE BALANCE ANTENNA TABLE OF CONTENTS 1.0 SCoPE 2.0 PRODUCT DESCRIPTION 5.0 APPLICABLE DOCUMENTS 4.0 ANTENNA PERFORMANCE 5.0 ASSEMBLY GUIDELINE 6.0 RF PERFORMANCE AS A FUNCTION OF IMPLEMENTATION 10 THE ANTENNA PERFORMANCE VARIATION WITH CABLE LENGTH 18.0 CHANGE HISTORY SE SERRATE cnon WF GE FLEX CABLE BALANCE ANTENNA J eee APPLICATION SPECIFICATION | 10/20 AS-1461530100 | tw ozozvesra | anay Zhang 207102 | che Zora 2200012 holes Nee APPLICATION SPECIFICATION wi CABLE BALANCE ANTEN 1.0 SCoPE This spseicaton desenbes the antenna application and surounding. The information this document is fr referance and banchmark purposes only. Tha Users respensita fr vabaaing fntenna ef paformance based on the user's stl mpementaion Antenna llstrations inthis document are ganar representations, They ar not intended tobe an image a ny antenna ised nthe scope 120 PRODUCT DESCRIPTION 2.4 PRODUCT NAME AND SERIES NUMBER (S) Predvet name: WIFI BE ex cable balance antenna Series Number: 146158 2.2 DESCRIPTION Serles 146153 i @ balanced, dpsetyp, Nigh ffelency antenna for 24/516 Gz aplicaons, incuding WE GE, Bustontn, Zigboe and otrers. This antonna fe made from poy fete Istenal wah smilie 3590 tym and Nau double-sided adhesive ape for ety peel and fice mauntng. Ths balanced antenna wh ound pane independent design ofr various belong pos fer ease of legraton nto various devices. 2.3 PRODUCT STRUCTURE INFORMATION. Please rele to PS1461590100 for ul information. ANTENNA 20 VIEW fet e701 WIFI GE FLEX CABLE BALANCE ANTENNA J "APPLICATION SPECIFICATION. | 20130 TAS-1461530100 | tunasunonsn | anenen ania | one ora ono oD, apolex APPLICATION SPECIFICATION 3.0. APPLICABLE DOCUMENTS DOCUMENT NUMBER DESCRIPTION 50-1461530050 Sale Drawing ($0) Mechanical Dimension of he product s0-7461691050
[Product Speciation PS) _| PS-1481580100 Product Speciation
| Pecting Drawing (PK) | PK-1463590100 | Product packaging spectiations 40. ANTENNA PERFORMANCE 44 RF TEST CONDITIONS measurements ae done ofthe antenna mounted on a PCIABS material Mock of 1mm thekness wt UNA Aglent ESOTIC and Ovor-The-A [OTA) chore. Al measurements this document ae done with the part no 1461520100 win a eblength of 10mm Ss FIGURES.1.1 ANTENNA LOADED WITH PCIABS BLOCK OF 1.5 MM THICKNESS fet e701 \WFI GE FLEX CABLE BALANCE ANTENNA J "APPLICATION SPECIFIGATION | 3.030 1AS-1461530100 | auc snvo4na | angus | cn tera ea APPLICATION SPECIFICATION mai same FIGURES.1.2 ANTENNA LOADED WITH PCIABS BLOCK OF 1.5 MM THICKNESS WITH VNA SE | RE RESTON [TE oN 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 4030 wre zozvoenr |
AS-1461530100 | tv annbnna | Any hang 20230012 | hn Zora 221002 APPLICATION SPECIFICATION FIGURES.1.3 ANTENNA LOADED WITH PCIABS BLOCK OF 1.5 MM THICKNESS WITH OTA CHAMBER SE | RE RESTON [TE WIFI GE FLEX CABLE BALANCE ANTENNA J cali APPLICATION SPECIFICATION 50130 ture zoatmen? |
AS~1461530100 ini zevona | andy ang nao | vi Zhong 2000012 oD, tholg) APPLICATION SPECIFICATION EE ANTENNA PERFORMANCE Ml measurements nhs document are done wah the part n.1461830100 with a cable ongth of iam vescriprion | EQUPMENT | REQUIREMENT Frequency Range | vnnesoric | 242soH [ssceascne| 5225, Reumtoss | VNAESOTIC | < 1088 Peak Gain ox) | OTACramber | sous | oui |S saBh Average Total T sag! | orncumoe | ome | ovo | ore Polarization | OTAChamber |
inninpwiancs | WNAESITIC | some Not that the above antenna performance i measured th jut the aera mounted on a PPCIARS back to snr a ree-space condtion. When implement De syst, the fequency
{sonant might be oftune de othe leading of sureunding components especialy meta plane, This atune canbe compensated Uaugh matching. Atnough module manufacturers specty 2 peak gain Init tis based on free-space concions. Tho peak gan wil bo degraded by 1 to 248i Frthe actual implementation asthe adation pater wll change dueto the suround components
[As cuch, daring selocton of ananna, you ea slec one wits high paak gan fo compensate for Me loss Molex can afer assistant to choose the bes! loesion and best ing in-oedert meet this poak gan roqurament. EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 60130 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY. AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 APPLICATION SPECIFICATION TSRETURN LOSS PLOT Al messurement nhs document ace done wih a cable length of 100mm, Return Loss for Antenna at 24GHr Band in Free Space ng a FIGURE 4.3.1 RETURN LOSS OF ANTENNA AT 2.4GHZ BAND IN FREE SPACE Return Loss for Antenna at SGHs Band in Free Space torque FIGURE 4.3.2 RETURN LOSS OF ANTENNA AT SGHZ BAND IN FREE SPACE EO EARN Sel e700) WIFI GE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 70130 wre zozvoenr |
DOCUMENT NONE CREATDTRESEDBY: | GEORDIE PROVED:
AS-1461530100 ee oe eer APPLICATION SPECIFICATION Return Loss for Antenna at 6GH: band in Free Space requney a) FIGURE 4.3.9 RETURN LOSS OF ANTENNA AT 6GHZ BAND IN FREE SPACE SAEFFICIENCY PLOT Al measurement nhs document are don witha cable length of 100mm ficiency for Antenna at 24GHs Band in Free Space FIGURE 4.4.1 EFFICIENCY OF ANTENNA AT 24GHZ BAND IN FREE SPACE EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 80130 AE. zozvoun7 BOGIMERTNE | CREATEDTRENSEDBY: | GEORDIE RPPROUEBRY AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 APPLICATION SPECIFICATION ficiency for Antenna a SGHt Band in Free Space FIGURE 4.4.2 EFFICIENCY OF ANTENNA AT SGHZ BAND IN FREE SPACE Efficiency for Antenna at 6GHz band in Free Space DR ae NN i FIGURE 4.4.3 EFFICIENCY OF ANTENNA AT 6GHZ BAND IN FREE SPACE EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 90130 AE. zozvoun7 BOGIMERTNE | CREATEDTRENSEDBY: | GEORDIE APPROUEBRY. AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 Noe APPLICATION SPECIFICATION TS RADIATION PATTERN A messurement Inthe document are done witha cable length a 100m. XZ-2450MHz XY-2450MHz FIGURE 45.1 20 RADIATION PATTERN OF ANTENNA AT 2450MHZ IN FREE SPACE EO EARN te rer J DATE 2021/0897 amass 1AS-1461530100 ame |
WIFI SE FLEX CABLE BALANCE ANTENNA APPLICATION SPECIFICATION 40030 APPLICATION SPECIFICATION XY-5450MHz id @ led o b x te a XZ-5450MHz YZ-5450MHz Se FIGURE 4.5.2 20 RADIATION PATTERN OF ANTENNA AT S4S0MHZIN FREE SPACE EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 11.0F 30 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY. AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 foidy APPLICATION SPECIFICATION XY-6000MHz XZ-6000MHz FIGURE 4.5.3 20 RADIATION PATTERN OF ANTENNA AT GOOOMHZ IN FREE SPACE Sa AT TE tans ert WF GE FLEX CABLE BALANCE ANTENNA J eee APPLICATION SPECIFICATION. | 120/20 DOCUMENT NONE CEA TRONSEDAY: | ESD PROVED:
AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 foidy APPLICATION SPECIFICATION XY-7125MHz XZ-7125MHz FIGURE 4.5.4 20 RADIATION PATTERN OF ANTENNA AT 7125MIHZIN FREE SPACE EO EARN tena WF GE FLEX CABLE BALANCE ANTENNA te APPLIGATIONSPEGHIGATION | 130/90 cocaine aR: | ERD | ARO TAS-1461650100 | tauren | yy ren | cr seg er o8 APPLICATION SPECIFICATION FIGURE 4.5.50 RADIATION PATTERN OF ANTENNA AT 2450MHZ BAND IN FREE SPACE EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 1430 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY. AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 foidy APPLICATION SPECIFICATION x Oe FIGURE 4.56.30 RADIATION PATTERN OF ANTENNA AT S4SOMHZ BAND IN FREE SPACE EO EARN tena WF GE FLEX CABLE BALANCE ANTENNA te APPLICATION SPEGHIOATION | 150/90 cocaine ERSTE: | ERD | PRO TAS-1461650100 | tauren | yy ren | cr seg er o8 APPLICATION SPECIFICATION Y aa FIGURE 4.5.7 30 RADIATION PATTERN OF ANTENNA AT GOOOMHZ BAND IN FREE SPACE EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 16 of 30 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY. AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 APPLICATION SPECIFICATION FIGURE 4.5.8 30 RADIATION PATTERN OF ANTENNA AT7125MHZ BAND IN FREE SPACE EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 17 0F 30 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY. AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 APPLICATION SPECIFICATION 50 ASSEMBLY GUIDELINE The flex antenna comes with an adhesive 3m9077 for assemble ont the plastic wal ofthe system, The surface should be smooth with ra<t Gum and need to clean the surface before Sticking this product. The antenna eaninol be placed on a metalic surface. 5:1 HOWTO TEAR FLEX RELEASE PAPER 4. Find cutline on flex back side
2. Bend flex slight along cut ine Ya %
3. Tear release paper ST EAGT TE ae WF 6 FLEX CABLE BALANCE ANTENNA
|e APPLICATION SPEFICATION. | 180/30 DOCUMENT NONE | CREATEDTRENSEDBY: | GEORDIE EPRONEDRY:
AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 oD, tholg) APPLICATION SPECIFICATION 2 CABLE BENDING During he assambly ofthe anteonain a device. the cable naads tobe postionad away fom the Antena fie To acseve best performance The cable must be say fom the Flex eage sk ast mm ae shown in fgura 21 he ele Sends ino th antenna ex, the antenna perfomance willbe degraded FIGURE 5.2.1 RECOMMENDED CABLE BENDING RANGE FIGURE 52.2 UNRECOMMENDED CABLE BENDING RANGE FIGURE 5.2.3 MULTIPLE BENDING OF CABLES IS NOT RECOMMENDED SE | RE RESTON [TE FEE a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 19 0f 30 AE. zozvoun7 AS-1461530100 | Litas oarionn2 | Andy Zhang 2021/0812 | Chris Zhong 2020002 oD, tholg) APPLICATION SPECIFICATION 50 RF PERFORMANCE AS A FUNCTION OF MHPLEMENTATION 6:4 ANTENNA RF PERFORMANCE AS A FUNCTION OF DIFFERENT LOCATIONS WITH PARALLEL PLANE GROUND Fur locations with paral! pane ground have beon evaluated and these ocatons are show in figure 6,1 The plane ground see ln 20mm and we move fe plane around four locas foreach test The antanna performance is ater wih ger ditanca elween antenna and ara lane ground. The minimum distance between antenna and plane ground recommended tobe
{mm to atseve acceptable RF perfomance. 3 FIGURE 6.1.1 FOUR LOCATIONS WITH PARALLEL PLANE GROUND Ground Size: Somme Location 1: Dstance between antenna and plane (GAP) ground is about Som:
{eation 2: Distance bates antanna and plane (GAP) grou fe about Orn Lectin 3: Datance between antenna and pane (GAP) ground Is about 15am Leeaton 4: Dstance batween antonna and pane (GAP) ground is about 20mm, ee 7961 WIFE FLEX CABLE BALANCE ANTENNA J "APPLICATION SPECIFICATION. | 20.030
(AS-1461530100 | tzu | any Zhen 20012 | hn hora 00N8 APPLICATION SPECIFICATION Return Loss for Antenna at 2.4GHz Band at Four Locations with Parallel Plane Ground FIGURE 6.1.2 RETURN LOSS OF ANTENNA AT 24GHZ BAND AT FOUR LOCATIONS WITH PARALLEL PLANE GROUND, Return Loss for Antenna at SGHt Band at Four Locations with Parallel Plane Ground regency FIGURE 6.1.5 RERURN LOSS OF ANTENNA AT SGHZ BAND AT FOUR LOCATIONS WITH PARALLEL PLANE GROUND, EO EARN Sel e700) WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 210130 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 APPLICATION SPECIFICATION ficiency for Antenna at 2.8GHs Band at Four Locations with Parallel Plane Ground remsncy FIGURE 6.1.4 EFFICIENCY OF ANTENNA AT 2.4GHZ BAND AT FOUR LOCATIONS WITH
[PARALLEL PLANE GROUND Efficiency for Antenna at SGiz Band at Four Locations with FIGURE 6.1.5 EFFICIENCY OF ANTENNA AT SGHZ BAND AT FOUR LOCATIONS WITH PARALLEL PLANE GROUND, EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 220130 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY. AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 tholg) APPLICATION SPECIFICATION Ez ANTENNA RF PERFORMANCE AS A FUNCTION OF DIFFERENT LOCATIONS WITH VERTICAL PLANE GROUND Four locations with verte plane groung have ben evaluated and these locations are shown in figure 6.21 The pane ground sce e Boron nm and we move the plane ground to four locations foreach test. The antenna perfomance is beter wih larger sistance betwoon antenna fd vertical lane graund. The manum dstance between antenna and pane ground commended obo Snm to achieve aczoplabe RF perormance ANTENNA FIGURE 6.2.1 FOUR LOCATIONS WITH VERTICAL PLANE GROUND round Ste: sorm cation 1: Dstance between artonna and plane (GAP) ground is about Sm:
Location 2: Datance between antenna and pane (GAP) ground Is about TOM Leeaton 3: Dstanes between antonna and plana (GAP) ground is about 15am
{eeaton 8: Bstancs between antenna and pane (GAP) ground salou! 20mm, EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 230130 wre zozvoenr |
AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 APPLICATION SPECIFICATION Return Loss fr Antenna at 2.4GHt Band at Four Locations with Vertical Plane Ground request FIGURE 6.22 RETURN LOSS OF ANTENNA AT 24GHZ BAND AT FOUR LOCATIONS WITH VERTICAL PLANE GROUND Return Loss for Antenna at SGH: Band at Four Locations with Vertical Plane Ground recone FIGURE 62:3 RETURN LOSS OF ANTENNA AT SGHZ BAND AT FOUR LOCATIONS WITH VERTICAL PLANE GROUND EO EARN Sel e700) WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 240130 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY. AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 APPLICATION SPECIFICATION tficlency for Antenna at 24GH: Band at Four Locations FIGURE 6.2.4 EFFICIENCY OF ANTENNA AT 2.4GHZ BAND AT FOUR LOCATIONS WITH VERTICAL PLANE GROUND. Efficiency for Antenna at SGHz Band at Four Locations with Vertical Pane Ground es 8 requnce FIGURE 6.25 EFFICIENCY OF ANTENNA AT SGHZ BAND AT FOUR LOCATIONS WITH VERTICAL PLANE GROUND EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 250130 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY. AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 oD, tholg) APPLICATION SPECIFICATION 53 ANTENNA RF PERFORMANCE AS A FUNCTION OF DIFFERENT DISTANCES WITH PARALLEL PLANE GROUND. Fourlocatlons wit) the paral plane ground have ben avaluated and these locaton are shown in figure 8.3.1. The plane ground size is 90m"8Omm and we move the plane ground to four locations foreach test The antenna performance Is better wih larger estance botween the antenra and the paral pane ground. The minimum distance between the antenna andthe plane round recommended tobe Smm to achiave acceptable RF perxmance, FIGURE 6.3.1 FOUR LOCATIONS WITH PARALLEL PLANE GROUND Ground ize: 90rno0rem:
Location 1: Distance between antonna and plane (GAP) ground is about Sm:
Location 2: Dstance between antenna and pane (GAP) ground Is aboat Omm Location 3: Distance btween antonna and pane (GAP) ground is about 15mm
{ean 4: Dstanes betes antenna and pane (GAP) ground Is about 20mm, EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 260130 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY. AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 APPLICATION SPECIFICATION Return Loss fr Antenna at 2.4GHtr Band at Four Locations with Parallel Plane Ground mance FIGURE 6:32 RETURN LOSS OF ANTENNA AT 2.4GHZ BAND AT FOUR LOCATIONS WITH PARALLEL PLANE GROUND, Return Loss fr Antenna at SGH: Band at Four Locations with Parallel Plane Ground
. reasency FIGURE 63.3 RETURN LOSS OF ANTENNA AT SGHZ BAND AT FOUR LOCATIONS WITH PARALLEL PLANE GROUND EO EARN Sel e700) WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 270130 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBY AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 APPLICATION SPECIFICATION tficleney for Antenna at 24GH: Band at Four Locations mesecy FIGURE 6.3.4 EFFICIENCY OF ANTENNA AT 2.4GHZ BAND AT FOUR LOCATIONS WITH
[PARALLEL PLANE GROUND Efficiency for Antenna at SGHz Band at Four Locations with Parallel Plane Ground mee 8 FIGURE 6.3.5 EFFICIENCY OF ANTENNA AT SGHZ BAND AT FOUR LOCATIONS WITH PARALLEL PLANE GROUND. EO EARN a 673961 WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 280130 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 tholg) APPLICATION SPECIFICATION 710 THE ANTENNA PERFORMANCE VARIATION WITH CABLE LENGTH 17104 CABLE Loss re | vescmerion | Test conomion REQUIREMENT ed ee ee Trea asad are 1792 CABLE LENGTH AFFECT THE ANTENNA PERFORMANCE
{nance antenna ronan isentive by cable nah, but he cabaret he ttl sficeney Rete 1970.1 7a12 | Aten ee a 7.0. FOR EXAMPLE Base cn the 100mm cable perfomance, we can mostly compute the J0dmm cable's Frequency WMT | nay at | etary) | cae lom | iene 6) | ereney FI 09 Tit | Gamrssaain | 178 Eso) iso 0 man | orseaije [90 om 550 rE 7isa 2a Era 00 EET) 750 2a Sia 550 237 2033 22 or 5550 a7 095 203 eae Ea 097 7358 207 25 5700 00 7837 21 Sit S70 108 7838 Rie sae si. 20 754 230 5835 SiS a 7S 2 oar S50 BE 7A 2 BE Es 30 7420. 20 Sr EO EARN Sel e700) WIFI SE FLEX CABLE BALANCE ANTENNA J APPLICATION SPECIFICATION 290130 AE. zozvoun7 DOCUMENT NONE CREATDTRESEDBY: | GEORDIE RPPROUEBRY AS-1461530100 ah 20avve2 | Andy znang 02102 | chr Zhong 2020082 oD, hole} APPLICATION SPECIFICATION comm Tama a ey | a | ene | aT | ny | ee an zop| | aes | 350 | aa 0 ia [ays ser | shee 0 ia | ae ja [
0 op [ 7a 338 [ san
(OTA chamber CHANGE HISTORY CHANGE HisToRY Rev ara | DESCRIPTION 4 aooonis | Unie 0 Fe add
"0 e208 Change 202650 S40 pate
, zona Change 20 of ono 725 atm SS REST TE ae WIFI GE FLEX CABLE BALANCE ANTENNA J "APPLICATION SPECIFICATION. | 30.030
{AS-1461830100 vias | Andy Zhang tab? | ev hong 221002 Features LFR4 Antenna Applications
@ | owittntgss Mor compat abled 2 AGH anes, 15 mm Low Pro of 08 mm Far mlegrton sing cable and conectar OL TS eable and IPEX Connector cri Spree 1 irae Zetce
+ Arians
+ Seunty tala sin co om
es Se =
AX ABRACON vovomuinn [Roa Compact 2.4 GHz WiFi/BL FR4 Antenna AX ABRACON ABAR!50482450 ABRACON Compact 2.4 GHz WiFi/BL FR4 Antenna
| wot ae sy org AX ABRACON woman [Rat 2.4 GHz WiFi/BL FR4 Antenna resem AXABRACON cUSSESEESS unun [EESSE Compact 2.4 GHz WiFi/BL FR4 Antenna ABARIS04-S2450 swan 41x 2450 MHz ZX ABRACON
= a TT AX ABRACON nine Compact 2.4 GHz WiFi/BL FR4 Antenna acai Mouser Electronics Authorized Distributor Click to View Pricing, Inventory, Delivery & Lifecycle Information:
ABRACON:
ABARTEOL-2450 Datasheet TECHNOLOGIES ANT-2.4-LPW-125 2.4 GHz Panel-Mount Dipole Antenna Tho ANT. 125 LPH a parse rom arenrs or Bumtoot 2abon" an har 2 Gre atest nena IRAN AN cure nto arses i poatlon dat aaa oon postone ong $9 casa caletarataa Ma MMR tomes guy conocer Features
+ Psomance van 18
= Peak. 2861
= Encinoy 80%
+ Shaping unt 35 ren (0.7 dame ole 87 mm (869 ora ged wn rs orsraat, 6 dares an Sogegos restoring
+ MHEALFLcompstbn pg Hanae sci
+ Crmnsoctonal dot pte Ordering intormation ascaacewsas [tl ah AIF sgt crn 15 2 Applications
+4 apleaions Buetoom ana 29856"
1 Srgenona we LAs
= Wha
= seasibighn Sot Heme rawonng Sorin ana rect mening reset of Tangs eT ees Gatenays ann erste ree Seve apse ANT-2.4-LPW-125 Datasheet Electrical Spec ip wn rae Brena Packaging Information The ANT2.LPH-125 nla seni sein le pls bag Icha packages ae Ducted ina bg 5, sever baby of 0 Wo abi are tony bate To sexton Detnuton chores Pia aller stematvepasagng option Product Dimensions Four shows he ve censor an maurtrg trmston er he LEW aan. Te aren he pcan tod 0 ages aa hae deel at #8 ar 30 dogs. i Mourn Specie Figure 1 ANE-24-10W-125 Dimensions and Mounting Data Linx Datasheet ANT:
Antenna Orientation - Bent 90 Degraes ns chars on fe oon nse epresr taken wth he nna Get. eee a town owe LLPW-125 Figue 2. LEW Astana, Bent 9 Degrees Bent30) Inegowsr retested vom he arterna tack evade Awe VSN ke ndesos bate terra Premance ta gran ecuency Raft pana sale commen eights vrtcal as 3 QB Ine partage o are power elcid bask tor hs anna g 2 LLL }
* wd b +
: TT a af l o a ie Figure 8 LPW VSWR, Bent. 90 ANT-2 LPW-125 Datasheet Return Loss Fatuos igus 4 prs th bes in ower ath rtm eo tet ra, ke VOR. &
/Bootraun bs wa rdeses ber arena peramance at 8 han Rau) g 2 A Frequency Figure 4, LeW Retum Loss, an 30, Peak Gain The pak gan acess tne area bandh stown h Fu 5. Pes gan raproseis he msm
{rte eel power concenaber ares 2 aerator pace, a ere pank pornos a aye equa bu doe nt consder wy arscionaly ne gn elie, 3 =
Pekan (68 Frequency 0) Figure 8. LPW Peak Gan, Bot Datasheet ANT:
LLPW-125 Average Gain eran gan Fg i th avrg of a atari ga fn $-drensoral pace at sash eae owang on deabon tel perancewahou exresarg rar orton a 2 Frequency 0) lowe 6. LPW Average Gn, Bot 90 Radiation Eticieney Radon etcency ar) sows he ato. pow dvr tothe aera reat he power
(aot al arora, expossd a percrgs, who ahr Pecorigs Pdcales Dlr Eororares agven requ. 3 =
ney 8) Frequency 8) Figure 7. LPW Radiation Eclncy, Ben 90|
ANT-2.4-LPW-125 Datasheet Radiation Patterns Fadaon pans pce bso bat he asc andS-mensorl aan earomancs he rena by pstng gan a spate rouenc inten gona nee renr roo per
"3 Bo-0 oferta re shown Fou wi ole Sovetea S60 xrss The arta weenie owes reer tote plare of i oura of et below I Net tan Monod Wh pal POF ening eto, norng feo ation pater posse o eed re otal, Figure 8 Rasason Patios fr LPW, Beat90 Datasheet ANT:
Antenna Orientation - Straight ne cars on teow pages eres ta ken wth hs eto crentad sagt s sown owes LLPW-125 Figure. LPO Aneana Shown Stalght vswr Furs 10 proves th votas staring wa to EIR ass he research VIR descr:
Ineo retest tom he artenns tack head. Alves Vala ndesos beter trea Prarmanc ta gran oauency Pact powa sas cron one igs eral 3 QB Iheartgeoararitr power led bac tom he sna 8 2
elected Power) ae gue 10, LEW VSWR, Straight Linx ANT-2. LPW-125 Datasheet Return Loss Fetuoss Figu 1) arson eons power atthe arora dus tected Sona. Ls VSM, 3
[baotratn bes aus reses bet aseraparamanceat gh Peaueny. g 2 A Frequency Fue 11, LAW Rerun Loss Sait Peak Gain The paak gan acess the arto bandh stown haus 12: Pack aan repent the mak
{rte eel poner concenater ares 2 aerator pecs and ere paokpeformarce a ahah equa bu doe nt consder wy arscionaly ne gn elie, 3 =
Pekan (68 Frequency 0) gue 12. LPW Peak Gan, Stal Datasheet ANT:
LLPW-125 Average Gain rage aa gute 1), the aap tats gah -smeniona space at sac aus, povaig un edeaton ent peramunceweheut oxesang aan reten), A i if Freaseney a) Figure 13, LOW Average Gan, Salght Radiation Eticieney Fadaionetoency Faure 14 shows re rao of owe" catird th arena ht ths ove
(aotearoa, exposed sa pecaroge, whos ahr percrige Pdcaas Pll EOOranes agven requ. 3 =
sey 8) Frequency 8) Figure 14. LPW Radiation Eticlanoy, Saint ANT-2.4-LPW-125 Datasheet Radiation Patterns ast iter vce neato about the decry and? enon gan paramance the etm by ping gm aspects eqns in tren nmguna pare: rear soon par fr
{Sra craton ae show mean V8 ung pl poe cowry SRD ees, Tho aka geehc Pre ence th lan fe cote tt teon & Neher ews pel POF ening Radiation Patterns - Straight Figure 16. Ration Paes for LEW, Straight Datasheet ANT-2.4-LPW-125 Antenna Definitions and Usetul Formulas
\W -Vorage Sinn Wve Rate VSWR a ntoss ao et ecas e power tetas Hom he
(rte acs ona ada, lower VSWR ue dase et rena peer ts gvan Waueney SW ashy comodo Ret Los, says ranscecumu rent atl onkes on preamanran meses perenne eigen reactant Ses eu tt = 20 [SES Forear i gro etme aeternarianaat aaa Flere nlisentr ety eer sem o(1-(ueet ) nabciebaviemaimsarataer Meese fort nd lepeeliems ood eric oetneinellirered Ga = Wag) Ging = Gam ~ 25408 Pak an - Tha nit rt an rae arate tra hen eu ange. Adena anes shave vay gh pak gun compares io wera a, verge Gan- The seape gn aces al econ ora han tomiene range, MesienPee- Tro se pow wich ay bo apd to nee td pet al reseed nat feanoma pat cb 68)- loth unio resi ots power olan atl era ec fcic 4} A rarer deo Gr nr rl i rs ioe cel ative toa pce Be A compare messin del been in ater ue ide te-nave doe Dal Anes desl comes acne cana measueg 1/2 watSengh He a oe orci a ecto ed po oe a, Ieotopie Radar reerccaaniena whch rates ery sql al rectors ac a pec coher. Crit Te desta an arta rasan pat fal lor nal decir. An lsovope arent eth hose prec arrestor nar An pe sree 8 on ped aon ata an er erase sara perenne a es prot et gray irmrecton raat pte ncn ely los on re be ANT-2.4-LPW-125 Datasheet mrmimancctiimann: SD Fittap technology Specifications RFA-02-P05-D034 Franny me 00 NS ALEAD no FLEND technology Specifications RFA-02-P33-D034
@ Pulse sista sia
@YAGEO company Description: 2.4-2.5GHz PCB Antenna with Series: Internal PCB coated Features:
+ 2400-2500 MHz
+ Size: 10.7 x 47.7 x0.8 mm
+ Gain 1.5dBi
+ Radiation pattern Omni Cable length, see page 2
+ Connector U.FL compatible RoHS Compliant Applications:
+ 2.4GHz ISM band radios
+ WiFi, Bluetooth, BLE, ZigBee
+ Devices requiring internal antenna
+ Security, loT, Monitoring, Industrial applications ee 2008
@ Pulse eee een Des .4-2.5GHz PCB Antenna with Series: Internal PCB coax feed PART NUMBER:W3525BXXX Parwanber [_cleteh | aahesveTape | canlewype | conecarepe | requecy [at Gu wasisons [_ag'/onm | WA wassooa [52/3230 | Wa wasaseaco | 16 asim WA wasuenst | 39 / 00mm fer teatinm 309 cnt ex ora 7 wasaseoisor| _asaren [a a7 (e005 Comostniewan ire | 2408 | 208 a (=O uae7(=ocsn ee 2008
@ Pulse scone oma suet a YAGEO company Description: 2.4-2.5GHz PCB Antenna with coax feed PART NUMBER: W3525BXXX Series: Internal PCB etenna Type Dipole PCB Cabo Frequency 2400-28004 Nominal impedance son vswr 2s Radiation Pattern omni Gain 1.5081 Etloney 5%
Polaizaton Verte Power Wititanding sw MECHANICAL SPECIFICATIONS veral Length 10.747.740.8mm Antenna Material Poe Conecir typo PE or equivalont Cable ype iett3 Gey Operating Temperature 40 6-485 C Storage Temperature 40" C-#85 C RoHS Compliant Yes Ne sc raccraiar rmmuiammnaunaass is
@ Pulse scone oma suet a YAGEO company Description: 2.4-2.5GHz PCB Antenna with coax feed PART NUMBER: W3525BXXX Series: Internal PCB Beet Atm par
es a /
i FPO, i 3 \
od pu deection \
Tape |
cc a Vr TT VT oe +t aa | aa sae t+-+-+$ ij aed Dimension unit: mm/inch oe a ee ee ws
@ Pulse sccnent ox suet a YAGEO company Description: 2.4-2.5GHz PCB Antenna with coax feed Series: Internal PCB PART NUMBER: W3525BXXX seeonshaicwna inn nas
@ Pulse scone oma suet a YAGEO company Description: 2.4-2.5GHz PCB Antenna with coax feed Series: Internal PCB PART NUMBER: W3525BXXX VSWR s \
7 f. 6 y 4 a3 2 1 a a a |
eet mc a rye ee. ROHS 6
@ Pulse scone oma suet a YAGEO company Description: 2.4-2.5GHz PCB Antenna with coax feed PART NUMBER: W3525BXXX Series: Internal PCB Efficiency Efficiency (%) Frequency (MH) eet mc a rye ee. ROHS 7
@ Pulse scone oma suet a YAGEO company Description: 2.4-2.5GHz PCB Antenna with coax feed PART NUMBER: W3525BXXX Series: Internal PCB Gain Gain (dBi) 2 v7 1s a 2 a 1 2400 2810 2420 2420 2440 2450 2450 2470 2480 2490 2500 Frequency (Mia) POC umanmcnancamnmmunvna Biya
@ Pulse scone oma suet a YAGEO company Description: 2.4-2.5GHz PCB Antenna with coax feed Series: Internal PCB PART NUMBER: W3525BXXX Free Space Radiation Pattern XY Plane eet mc a rye ee. Rens 8
@ Pulse scone oma suet a YAGEO company Description: 2.4-2.5GHz PCB Antenna with coax feed Series: Internal PCB PART NUMBER: W3525BXXX Free Space Radiation Pattern XZ Plane A a ee eee eins 10
@ Pulse scone oma suet a YAGEO company Description: 2.4-2.5GHz PCB Antenna with coax feed Series: Internal PCB PART NUMBER: W3525BXXX Free Space Radiation Pattern YZ Plane eet mc a rye ee. RoHS ti
@ Pulse scone oma suet a YAGEO company Description: 2.4-2.5GHz PCB Antenna with coax feed Series: Internal PCB PART NUMBER: W3525BXXX For W3525B039 and W3525B039T and W3525B052 10pes antennas packing packed in 1 sealed bag 10pes sealed bags (total 100pcs antennas) packed in 1 foam bag 12pcs foam bags (total 1200pcs antennas) packed in 1 carton 460x235x140mm For W35258100 Spes antennas packing packed in 1 sealed bag 20pcs sealed bags (total 100pcs antennas) packed in 1 foam bag 12pes foam bags (total 1200pcs antennas) packed in 1 carton 460x235x140mm
1 | Confidentiality Letter | Cover Letter(s) | 196.96 KiB | January 09 2023 / February 05 2023 |
Date: 2022.12.08 Subject: Confidentiality Request for FCC ID: 2ADHKWBZ450 and IC: 20266-WBZ450 Pursuant to FCC 47 CRF 0.457(d) and 0.459 and IC RSP-100, Section 10, the applicant requests that a part of the subject FCC/IC application be held confidential. Type of Confidentiality Requested Short Term Short Term Short Term Short Term Short Term Short Term Short Term Short Term Permanent Permanent Permanent Permanent Permanent Permanent n/a n/a Exhibit Block Diagrams Internal Photos ***
Operation Description/Theory of Operation Tune-Up Procedure Schematics Users Manual***
Test Setup External Photos _Microchip Technology Inc._ has spent substantial effort in developing this product and it is one of the first of its kind in industry. Having the subject information easily available to "competition" would negate the advantage they have achieved by developing this product. Not protecting the details of the design will result in financial hardship. Permanent Confidentiality:
The applicant requests the exhibits listed above as permanently confidential be permanently withheld from public review due to materials that contain trade secrets and proprietary information not customarily released to the public. (*** PAG only) Short-Term Confidentiality:
The applicant requests the exhibits selected above as short term confidential be withheld from public view for a period of _180_ days from the date of the Grant of Equipment Authorization and prior to marketing. This is to avoid premature release of sensitive information prior to marketing or release of the product to the public. Applicant is also aware that they are responsible to notify TUV Rheinland in the event information regarding the product or the product is made available to the public. TUV Rheinland will then release the documents listed above for public disclosure pursuant to FCC Public Notice DA 04-1705. Sincerely, By:
HRUSHIKESH VASUKI / Director-Marketing & Applications
(Signature)
(Print name/Title) MS-0044715 Page 1 of 1 Revision 0
1 | Model Approval Letter | Cover Letter(s) | 191.50 KiB | January 09 2023 / February 05 2023 |
Applicant/Grantee Microchip Technology Inc. FCC ID:
2ADHKWBZ450 X Request for Modular Approval Request for Limited Modular Approval Section 15.212 Modular Transmitters /
Requirements Device Conditions Comply (Y/N) Single Modular Approval Requirements The radio elements must have the radio frequency circuitry must be shielded. Physical/discrete and tuning capacitors may be located external to the shield, but must be on the module assembly. The module shall have buffered modulation/data input(s) (if such inputs are provided) to ensure that the module will comply with the requirements set out in the applicable RSS standard under conditions of excessive data rates or over-modulation. The module shall have its own power supply regulation on the module. This is to ensure that the module will comply with the requirements set out in the applicable standard regardless of the design of the power supplying circuitry in the host device which houses the module. Requirements set out in the applicable standard regardless of the design of the power supplying circuitry in the host device which houses the module. The module shall comply with the provisions for external power amplifiers and antennas detailed in this standard. The Equipment certification submission shall contain a detailed description of the configuration of all antennas that will be used with the module. The module shall be tested for compliance with the applicable standard in a stand-
alone configuration, i.e. the module must not be inside another device during testing. The module has its own RF shielding. Shield Can is employed on the board structure, please see exhibition External Photo, the emission measurement was conducted without further shielding added. All modulation and data input(s) are buffered. The EUT has buffered data inputs, it is integrated on the RF chip Output power is controlled by the RF Chip and de-coupled from supply voltage variations. Frequencies are determined by Crystal The antenna is part of the module The modular transmitter was tested in a stand-alone configuration via a UART Interface. The module shall comply with the Category I equipment labelling requirements. In the exhibition OEM manual, there are Instructions given to the OEM on how to label the end product. 1 2 3 4 5 6 Y Y Y Y Y Y The modular transmitter complies with all specific rules or operating requirements that ordinarily apply to a complete transmitter and the manufacturer will provide adequate instructions along with the module to explain any such requirements. A copy of these instructions is included in this application for equipment authorization:
Address compliance with the Commission's RF exposure limits in Sections 1.1310 and 2.1093. In addition, spread spectrum transmitters operating under Section 15.247 are required to address RF exposure compliance in accordance with Section 15.247(b)(4). 7 8a Instructions in User Manual Please refer the Maximum Permissible Exposure Information. Y Y A limited modular approval may be granted for single or split modular transmitters that do not comply with all of the above requirements, e.g., shielding, minimum signaling amplitude, buffered modulation/data inputs, or power supply regulation, if the manufacturer can demonstrate by alternative means in the application for equipment authorization that the modular transmitter meets all the applicable Part 15 requirements under the operating conditions in which the transmitter will be used. Limited modular approval also may be granted in those instances where compliance with RF exposure rules is demonstrated only for particular product configurations. The applicant for certification must state how control of the end product into which the module will be installed will be maintained such that full compliance of the end product is always ensured. Signature Name/Title: HRUSHIKESH VASUKI / Director-Marketing & Applications Company Name: Microchip Technology Inc. Date: 08.12.2022
1 | Model Declaration Letter | Cover Letter(s) | 190.58 KiB | January 09 2023 / February 05 2023 |
3-Jan-23 Federal Communications Commission 7435 Oakland Mills Road Columbia, MD 21046 Certification and Engineering Bureau ISED Canada 3701 Carling Avenue (Building 94) Ottawa, Ontario K2H 8S2 IC ID: 20266-WBZ450 FCC ID: 2ADHKWBZ450 Models: WBZ450PE, WBZ450UE, WBZ450PC, WBZ450UC Declaration on Similarity All models are identical to each other in the circuit design, PCB layout and use of component sources except for the change highlighted in table below. The output power configuration is fixed by software settings; No change in the RF section of the SoC. The Trust&GO is a pre-configured and pre-provisioned secure element of Microchips family of security focused devices. The module variants integrate Trust&GO option The differences are in the model numbers and in the digital data interface. Model Number Description WBZ450PE Module with PCB antenna WBZ450PC Module with PCB antenna and Trust&Go chip WBZ450UE Module with u.FL connector for external antenna WBZ450UC Module with u.FL connector for external antenna and Trust&Go chip Hrushikesh Vasuki /
Director, Business Unit General Manager, Wireless Solutions Group
1 | Test Report BLE Appendix D Part 1 of 2 | Test Report | 4.85 MiB | January 09 2023 / February 05 2023 |
1 | Test Report BLE Appendix D Part 2 of 2 | Test Report | 5.63 MiB | January 09 2023 / February 05 2023 |
1 | Test Report Zigbee Appendix D Part 1 of 2 | Test Report | 4.09 MiB | January 09 2023 / February 05 2023 |
1 | Test Report Zigbee Appendix D Part 2 of 2 | Test Report | 3.59 MiB | January 09 2023 / February 05 2023 |
1 | Test Setup Photos | Test Setup Photos | 1.69 MiB | January 09 2023 / July 06 2023 | delayed release |
frequency | equipment class | purpose | ||
---|---|---|---|---|
1 | 2023-02-05 | 2405 ~ 2480 | DTS - Digital Transmission System | Original Equipment |
app s | Applicant Information | |||||
---|---|---|---|---|---|---|
1 | Effective |
2023-02-05
|
||||
1 | Applicant's complete, legal business name |
Microchip Technology Inc.
|
||||
1 | FCC Registration Number (FRN) |
0001596279
|
||||
1 | Physical Address |
2355 West Chandler Blvd.
|
||||
1 |
CHANDLER, Arizona 85224-6199
|
|||||
1 |
United States
|
|||||
app s | TCB Information | |||||
1 | TCB Application Email Address |
t******@tuv.com
|
||||
1 | TCB Scope |
A4: UNII devices & low power transmitters using spread spectrum techniques
|
||||
app s | FCC ID | |||||
1 | Grantee Code |
2ADHK
|
||||
1 | Equipment Product Code |
WBZ450
|
||||
app s | Person at the applicant's address to receive grant or for contact | |||||
1 | Name |
H****** V******
|
||||
1 | Title |
Director-Marketing & Applications
|
||||
1 | Telephone Number |
480-7********
|
||||
1 | Fax Number |
480-7********
|
||||
1 |
r******@microchip.com
|
|||||
app s | Technical Contact | |||||
1 | Firm Name |
Microchip Technology Inc.
|
||||
1 | Name |
H****** V******
|
||||
1 | Physical Address |
2355 West Chandler Blvd.
|
||||
1 |
CHANDLER
|
|||||
1 |
United States
|
|||||
1 | Telephone Number |
480-7********
|
||||
1 |
r******@microchip.com
|
|||||
app s | Non Technical Contact | |||||
n/a | ||||||
app s | Confidentiality (long or short term) | |||||
1 | Does this application include a request for confidentiality for any portion(s) of the data contained in this application pursuant to 47 CFR § 0.459 of the Commission Rules?: | Yes | ||||
1 | Long-Term Confidentiality Does this application include a request for confidentiality for any portion(s) of the data contained in this application pursuant to 47 CFR § 0.459 of the Commission Rules?: | Yes | ||||
1 | If so, specify the short-term confidentiality release date (MM/DD/YYYY format) | 07/06/2023 | ||||
if no date is supplied, the release date will be set to 45 calendar days past the date of grant. | ||||||
app s | Cognitive Radio & Software Defined Radio, Class, etc | |||||
1 | Is this application for software defined/cognitive radio authorization? | No | ||||
1 | Equipment Class | DTS - Digital Transmission System | ||||
1 | Description of product as it is marketed: (NOTE: This text will appear below the equipment class on the grant) | Wireless MCU module with BLE 5.2 compliant and Zigbee 3.1 Radio | ||||
1 | Related OET KnowledgeDataBase Inquiry: Is there a KDB inquiry associated with this application? | No | ||||
1 | Modular Equipment Type | Single Modular Approval | ||||
1 | Purpose / Application is for | Original Equipment | ||||
1 | Composite Equipment: Is the equipment in this application a composite device subject to an additional equipment authorization? | No | ||||
1 | Related Equipment: Is the equipment in this application part of a system that operates with, or is marketed with, another device that requires an equipment authorization? | No | ||||
1 | Grant Comments | Single Modular Approval. Output power listed is conducted. This grant is valid only when the module is sold to OEM integrators and must be installed by the OEM or OEM integrators. This transmitter is restricted for use with the specific antenna(s) tested in this application for certification and must not be co-located or operating in conjunction with any other antenna or transmitters within a host device, except in accordance with FCC multi-transmitter product procedures. The antenna(s) used for this transmitter must be installed to provide a separation distance of at least 20 cm from all persons. OEM integrators must be provided with transmitter operating conditions for satisfying RF exposure compliance. | ||||
1 | Is there an equipment authorization waiver associated with this application? | No | ||||
1 | If there is an equipment authorization waiver associated with this application, has the associated waiver been approved and all information uploaded? | No | ||||
app s | Test Firm Name and Contact Information | |||||
1 | Firm Name |
TUV Rheinland Taiwan Ltd. Taipei Testing Lab.
|
||||
1 | Name |
I**** H******
|
||||
1 | Telephone Number |
+886 ******** Extension:
|
||||
1 | Fax Number |
+886-********
|
||||
1 |
I******@tuv.com
|
|||||
Equipment Specifications | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Line | Rule Parts | Grant Notes | Lower Frequency | Upper Frequency | Power Output | Tolerance | Emission Designator | Microprocessor Number | |||||||||||||||||||||||||||||||||
1 | 1 | 15C | 2402 | 2480 | 0.0053 | ||||||||||||||||||||||||||||||||||||
1 | 2 | 15C | 2405 | 2480 | 0.005 |
some individual PII (Personally Identifiable Information) available on the public forms may be redacted, original source may include additional details
This product uses the FCC Data API but is not endorsed or certified by the FCC