As of August 2020 the site you are on (wiki.newae.com) is deprecated, and content is now at rtfm.newae.com.

Changes

Jump to: navigation, search

Adding Modules/Parameters

284 bytes removed, 01:13, 13 February 2017
auxiliary
Exemple ([http://newae.com/forum/viewtopic.php?f=7&t=202#p1026 provided by GABRIEL_F]):
import logging<br> import time<br> from chipwhisperer.capture.auxiliary._base import AuxiliaryTemplate<br> from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI<br> from chipwhisperer.common.utils import util, timer<br> <br> <br> class SerialBeforeArm(AuxiliaryTemplate):<br>     <nowiki>'''<br/nowiki>      This auxillary module allows for serial data to be sent to the target<br>     during the capture process i.e., before and after arming the scope<br>     and after the trace has recorded. This enables the ability for the<br>     scope to trigger on serial communication that need to start after a<br>     reset but before the scope is armed and after.<br>
    
<br>     Compare to SimpleSerial send Go Command.<br>
    
<br>     TODO:<br>     Parser to chop up multiple commands sent in single string seperated by<br>     whitespace. Modify to iterate over returned lists.<br> <br>     Uses non-blocking sleep methods poached from ResetCW1173Read.<br>      <br>     Gabe 25-NOV-16<br>     <nowiki>'''<br> <br/nowiki>   
    _name = "Send Serial During Capture"<br>
<br>     def __init__(self):<br>         AuxiliaryTemplate.__init__(self)<br>         self.getParams().addChildren([<br>             {'name':'Pre-Arm Message', 'type':'str', 'key':'prearmmssg', 'value':''},<br>''             {'name':'Post-Arm Message', 'type':'str', 'key':'postarmmssg', 'value':''},<br>''             {'name':'Post-Capture Message', 'type':'str', 'key':'postcapmssg', 'value':''},<br>''             {'name':'Delay (Pre-Message)' , 'type':'int',  'key':'predelay',  'limits':(0, 10E3), 'value':0, 'suffix':' ms'},<br>             {'name':'Delay (Post-Message)', 'type':'int',  'key':'postdelay', 'limits':(0, 10E3), 'value':0, 'suffix':' ms'},<br>             {'name':'Test Reset', 'type':'action', 'action':self.testSend}<br>         ])<br> <br>     def traceArm(self):<br>         """Before arming the scope, send some serial messages and wait"""<br>         string = self.findParam('prearmmssg').getValue()<br>         self.sendSerial(string)<br> <br>     def traceArmPost(self):<br>         """After arming the scope, send some serial message and wait"""<br>         string = self.findParam('postarmmssg').getValue()<br>         self.sendSerial(string)<br> <br>     def traceDone(self):<br>         """After the trace is captured, send some serial messages and wait"""<br>         string = self.findParam('postcapmssg').getValue()<br>         self.sendSerial(string)<br> <br>     def sendSerial(self, string):<br>         # """Send a string!<br>""" <br>         if string is None or len(string) == 0:<br>             return<br> <br>         dly = self.findParam('predelay').getValue()<br>         if dly > 0:<br>             self.nonblockingSleep(dly / 1000.0)<br> <br>         CWCoreAPI.getInstance().getTarget().ser.write(string)<br>
        
<br>         dly = self.findParam('postdelay').getValue()<br>         if dly > 0:<br>             self.nonblockingSleep(dly / 1000.0)<br> <br>     def nonblockingSleep_done(self):<br>         self._sleeping = False<br> <br>     def nonblockingSleep(self, stime):<br>         """Sleep for given number of seconds (~50mS resolution), but don't block GUI while we do it"""<br>         timer.Timer.singleShot(stime * 1000, self.nonblockingSleep_done)<br>         self._sleeping = True<br>         while(self._sleeping):<br>             time.sleep(0.01)<br>             util.updateUI()<br> <br>     def testSend(self, _=None):<br>
        self.sendSerial('Hello')
218
edits

Navigation menu