Open XDK-Support opened 5 years ago
If I understand the ADC correctly what you're describing is connecting the microphone to the ADC channel 4. This is not always what you want to do if you want to measure this channel though. Therefore I don't think that always connecting the microphone for CH4
is correct. Instead you could
noise_sensor.noise
to read noisesetup mic: Microphone {
var mic = connect(samplecount=5000, samplerate=44100); // : array<int8>(length=5000)
}
I hope this helps!
Since I got no response I'll assume this issue is solved. Feel free to respond if you still have problems.
Hello wegendtbosch,
Unfortunately, I have to ask you to take a second look, using the noise sensor as you described works but the pin configuration is missing for the other ADC channels, such as PD5 and PD6, as I described in the last sentence of my last post.
Aside from that, the noise sensor usage with ch4 was copied from the WB 3.5 release notes which should, in that case, be corrected there or in Mita.
The ADC is initialized and enabled but reading an invalid configured input pin regardless of what channel is to be read due to missing initialization of the pin, therefore it returns weird readouts.
If you also check the generated includes in the files, there is no mention of a module that could be used to initialize the GPIOs as well. Therefore the GPIOs are not defined as inputs.
To solve this, a call of the functions BSP_ExtensionPort_ConnectAdc() and BSP_ExtensionPort_EnableAdc() from the BSP_ExtensionPort.h interface with the corresponding pin would be required.
Kind Regards
Ok, thanks for the additional feedback!
When using the
setup adc
in Mita with the XDK workbench for the ADC channel the code generated does not correctly set up the pin configuration for the channels.when using the following code:
It generates a config for the given channel in the file ConnectivityADCAdc.c and initializes the ADC with it.
But it is missing a pin configuration for the used pins. In case of the used microphone, there is also no voltage supply enabled for the microphone. For using the microphone, the function calls of
BSP_Mic_AKU340_Connect()
andBSP_Mic_AKU340_Enable()
are needed in the functionConnectivityADCAdc_Setup()
in the generated C code.For the other ADC channels, the function calls to configure the pins as inputs and connecting to them are missing too and would need to be added in the same manner as for the microphone.