Three Questions about TBDML

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

Three Questions about TBDML

5,750 Views
efan
Contributor I
Hi!
             I have made the TBDML with JB16,and I use CodeWarrior3.1 to devolop my project.If I make the project,and press the "debug" button,it can load my .s19 file to the flash successfully,and then I can use the command such as go,halt,step...,but I can't the "load" and "Flash" command.

            When I press the "load" button,the message "load failed" appear. But if I close the True Time debbuger and press the "debug" button again,it can load the .s19 file successfully.Why?

           When I press the "Flash" command,I can erase the select flash block,but when I want to load
the .s19 file. Nothing happened and no message box appear,the Flash is still blank.
  
           When I read the JB16 firmware.I am confused by the Rx and Tx speed table.
 
const unsigned int bdm_tx_sel_tresholds[]=
  {914/2,     1129/2,    1335/2,    1541/2,    1747/2,    1952/2,    2157/2,    2465/2,    2877/2,    3288/2,
   3800/2,    4418/2,    5136/2,    6059/2,    7189/2,    8524/2,    10066/2,   11814/2,   13867/2,   16988/2}; 
void (* const bdm_tx_sel_ptrs[])(unsigned char)=
  {bdm_tx1, bdm_tx2, bdm_tx3, bdm_tx4, bdm_tx5, bdm_tx6, bdm_tx7, bdm_tx8, bdm_tx9, bdm_tx10,
   bdm_tx11,bdm_tx12,bdm_tx13,bdm_tx14,bdm_tx15,bdm_tx16,bdm_tx17,bdm_tx18,bdm_tx19,bdm_empty_rx_tx};
//new values for tics as the JB16 CPU is 2 times faster
const unsigned int bdm_rx_sel_tresholds[]=
  {853/2,     1101/2,    1347/2,    1592/2,    1837/2,    2202/2,    2694/2,    3303/2,    4042/2,    4897/2,
   5998/2,    7346/2,    9055/2,    11257/2,   13952/2,   17919/2};

Where the figures in the bdm_tx_sel_tresholds  and  bdm_rx_sel_tresholds tabel come from ?.Are they measured by someone? How to  measure it?
 
0 Kudos
Reply
1 Reply

821 Views
DanielM
Contributor III
Hi,

ad 1) Use new CodeWarrior. 3.1 is too old and does not support some of the feature required for flash programming.

ad 2) Probably the same as 1). Try this with version 4.5. If it persists, I will have a look into it.

ad 3) These are my original numbers. The divide by 2 was added by whoever did the JB16 port as JB16 runs twice as fast. The numbers come from the BDM requirements. Some of these come from the S12 documentation, some of them are my own as the manual is not detailed enough.

A) Transmission

Every bit starts with a low pulse, this low pulse must be:

A1) At least 2 BDM clock cycles long when transmitting a '1'
A2) Max. 8 BDM clock cycles long when transmitting a '1'
A3) At least 11 BDM clock cycles long when transmitting a '0'
A4) Max. 14 BDM clock cycles long when transmitting a '0'

Also

A5) The next bit cannot start before 16 BDM clock cycles from the beginning of the current bit

B) Reception

B1) Every bit starts with a low pulse, this low pulse must be at least 2 BDM clock cycles long
B2) The input signal must not be sampled earlier than 9 BDM clock cycles from the beginning of the bit
B3) The input signal must not be sampled later than 12.33 BDM clock cycles from the beginning of the bit.

Also

B4) The next bit cannot start before 16 BDM clock cycles from the beginning of the current bit

These constraints dictate the BDM frequency limits for each routine. The capabilities of the different routines overlap (e.g. at 6.5MHz BDM clock you can use either bdm_tx1 or bdm_tx2 and both will work). The mid point in the overlap is selected as the treshold for switching from one of the routines to the other to give the cable maximum immunity against target frequency variations and noise.

The situation is further complicated by the fact that when the cable measures BDM frequency of the device by using the SYNC BDM command, the measurement is inaccurate, so more overlap is needed to account for this inaccuracy.

You want to give the overlap as large as possible to guarantee functionality, but on the other hand you want to limit the number of routines which need to be created as this wastes Flash space in the JB8. It took me a while to come up with minimum number of routines which cover the whole band with the required overlaps (at least I believe this is the minimum set for my constraints).

The Tx constraints are harder to satisfy and therefore you have more Tx routines than there are Rx routines.

I hope this answers your question.

Daniel
0 Kudos
Reply