This seems like an obvious question but the search function in the form returns far too many results - I can't figure out how to simple search a topic without the function returning every mention of every word in the search from the entire site. :( So I did try to find the answer.
Trying to figure out how to enable normal brown out on ATTiny416 using Atmel Studio. I am writing and debugging using the green 'play' button labeled "Start without debugging", so I can't use the normal fuse selection drop downs in the memories programming panel.
I want to have it defined in my code somewhere so when programming using that "start without debugging" button, the fuses are programmed correctly.
My application sometimes doesn't drop voltage all the way to zero when the board is reset (it is a slave module to another device), so instead of having an external volts monitor reset circuit, I want to use BOD to put the device into reset automatically. I'm running at 5v, 20 MHz, so we need the BOD level to be fairly high so we don't violate the voltage vs clock speed safe envelope.
I created a project using Atmel Start. In the BOD section it allows me to only select what happens in sleep, but not a box to just enable the BOD period, or to configure it's program level. (Note, I am NOT interested in the 'early warning' VLM stuff, I just want normal BOD).
This project creates a function called BOD_init(), which includes the following line:
ccp_write_io((void *)&(BOD.CTRLA), BOD_SLEEP_ENABLED_gc /* Enabled */);
I don't understand all the pointer * and BOD_SLEEP_ENABLED_gc shorthand nonsense that Atmel doesn't actually explain anywhere. I just want to set the fuse / register to a specific value and can't figure how how to syntax that.
Looking to section 17.5 in the DS for the part, it looks like I need to set bits 3-2 of BOD.CTRLA (the "active" bits to 0x1 "enabled), then I need to set BOD.CTRLB to the desired BOD level, which will be 4.3v BODLEVEL7 0x7 in this case.
These registers seem to be a combination of run-time settable and set by fuse. I want to make sure the device always starts up clean, so I would like to have these set in fuses or whatever is the most stable so it just goes into and out of reset as expected when voltage sags.
If someone could show a sample code of how to set this, it would be very much appreciated.