Hi,
I was using bitcloud 1.14 with ATMega128rfa1. In end-devices we were using BATMON for determining remaining battery in the product, and now we switched to BitCloud 3.2 with SAMR21G18A. Porting was success and everything except BATMON is working the way it should.
when I tried use batmon register the compiler was giving error. On searching I found that BATMON was not defined in any file so I tried defining myself.
#define BATMON MMIO_REG(0x42005411, uint8_t)
#define BATMON_OK 5
// For BATMON ref
#define BAT_VAL_2V45 0x0F // threshold lvl = 2.45V
#define BAT_VAL_2V30 0x0C // threshold lvl = 2.30V
#define BAT_VAL_2V20 0x0A // threshold lvl = 2.20V
#define BATTERY_THRESHOLD 0x1F // for making BATMON_HR bit and BATMON_VTHx bits 0
Is there some problem with the defination or the address of the BATMON reg? When I tried to print the default value it should be 0x02 but i got 0x00. I thought maybe in PM_APBC mask RFCTRL is off so i have also enabled RFCTRL section.