Shop OBEX P1 Docs P2 Docs Learn Events
memory loss — Parallax Forums

memory loss

mikeamikea Posts: 283
edited 2012-08-12 04:29 in Propeller 1
i have the prop reading an r/c reciever and depending on what it sees running a 12 volt h bridge. it reads the radio on pin 2 and outputs to the bridge on pin 5, and 6. all grounds tied together. the problem is the prop runs things ok during a power on session that it is programmed in, but when the power is turned off and back on the output to the h bridge is pulsed when it is supposed to be constant. I've had this problem before thinkning i damaged the proto board, so i have a new one with the same thing happening. Im wondering what i could be doing to cause eeprom problems, and if anyone has had a similiar problem. thanks-mike

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-11 12:56
    The difference between the two situations is that, in one case, the power is not turned off ... voltages remain stable when the program starts up. In the second case, the power starts from zero. Depending on how the radio and the H-bridge is designed, you may get one or more transients. You will need to post more information about your hardware, particularly a schematic of the H-bridge. You will also need to post your program. There may be something in its initialization that's not behaving properly under power up conditions.

    This sort of situation would not cause EEPROM problems nor would there be a hardware problem with the Protoboard itself.


    attachment.php?attachmentid=78421&d=1297987572
  • mikeamikea Posts: 283
    edited 2012-08-11 13:31
     
    CON
            _clkmode = xtal1 + pll16x                                               'Standard clock mode * crystal frequency = 80 MHz
            _xinfreq = 5_000_000
    VAR
      long cyclep
      long endcyclep
      long startpulsep
      long endpulsep
      long pulsewidthp
      
      long cyclea
      long endcyclea
      long startpulsea
      long endpulsea
      long pulsewidtha
      
      long stack[100]
      long stack1[100]
      
    OBJ
           pst: "parallax serial terminal"
      
    PUB   eye
    cognew(plow,@stack)
    cognew(display,@stack1)   '  cog for pst for troubleshooting
    dira[2]~
    ctra[30..26]:=%00100
    ctra[5..0]:=2        'radio plugged into pin 2               'read r/c receiver section
    frqa:=1
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    
                                                 
       repeat
         waitpeq(%000, |< 2, 0) ' wait for Pin 2 to go low         'for plow
         waitpeq(%100, |< 2, 0) 'Wait for Pin 2 to go high         '
         startpulsep:=cnt                                          '
         waitpeq(%000, |< 2, 0) ' wait for Pin 2 to go low         '
         endpulsep:=cnt                                            '
         waitpeq(%100, |< 2, 0) 'Wait for Pin 2 to go high         '
        ' endcyclep:=cnt                                           '
         pulsewidthp:=endpulsep-startpulsep                        '
        ' cyclep:=endcyclep-startpulsep                            'for plow
        
              
    pub display     
    pst.start(115200)
    waitcnt(clkfreq/4+cnt)     
      repeat                                    'serial terminal section
      ' pst.str(string("cyclep="))               'display cyclewidth, and pulsewidth from receiver
      ' pst.dec (cyclep)
       pst.str(string(13,"pulsewidthp="))
       pst.dec(pulsewidthp)
                                             
       waitcnt(clkfreq/1000+cnt)
       'pst.clear                      
    pub plow 
    dira[5..6]~~
                                                     'notes stickup=154300
                                                                                 'deadstick=122000
                                                                       'stickdown=89600
                                                                        
    repeat                                                                       
          outa[6]~  'added to prevent shootthrough
                                               'if stick is pushed up then turn on fwd 
         repeat while pulsewidthp>132_400 and pulsewidthp <160_000
         
         
          outa[5]~~     
          
      outa[5]~ 
       
         
              
       repeat while pulsewidthp<110_400 and pulsewidthp >83_000          'if stick is pushed up then turn on reverse 
         
          outa[6]~~
               
      
            
        
    
                                             
       
          
     
                                                         
         
    
    Simple_MOSFET_H-Bridge duane j.png
  • mikeamikea Posts: 283
    edited 2012-08-11 14:28
    I tried starting the prop with no outside influence, i unhooked in/outgoing pins until about 10 seconds passed then connected them, but seemed to not make a difference. Also the first proto board i had with this setup i think i damaged the usb plug by leaving in the computer. my guess is it was getting power or ground and the extra current burned it. The computer would later say it couldnt find the prop, but after trying it again another day it worked again but not consistently. whats not in the diagram is a voltage divider, that limits voltage from the r/c radio into pin 2 to 3.3 volts. the current problem was present before i added the divider, i thought maybe the 5 volts somehow damaged the chip but read a thread that says the prop will tolerate 5 volts in as long as the current is really limited. i dropped it to 3.3 anyway between 3300 and 6800 ohm resistor.thanks-mike
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-11 15:13
    You haven't initialized pulsewidthp although it will be initialized to zero when the program starts.

    Your indenting is inconsistent. The statements that are at the same level of nesting should line up. I don't think it will make a difference, but it makes the program hard to read.

    Why the 4th WAITCNT? Once you see the HIGH-LOW transition, you're done with the pulse The WAITCNT for LOW-HIGH at the beginning of the loop is ok since it sets the initial condition for the loop.

    Why the code for CTRA? You're not using it otherwise. How about commenting it out even though it shouldn't affect anything.
  • mikeamikea Posts: 283
    edited 2012-08-11 15:42
    Thanks Mike. i will comment out the ctra, it was from something else that was deleted. I was looking to see what the overall cycle time was with the last wait. Just extra info. Can you see anything else in this that would possibly cause the pulsing condition?-mike
  • mikeamikea Posts: 283
    edited 2012-08-12 04:23
    I found the problem. It is the same as in this thread http://forums.parallax.com/showthread.php?135067-Serial-Quirk&p=1043169&viewfull=1#post1043169 .I dont completely understand it yet other than the related symptoms, but it was trying to reset when the prop was supposed to send info back to the pc and no usb cord was plugged in. I commented out the pst display section and the problem so far has disappeared. -mike
  • mikeamikea Posts: 283
    edited 2012-08-12 04:29
    I found the problem. It is the same as in this thread http://forums.parallax.com/showthread.php?135067-Serial-Quirk&p=1043169&viewfull=1#post1043169 .I dont completely understand it yet other than the related symptoms, but it was trying to reset when the prop was supposed to send info back to the pc and no usb cord was plugged in. I commented out the pst display section and the problem so far has disappeared. -mike
Sign In or Register to comment.