Hi,
I'm using the evaluation kit for QN9080 and I want to use one channel for the ADC. I used the config tools for pin configuration in MCUxpress IDE and selected channel 4 which is routed to GPIOA8/PA08 . However when I give an analog signal on PA08 of the evaluation kit, I don't see any changes.
I did refer to the developer manual which only says that GPIOA8 is routed to PA08
Can someone help me what else needs to be done in order to make it work?
Thanks,
Sandeep
Solved! Go to Solution.
Hello,
Please to understand the example you are using check the BLE Demo Applications User's Guide .
Could you please try doing it without the config tools ? You will only need to change the ADC pins and channel to make this work. The ADC channel 13 it's for the temperature sensor, in this case you will not use it so if you do not use the config tools and do it by yourself you can set the channel you want and the pin you want.
I mentioned that example as the only modifications needed are pin configurations as the functions to retrieve the information of the ADC while using Bluetooth LE should not be that hard for you as it is already done.
Where and how are you doing this ? What exactly are you modifying ? Could you please help me with that information ?
Regards,
Estephania
Hello,
Which example are you using ? You can check the drivers ones in the SDK, the adc_basic example uses the ADC in the pin you are trying to use it.
Regards,
Estephania
Hi Estephania,
Thanks for your reply.
I'm using heart_rate_sensor freertos example.
adc_basic example also has the same setting as I configured.
My configuration is as shown in the pic below:
When I apply an analog signal at GPIOA8 (PA08), the output I get is 29700. It's a constant output. Expected output should not be a constant value.
My ADC configuration in board.c file is as follows:
adc_config_t adcConfigStruct;
adc_sd_config_t adcSdConfigStruct;
/* Power on ADC */
POWER_EnableADC(true);
/**
* Initial ADC to default configuration.
*/
ADC_GetDefaultConfig(&adcConfigStruct);
adcConfigStruct.channelEnable = (1U << 4);
adcConfigStruct.channelConfig = (0 << 4);
adcConfigStruct.dataFormat = kADC_ForceUnsigned;
ADC_Init(ADC, &adcConfigStruct);
/* Initial ADC Sigma Delta(SD) configuration */
ADC_GetSdDefaultConfig(&adcSdConfigStruct);
adcSdConfigStruct.refGain = kADC_RefGain1;
ADC_SetSdConfig(ADC, ADC_CFG_IDX, &adcSdConfigStruct);
/* Bandgap voltage */
mAdcBandgap = ADC_GetBandgapCalibrationResult(ADC, ADC_CFG_IDX);
/* Calibration VINN value */
mAdcVinn = ADC_GetVinnCalibrationResult(ADC, &adcConfigStruct);
ADC_PgaChopperEnable(ADC, true);
//ADC_EnableBatteryMonitor(true);
/* Enable ADC */
ADC_Enable(ADC, true);
Hello,
Are you debugging your project ? Are you sure it is working correctly ? Could you please help me confirm that there is no hard fault or bus fault ?
Also, are you sure that none of the initial configurations of the project have been replaced by your config tools usage ?
Could you please check the temperature_sensor example? I believe that if you use that example as a base with wireless functionality might be a best option for you.
Regards,
Estephania
Hi Estephania,
I'm not getting any hard fault.
I'm not changing any initial configuration. I used the heart_rate_sensor example and added the ADC4 channel GPIO pin to use the ADC. I didn't make any changes .
I'm trying to send the ADC value using the heart_rate_service BLE characteristic and I receive just one value, 29700. It doesn't change.
How can I make the ADC work?
Thanks
Hello
Could you please check the temperature_sensor example? I believe that if you use that example as a base with wireless functionality might be a best option for you.
In the example the ADC it's being used.
Regards,
Estephania
Estephania,
The temperature_sensor example has #define ADC channel 13 routed to ADC4. I don't understand how that's possible.
Can you please explain? I think I'm unable to route the pin to correct ADC channel.
For example,if I want to use ADC4 channel then should I set the bit in the channel as (1U << 4) ?
Hello,
Please to understand the example you are using check the BLE Demo Applications User's Guide .
Could you please try doing it without the config tools ? You will only need to change the ADC pins and channel to make this work. The ADC channel 13 it's for the temperature sensor, in this case you will not use it so if you do not use the config tools and do it by yourself you can set the channel you want and the pin you want.
I mentioned that example as the only modifications needed are pin configurations as the functions to retrieve the information of the ADC while using Bluetooth LE should not be that hard for you as it is already done.
Where and how are you doing this ? What exactly are you modifying ? Could you please help me with that information ?
Regards,
Estephania
Thanks Estephania for your help, I'm now successfully able to configure the ADC based on the information provided in the table 466: