P1V reset bug
rjo__
Posts: 2,114
in Propeller 1
This is not the same reset problem that was originally identified for the P1V... completely different, but might be related. I have been using the lastest P1V from Jac's github repository.
I have been looking at this for several months and find it almost impossible to describe in a way so that if I were reading this post, I could understand what in the hell I am talking about... but I think it is important. So, I'm going to try.
Normally, if we have a problem, we post our code. That won't help here, because the code runs just fine on regular P1 board and to actually run it on a P1V and see what I'm talking about you would need to have a camera adapter board as I described recently, configured for the FPGA board of your choice. Not likely:)
I am calling this a reset bug, because if I issue a reboot command from Spin at the end of the Spin run, the issue largely... but not completely... goes away.
Ok... so I have a segment of Spin code, which is supposed to count the lines in a frame coming from a generic omnivision camera. To do this, I am using waitpeq and waitpne on the VSync pin. At the magic moment, I accumulate the HREF transitions in phsb, using Counter B set to the HREF pin.
I have written the code to do this in both Spin and PASM. The logic is identical and it works perfectly on a regular P1 board. The PASM code works perfectly on a P1V also. But the SPIN code only works correctly ... every other time. So... for example, the first time the code is loaded to RAM, it works. The second time it doesn't... third time it does... the fourth time it doesn't and so on... all day long:)
Now, if I issue a software reboot at the end of the code... which I execute from the serial terminal...through a command. Of course, since I don't have an EEPROM on any of my boards, reboot doesn't actually reboot. But when I subsequently reload the program to RAM... the behavior is locked in place... if it failed before, it fails again. If it succeeded before, it succeeds again. This behavior remains consistent so long as I issue a soft reboot before reloading. PropTool and PropellerIDE same.
I think the failure in my case is in waitpeq in the following snippet:
I have been looking at this for several months and find it almost impossible to describe in a way so that if I were reading this post, I could understand what in the hell I am talking about... but I think it is important. So, I'm going to try.
Normally, if we have a problem, we post our code. That won't help here, because the code runs just fine on regular P1 board and to actually run it on a P1V and see what I'm talking about you would need to have a camera adapter board as I described recently, configured for the FPGA board of your choice. Not likely:)
I am calling this a reset bug, because if I issue a reboot command from Spin at the end of the Spin run, the issue largely... but not completely... goes away.
Ok... so I have a segment of Spin code, which is supposed to count the lines in a frame coming from a generic omnivision camera. To do this, I am using waitpeq and waitpne on the VSync pin. At the magic moment, I accumulate the HREF transitions in phsb, using Counter B set to the HREF pin.
I have written the code to do this in both Spin and PASM. The logic is identical and it works perfectly on a regular P1 board. The PASM code works perfectly on a P1V also. But the SPIN code only works correctly ... every other time. So... for example, the first time the code is loaded to RAM, it works. The second time it doesn't... third time it does... the fourth time it doesn't and so on... all day long:)
Now, if I issue a software reboot at the end of the code... which I execute from the serial terminal...through a command. Of course, since I don't have an EEPROM on any of my boards, reboot doesn't actually reboot. But when I subsequently reload the program to RAM... the behavior is locked in place... if it failed before, it fails again. If it succeeded before, it succeeds again. This behavior remains consistent so long as I issue a soft reboot before reloading. PropTool and PropellerIDE same.
I think the failure in my case is in waitpeq in the following snippet:
' ********************************************************* 'here is the problem pinstate:=1<< _CAM_VSYNC_PIN ctrb := %01010<< 26 + _CAM_HREF_PIN frqb:=1 waitpne(pinstate,pinstate,0) waitpeq (pinstate,pinstate,0) 'wait til vsync hi waitpne(pinstate,pinstate,0) 'wait til vsync low time:=cnt phsb := 0 'start measuring positive edges on HREF waitpeq (pinstate,pinstate,0) linesperframe:=phsb time:=cnt-time ' ser.str(string(" Spin Lines Per Frame = ")) ser.dec(linesperframe) ser.str(string(" (time=)")) ser.dec(time) '***********************************************************