Other Settings

USART Settings:

USART is initialized to communicate with the terminal window of the PC via the EDBG. The SERCOM USART is configured with the setting mentioned under the Terminal Window Setting, for communicating with the terminal window. If Baud rate change is required, the following macro in the header file example.h should be changed:

#define SET_BAUD_RATE  38400

SLCD Settings:

The SAM L22 Xplained Pro kit has the provision for Segment LCD Xplained Pro of Atmel. For more details regarding the SLCD configuration, refer the user guide which is specified in References.

On Tamper occurrence in WAKE mode, the error message “TAMPR” will be displayed on the LCD. If this error message needs to be changed, replace the error message in the following macro in the header file example.hp:

#define ERROR_STRING   "TAMPR"
Note: The SLCD in capable of displaying only five characters.

The TCC module is used for blinking the SLCD backlight while displaying the tamper error message. The Blinking time is controlled by the timer overflow value, which is defined as a macro as shown below. The user can change the overflow value if needed.

#define SLCD_BLINK_SPEED  2500

DMA Settings:

The RTC has the provision for enabling the DMA register to register transfer on Timestamp without CPU intervention. DMA transfers the 32-bit value of timestamp from TIMESTAMP register to a 32-bit buffer called buffer_rtc_tamper when the following functions are called.

void setup_transfer_descriptor(DmacDescriptor *descriptor)
void configure_dma_resource(struct dma_resource *resource)
dma_start_transfer_job(&example_resource)

EEPROM Configuration for Timestamp Storage

The firmware allows the user to store only 128 entries of tamper detection, which in turn occupies 898 bytes (896 (128*7) data memory and 2 bytes memory index) of RWW EEPROM memory. If the user needs to store more number of entries, change the maximum limit for writing the RWW EEPROM section, which is defined as a macro as shown below.

#define MAXIMUM_ENTRIES_STORED  128

In the above snippet, 128 is the number of time entries written to the EEPROM memory.

Note: The size of RWW EEPROM in SAML22N18A is 8KB out of which approximately 7KB is available for data storage. Hence user is requested to ensure that the memory index value is within the available memory.

The erase_tamper_history() function erases the full RWW EEPROM memory area, if the user intends to use the remaining RWW EEPROM memory section for some other data storage, care should be taken while using the erase_tamper_history() function. For more details regarding the RWW EEPROM emulator service, refer the application note "SAM EEPROM Emulator Service" mentioned under References.

Sleep Setting:

This application will enter into sleep mode once the configurations for tamper are done and wake up on tamper occurrence. The following statements will enable the STANDBY sleep mode and allow the device to go to sleep. This can be removed / modified as per user requirement.

system_set_sleepmode(SYSTEM_SLEEPMODE_STANDBY);
system_sleep();