[Open_electroporator] pyflex_f401 v0.6 prototype turn on

John Griessen john at cibolo.com
Tue Jul 17 22:02:05 UTC 2018


On 07/16/2018 02:49 PM, John Griessen wrote:
> All imports at top may be a micropython thing to do.

there is still something in pulse()  that shuts off PB9 LED when I run it from interactive prompt,
or when  the timers_init() function calls pulse().

This needs to be fixed to have power supply controlled by GPIOs during running pulse().
The only time its OK to shut down power supplies is reset.

The suspects inside pulse() function are:

1.
   def set_longer_counter(self, number_pulses):

       stm.mem16[stm.TIM1 + stm.TIM_CR1] &= (~(1<<TIM_CR1_OPM))&two_byte_mask # disable OPM
I want to look at this more soon....   suspicious

stm_low_level.py:def force_inactive_tim1():
stm_low_level.py:def force_inactive_tim5():
stm_low_level.py:def force_inactive_tim2():
stm_low_level.py:def force_inactive_tim4():

2.

def force_inactive_tim1():
   # Put tim1_2 & tim1_1 mode to FORCED_INACTIVE.
   ccmr1 = stm.mem16[stm.TIM1 + stm.TIM_CCMR1]
   ccmr1 &= 0b1000111110001111  # OC2M "100"....OC1M "100"
   ccmr1 |= 0b0100000001000000
   stm.mem16[stm.TIM1 + stm.TIM_CCMR1] = ccmr1
2 seems OK:  Was rewritten to not overwrite other timers a while back.


3.
   # enable OPM
   stm.mem16[tim_kickoff + stm.TIM_CR1] |= 1<<TIM_CR1_OPM
   # disable OPM
   stm.mem16[stm.TIM2 + stm.TIM_CR1] &= (~(1<<TIM_CR1_OPM))&two_byte_mask
   # disable OPM
   stm.mem16[stm.TIM5 + stm.TIM_CR1] &= (~(1<<TIM_CR1_OPM))&two_byte_mask
   stm.mem16[stm.TIM4 + stm.TIM_CR1] &= (~(1<<TIM_CR1_OPM))&two_byte_mask

3 seems like maybe an overwriter.  TIMxCR1  (TIMx control register) in manual

4.

rep_counter_overflow_detector.longer_counter = rep_counter_overflow_detector._longer_counter
   print('trace')
   stm.mem16[stm.TIM1 + stm.TIM_SR] = (stm.mem16[stm.TIM1 + stm.TIM_SR] & 0b111<<13) # clear all flags
4 seems like maybe read only so no trouble?.    TIM status register

5.
pyb.enable_irq()
5 Probably not affecting PB9.







More information about the open_electroporator mailing list