Changes

CW308T-CEC1702

16 bytes added, 20:43, 4 April 2018
no edit summary
==== Creating and Modifying Examples ====
The following notes may prove useful when using mikroC PRO examples or creating your own:
* Any example which uses UART1 needs to be changed to use UART0 by changing the UART1_* functions to UART0_*.
* The plain text and encrypted text buffers need to be 16 byte aligned for the CEC1702's DMA to function properly. If the aes_crypt() call fails or the encryption never completes, this may be the cause. See simpleserial_base.c or mikroC PRO's AES examples for examples of this.
* All variable declarations need to be done at the beginning of functions, before any variables are modified or functions are called.
* The mikroC PRO compiler may have strange sizes for integer constants, meaning changing 4 8 bit numbers into a 32 bit number via bitshifts may not work as intended. Instead, using memcpy() may prove easier and more reliable.* When using mikroCPRO's "Clean Project Folder", ensure that .mcpar, .c, .h, and .xml files are not selected, as this will cause the source/project/Flash Center
* The port base for use with the GPIO library is actually GPIO_PORT_xxx_xxx, not _GPIO_PORT_xxx_xxx. Additionally, this is not a pointer, meaning the address of this variable needs to be passed to the gpio functions
* There are no GPIO library functions to write or read from pins. Instead, use GPIO_OUTPUT_xxx_xxx.Bn/GPIO_INPUT_xxx_xxx.Bn for bit n of pin range xxx-xxx.
==== Programming over JTAG/SWD ====
In addition to the SPI flash method, the CEC1702 can be temporarily (until power off) programmed using a JTAG debugger. This has been tested using Ozone V2.56d with a j-Trace Pro from Segger. The mikroC Pro PRO IDE also supports programming and debugging using the Segger.
Note that the CEC1702 only supports JTAG when the Debug Select bit (Byte 482 Bit[6]) of EFUSE is 0 and SWD when the Debug Select bit is 1. If one does not work, try the other.
* To modify the EFUSE, VREF must be set to between 1.52V and 1.6V.
* Make sure that FSOURCE_EN_READ and FSOURCE_EN_PRGM are never set to 1 at the same time, as this will short ground and power.
* Note that both the EFUSE instructions in the CEC1702 datasheet and mikroCPRO's EFUSE program rely on VREF being set to ground while FSOURCE_EN_READ and FSOURCE_EN_PRGM are being switched. Instead, to modify the EFUSE, set both to 0, wait for the registers to be set, then set the appropriate bit.
* Some additional features of the EFUSE include setting keys for flash decryption and authentication by the bootloader.
Approved_users, administrator
366
edits