SAML21 Is it possible to cause a BOD interrupt from user code?

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I implemented BOD33, but I don't know for use if I set everything up correctly so if it is possible I would like to cause a BOD interrupt to see if the handler is called and everything is cleared correctly.

This is the code I use to setup BOD33:

bod33_get_config_defaults(&config_bod33);
	
config_bod33.action = BOD33_ACTION_INTERRUPT;
	
bod33_set_config(&config_bod33);
bod33_enable();
SUPC->INTENSET.reg = SUPC_INTENCLR_BOD33DET;
system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_SYSTEM);

And I overwrite SYSTEM_Handler in the main file, which I believe is the correct handler for interrupts from Supply Controller (SUPC) which BOD33 is a part of.

void SYSTEM_Handler() {
	if (bod33_is_detected()) {
		bod33_clear_detected();
		NVMManager::commitEEPROMEmulator();
	}
}

The ASF documentation only provides an example for setting up an interrupt for the SAMD in the example code for the EEPROM Emulator, not for any other devices. And the example provided in the BOD33 module is extremely barebones.

EEPROM Emulator example: https://asf.microchip.com/docs/latest/saml21/html/asfdoc_sam0_eeprom_basic_use_case.html

BOD33 example: https://asf.microchip.com/docs/latest/sam0.applications.asf_programmers_manual.atsaml21/html/asfdoc_sam0_bod_basic_use_case.html

This topic has a solution.
Last Edited: Thu. Aug 5, 2021 - 09:44 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Change the detection level or the voltage, I think that are your options. I tried you setup and SYSTEM_Handler in a SAML21J18B and it seems to work. I changed the supply voltage and got the interrupt at around 1.7 V which match the default level (7) in Table 46-20. BOD33 Characteristics.

/Lars

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That is very good news. Thank you Lars.