Sleeping the WiSheild for low power usage

Discussion about any of the included sketches (i.e. WebServer), or user-generated applications.

Re: Sleeping the WiSheild for low power usage

Postby GregEigsti » Thu Sep 30, 2010 9:30 pm

Keep digging! If I remember correctly trying to find the "real code" in the Microchip sample stuff is an arduous journey with lots of dead ends. But after some digging you should be able to find the "real" implementations - their code is a bit weird...

Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: Sleeping the WiSheild for low power usage

Postby mikezs » Wed Oct 06, 2010 2:28 am

Still not having any luck with this :( Could anyone provide pointers?

I'm trying something like this (adding to g2100.c by just hacking around)

Code: Select all
void zg_sleep_toggle()
{
   U8 loop_cnt = 0;

   do {
      // write reset register addr
      hdr[0] = ZG_INDEX_ADDR_REG;
      hdr[1] = 0x00;
      hdr[2] = ZG_PWR_CTRL_REG;
      spi_transfer(hdr, 3, 1);

      hdr[0] = ZG_INDEX_DATA_REG;
      hdr[1] = (loop_cnt == 0)?(0x80):(0x0f);
      hdr[2] = 0xff;
      spi_transfer(hdr, 3, 1);
   } while(loop_cnt++ < 1);
   
   
   // write sleep register data
   hdr[0] = ZG_INDEX_ADDR_REG;
   hdr[1] = 0x00;
   hdr[2] = ZG_PWR_STATUS_REG;
   spi_transfer(hdr, 3, 1);
   
   do {
      hdr[0] = 0x40 | ZG_INDEX_DATA_REG;
      hdr[1] = 0x00;
      hdr[2] = 0x00;
      spi_transfer(hdr, 3, 1);
   } while((hdr[1] & ZG_ENABLE_LOW_PWR_MASK) == 0);

   do {
      hdr[0] = 0x40 | ZG_PWR_CTRL_REG_LEN;
      hdr[1] = 0x00;
      hdr[2] = 0x00;
      spi_transfer(hdr, 3, 1);
   } while((hdr[1] == 0) && (hdr[2] == 0));
}


But as I know nothing of the SPI protocol, or the registers on the chip, I have no idea if this will work.
mikezs
 
Posts: 8
Joined: Thu Aug 13, 2009 3:33 am

Previous

Return to Sketches and Applications

Who is online

Users browsing this forum: No registered users and 1 guest