ZVL32 ADC question

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

ZVL32 ADC question

1,174件の閲覧回数
irobin
NXP Employee
NXP Employee

Hi, Guys, 

I met a trouble on ADC of S9S12ZVL32.

ADC can work before i put init_linphy() into the project.

i found in init_linphy(),  when i change LP0IE=0x00, ADC cannot get the result. but when change it to LP0IE=0xC0, ADC can get the result.

it did confused me. i put my code here in the attached. Can anyone help me find out the root?

 

Thanks!

 

Robin

Original Attachment has been moved to: zvlxx.rar

ラベル(1)
タグ(2)
2 返答(返信)

968件の閲覧回数
RadekS
NXP Employee
NXP Employee

Hi Xioabin,

  1. Your adc_csl contains these commands: 0x00CDA000 and 0x00CCA000. There missing command which is marked as “End Of List”. So, ADC do not know where should finish with conversion sequence. Therefore the last command should be probably 0xC0CCA000. See more in chapter 9.4.2.15 ADC Command Register 0 (ADCCMD_0) in RM.
  2. You placed adc_csl into ADC_COMMAND user segment, however I do not see such segment definition in your prm file.

For correct work of ADC DMA, the command list and result list must by aligned to 4 byte boundary.

I would like to recommend declare adc_csl[] and adc_result[] as:

//Command and result list have to be aligned - Base Pointer Register[1,0]=0;

const dword adc_csl[] __attribute__ ((aligned (4))) { //max 256 bytes = 64 commands per 4-byte entries

//...

word adc_result[] __attribute__ ((aligned (4))) {  //max 128 bytes = 64 results per 2-byte entries

//...

In that case, you don’t need explicitly specify where command and result will be placed. Linker will place these object automatically.

Since these lists may not be accessed directly in code, I would like to recommend place their names into ENTRIES section in prm linker file for avoid to optimize out it as unused objects. For example:

ENTRIES /* keep the following unreferenced variables */

adc_csl, adc_result

END

In attachment is simple ADC example code S12ZVL.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

968件の閲覧回数
irobin
NXP Employee
NXP Employee

Hi, Radek,

big thanks for your promptly support to resolve my trouble. Yes, aligned by 4 byte is key point. I check the address of adc_csl(adc_command) in map file is not aligned by 4 byte in original source/code, but it is aligned by 4 byte as per your guide and the code works correctly.

Thanks again!

Good day!

Cheers!

Robin

0 件の賞賛
返信