Hi all,
as this has been a quite weird bug so far, and Sylvain now seems to have run into some related problems when trying to make a SDCCH8 on TS1 work, I'll elaborate a bit more on it.
Before commit 0e9d250407f589cff312adc6c9e2c83f6af37de5, what happened was as follows:
1) The time between the TDMA interrupt happening and starting to execute l1_sync() and actually being able to configure the TPU window and tell the DSP what to do was too short for performing the scheduled work in the very same TDMA frame.
2) As a result, the actions that we thought were performed in the same TDMA were actually performed one TDMA later. Somehow we must have had another off-by-one error and thus the two errors compensated themselves in most cases, particularly for Rx
3) When trying to send, we hand a MAC BLOCK of 23 bytes to the DSP, after which the DSP has to do the FEC, Fire CRC, burst spreading, etc - before being able to generate the bits for the furst burst. Those bits then get sent over the TSP to the ABB (into its burst buffer), from where they are sent based on TPU signals.
So what happened is that the data of the first burst was not in the burst buffer yet, and the TPU signals triggered sending the last burst of the previous MAC block, rather than the first burst of the current.
This is why Dieter added the
tpu_enq_at(5000 - 10); /* TPU_CLOCK_RANGE - EPSILON_SYNC */
to l1s_tx_win_ctrl(), thereby delaying the TPU signal generation by one TDMA frame. At that time, the DSP has by long finished writing the new burst bits in to the ABB burst buffer, and we can transmit the correct burst data.
I personally believe it would be better to simply move the TDMA interrupt a bit more ahead. Rather than occurring immediately before TS0, we could set SYNCHRO in a way that it occurs at a defined point in time still quite a bit into TS7.
In this case we hopefully have enough time for the DSP to be able to transmit in TS0, making the timing sequence easier to understand.
Hope that helps to explain...
- The time between the TDMA interrupt happening and starting to execute
l1_sync() and actually being able to configure the TPU window and tell the DSP what to do was too short for performing the scheduled work in the very same TDMA frame.
I think it's never executed in the same TDMA frame.
My understanding is :
- The frame interrupt is triggered (let's call this instant t=0 qbits) - At this moment the interrupt handler is called and we : . setup some command for the db in the API DB page. (0 or 1) . put a scenario in the TPU memory. . enable the tpu to generate a frame interrupt to the DSP at the _next_ frame. ( t = 5000 qbits ) . enable tpu_en so the TPU start the execution of the scenario we just put in. - It's only at the next frame (t = 5000) that the DSP will actually read what we asked it to do. . for RX, it will just setup a buffer to receive the data . for TX, it will do fire/crc/... and send the data to the ABB buffer
So our TPU window _must_ be during that next frame ...
* For RX it always worked for TS=0 because in l1s_rx_win_ctrl we put the first command AT(DSP_SETUP_TIME - 100) ... which when you do the modulo 5000 is somewhere around 4944. So when we start executing the TPU scenario in the interrupt handler, that first AT command will force to wait almost an entire frame and the rx window will be properly placed in the next frame.
* When I tried to open the RX window at TS=1 by just offsetting the commands of l1s_rx_win_ctrl by 625 qbits, that changed the first AT command to something around ~ 550, so when we set tpu_en, that time was possibly not yet passsed and the RX window was executed 1 TDMA frame early. I could work around that by forcing a AT(0) as the first command if the start > 0. (but that's a quick hack to test my theory)
* For TX, we need the tpu_enq_at(5000 - 10) all the time because TX is always 3 TS after RX, the time of the first AT command was always not yet passed before we enabled tpu_en so we executed the TX window 1 timeslot early ...
Sylvain
Hi Sylvain,
On Sun, Apr 25, 2010 at 03:16:48PM +0000, 246tnt@gmail.com wrote:
- The time between the TDMA interrupt happening and starting to execute
l1_sync() and actually being able to configure the TPU window and tell the DSP what to do was too short for performing the scheduled work in the very same TDMA frame.
I think it's never executed in the same TDMA frame.
My understanding is : [...]
Yes, you were completely right. I was confused before. I agree with everything you have said.
baseband-devel@lists.osmocom.org