LPC1788 DAC Generates a HardFault Exception

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

LPC1788 DAC Generates a HardFault Exception

1,541件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kralux on Sat Oct 01 23:54:27 MST 2011
This is an issue that arises with the LPC1788.

This code snippet generates a hard fault exception which makes no sense at all:

LPC_IOCON->P0_26 = 0x10 + (1 << 16); // DAC_OUT Enabled - Powers up that circuit as well
LPC_DAC->CR = (620 << 6) | DAC_LOW_BIAS_CURRENT; // set to 2V and slow update


The first line simply powers up the DAC by enabling the DAC_OUT pin.

The second line puts a value in the CR of the DAC.
This second line is the one that generates the hard fault exception.
It makes no sense.
I have verified the addresses are all correct.
The powering up of the various blocks is as such:
#define PCONP_Val             0x40C09A27
which should be amply sufficient.

Note that in the Red Code Suite under peripherals, the DAC is still grayed out which seems to indicate it is not powered up. However, per the user manual it should be (see page 753 of UM10470 rev1.5).

Let me know your experience with the DAC and whether this is a bug of the chip itself.
0 件の賞賛
返信
6 返答(返信)

1,466件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kralux on Mon Oct 03 12:54:25 MST 2011
You are 100% correct. I am in sleep deprived mode :confused: and I take back what I said that was so stupid... sorry about that...

That was the main source of my problems.

Issue is now fixed. Thank you Zero!
0 件の賞賛
返信

1,466件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Oct 03 12:46:28 MST 2011

Quote: kralux
0x10 is identical to (2<<0).



In which world :confused::confused:

Are you familiar with hex and bin values?
0 件の賞賛
返信

1,466件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kralux on Mon Oct 03 12:41:30 MST 2011

Quote: Zero
Which function is 0x10 :confused::confused: Perhaps function 2 could help

LPC_IOCON->P0_26 =  (2<<0) | (1 << 16); // DAC_OUT Enabled - Powers up



"0x" means it is a hex number.
0x10 is identical to (2<<0).
This is definitely not the source of the issue.
0 件の賞賛
返信

1,466件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sun Oct 02 19:48:00 MST 2011

Quote: sergio

LPC_IOCON->P0_26 = 0x10 + (1 << 16); // DAC_OUT Enabled - Powers up that circuit as well



Which function is 0x10 :confused::confused: Perhaps function 2 could help

LPC_IOCON->P0_26 =  (2<<0) | (1 << 16); // DAC_OUT Enabled - Powers up
0 件の賞賛
返信

1,466件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kralux on Sun Oct 02 15:59:17 MST 2011

Quote: sergio
Let me suggest one thing, dont you forget to clock DAC ?



The clock is enabled because the DAC operates from the common PCLK that clocks both the bus interface and functional portion of most APB peripherals.
So there is no separate DAC clock control. It is the same for most peripherals and it is already on (LPC_SC->PCLKSEL = 1).
0 件の賞賛
返信

1,466件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sergio on Sun Oct 02 09:16:26 MST 2011
Let me suggest one thing, dont you forget to clock DAC ?
0 件の賞賛
返信