View unanswered posts | View active topics It is currently Tue Oct 17, 2017 6:44 pm



Reply to topic  [ 3 posts ] 
Sleep and Wake Up 
Author Message

Joined: Fri Aug 03, 2012 11:39 am
Posts: 5
Location: Ulm, Germany
I have a little question. I want to set the BLE modul into the sleep mode. Thats okay.. i use the gap_set_mode(0,0) function and in the hardware.xml i use the sleeposc enable = "true" ppm="30" and finished. But now the main problem. I want to use a command from the BLEGUI2.exe as an interrupt to wake up the modul. Not a IO interrupt. is it always possible to send data to the Modul even in the sleep mode? Or do i need a special function to wake up the modul?

Thanks

Armin


Mon Aug 27, 2012 3:55 pm
Profile

Joined: Fri Aug 03, 2012 9:38 pm
Posts: 18
Have you tried it? I'm sure that the serial I/O will wake up the module.


Fri Sep 07, 2012 7:23 am
Profile

Joined: Fri Aug 03, 2012 9:38 pm
Posts: 18
I have done a little more experimentation with this as my own project was advertising three times a second, and so was never entering PM3.

I will use a tilt switch to wake up my device, but you could equally wire the serial data line to P0:0 and use the same example as me.

This BGS simply wakes up, advertises for 60 seconds and goes back to sleep, but it is the framework for entering PM3.

hardware.xml :
Code:
<?xml version="1.0" encoding="UTF-8" ?>

<hardware>
    <sleeposc enable="true" ppm="30" />
   <wakeup_pin enable="true" port="0" pin="0" />
   <port index="0" tristatemask="0" pull="down" />
    <usb enable="false" endpoint="api"/>
    <txpower power="15" bias="5" />
   <usart channel="0" mode="spi_master" alternate="2" polarity="positive" phase="1" endianness="msb" baud="57600" endpoint="none" />
   <script enable="true" />
    <pmux regulator_pin="7" />
   <slow_clock enable="true" />
</hardware>

testpm4.bgs :
Code:
#Demo script to enter PM3 on BLE112
#Simon Taylor, simon.taylor@avnet-embedded.eu (Distributors for Bluegiga)
event system_boot(major ,minor ,patch ,build ,ll_version ,protocol_version ,hw )
   call gap_set_mode(0,0)
   #Allow pairing
   call sm_set_bondable_mode(1)
   call hardware_io_port_config_irq(0, 1, 0) #enable IRQ on I/O port 0:0
end

event connection_disconnected(handle,result)
#in case of disconnection, switch off advertising (don't really need to do anything here)
    call gap_set_mode(0, 0)
end

event hardware_io_port_status(timestamp, port, irq, state)
   call gap_set_adv_parameters(1600, 1600, 7)
   call gap_set_mode(gap_general_discoverable,gap_undirected_connectable)
   call hardware_set_soft_timer(1920000, 0, 1)   #60 seconds
end

event hardware_soft_timer(handle)
   call gap_set_mode(0, 0)   #switch off advertising
end

This seems to work, hope it helps.

You can download the files at https://dl.dropbox.com/u/1587376/201209/test%20PM3.zip


Thu Sep 13, 2012 11:26 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF.