Hello! I am using a DSP56F805 EVM. I am trying to run the ADC. I started by running the ADC application found in the applications folder that comes with SDK. When I ran the program, it halts upon entry to main because that is what is in the debugger settings. The stack pane of the IDE indicates this: archStart main Everything's fine. I proceed to carefully strip off the code that I do not need. When i have stripped off code such that only the following remain: /***************************************************************************** * * Motorola Inc. * (c) Copyright 2000 Motorola, Inc. * ALL RIGHTS RESERVED. * ****************************************************************************** * * File Name: adcapp.c * * Description: ADC device driver * * Modules Included: * < main > * < ZeroCallBack > * < CC_CallBack > * < CC_CallBack_B > * *****************************************************************************/ #include "port.h" #include "arch.h" #include "io.h" #include "string.h" #include "fcntl.h" #include "assert.h" #include "adc.h" #include "led.h" #include "periph.h" #include "gpio.h" #include "types.h" int zeroCnt; /* sero crossing counter */ void ZeroCallBack( adc_eCallbackType type, adc_tSampleMask causedSampleMask ); int CCFlag; /* synchronization flag */ int CCFlag_B; /* synchronization flag for ADC B */ void CC_CallBack( adc_eCallbackType type, adc_tSampleMask causedSampleMask ); void CC_CallBack_B( adc_eCallbackType type, adc_tSampleMask causedSampleMask ); static const adc_sState sadc = { /* AnalogChannel = */ ADC_CHANNEL_7, /* NumSamplesPerScan = */ 2, /* OffsetRegister = */ FRAC16(0.5), /* LowLimitRegister = */ 0, /* HighLimitRegister = */ 0, /* ZeroCrossing = */ ADC_ZC_ANY, }; struct ChannelData { UWord16 handle; ssize_t len; Frac16 Buf[8]; }; struct ChannelData Data0; /***************************************************************************** * * Module: main * * Description: ADC test application * * Returns: none * * Arguments: none * * Range Issues: * * Special Issues: * * Test Method: visual validation * *****************************************************************************/ main() { Data0.handle = open(BSP_DEVICE_NAME_ADC_0, 0, &sadc ); while(1) { Data0.len = read( Data0.handle, Data0.Buf, sizeof(Data0.Buf) ); } }//end of main() void ZeroCallBack( adc_eCallbackType type, adc_tSampleMask causedSampleMask ) { zeroCnt++; } void CC_CallBack( adc_eCallbackType type, adc_tSampleMask causedSampleMask ) { CCFlag = 1; } The stack pane shows these upon halting at application launch (Debugger setting: Stop on application launch at Default language entry point): Stack Pane 0x00002170<Unknown> configInterruptVector @DummyFn1 main When I changed the Debugger setting to: Stop on application launch, User specified, archStart The stack pane shows the following archStart archStart It seems that interrupts are firing even before the program enters main, even before the ADC is opened. The ADC was not even started because there were no calls ioctl(Data0.handle,ADC_START,0). Also, it takes longer for the application to halt after I hit the debug button. It seems that the code is wandering in the woods before it comes to its senses. What do you think? Roger _________________________________________________________________ Internet access plans that fit your lifestyle -- join MSN. http://resourcecenter.msn.com/access/plans/default.asp |
|
ADC driver and Interrupts (DSP56F805)
Started by ●October 18, 2002
Reply by ●October 18, 20022002-10-18
The key to using the SDK is taking control over what is in the
appconfig.h file. Everthing you put in there controls what happens before
the main procedure is called. Config.c runs out of the ArchStart
procedure, which is started from the bootloader. Config.c starts up the
drivers that you have specified in appconfig.h. Interrupts are enabled
when you get to main.c.
I you want control of the startup process, you will have to understand
how this process works.
As far as the ADC goes, it will startup with a default configuration,
or as overridden via appconfig.h defines.
Reading the appropriate app.notes may be of help
also.
Jerry.
|