Switching from Input capture to overflow on 9S08AW60 timer problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Switching from Input capture to overflow on 9S08AW60 timer problem

1,142 Views
shellpry
Contributor I
Hello!
I'm currently using the AW60 demo board.  I'm configuring this for LIN.  Currently running at 2400 for troubleshooting purposes.  Eventually to be run at 19.2k.  I have ported the example code from AN2503/D Slave LIN Driver for the QT/QY Family to the AW60.  
 
I have connected my transceiver up to a master node simulator I have used in the past.  The code makes it through the SYNCH correctly.  But at this point it will not read the ID correctly.  I'm using TPM1CH0.  It is switched between input capture mode and overflow mode.  Both are set to interrupt. 
 
For Break recognition, it is set to input capture and then switched to overflow mode to count the bit times.  Then the timer is set back to input capture for the synch process.  Once the start bit of the ID is captured, the timer is then set back to overflow. 
 
And here is where my problem is.  During the switching between input capture and overflow previous to this in the code, the transition has happened quickly and appropriately.  However, when the switch to overflow for reading the ID occurs, it takes about 7ms or more for the FIRST overflow to actually occur.  Which of course means I have lost my ID and only read 0xFF.  The bit times for overflow are the same from the break recognition.  And after that first overflow, the overflow timing stays correct for the baud rate.
 
I have not been able to find anything that is holding my code up.  If I use the P&E Multilink emulator, the code simply steps back to my main function (which only moves one buffer to another) after setting the timing correctly for the overflow.  It just doesn't happen for a long, long time.
 
Any suggestions?  I'm stuck.
 
thanks,
Labels (1)
0 Kudos
1 Reply

263 Views
shellpry
Contributor I
I think I found it.  For those interested, the problem was in the differences in the steps needed to reset the timer between the QT and AW.  I added a clear to the TPM1CNT register.  This took out the extra time.
 
Basically, when the timer switched for the input capture it retained the value in the TPM1CNT registers from the counting during the input capture procedure.  This added a lot of time to the overflow process.  By resetting the TPM1CNT register to 0x0000, it allowed the setting in TPM1MOD of 0x07D0 to be the correct time frame - from 0x0000 to 0x7D0; not 0x4BEE to 0x7D0. 
 
 
0 Kudos