HAL Opamp PSoC6

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
horiamodran
Level 2
Level 2
First like received 5 replies posted 5 questions asked

 

Using the ADB-Basic-Example (https://github.com/Infineon/mtb-example-hal-adc-basic) in Modus Toolbox I am trying to add an OpAmp before the ADC Component as in the diagram bellow (from PSoC Creator):

horiamodran_0-1682518557863.png

 

Here is the code I added i main.c: 

 

#define VPLUS_CHANNEL_0 (P10_0)
#define VREF_CHANNEL_0 (P10_1)
#define VOUT_OPAMP (P10_4)

 

int main(void)
{

[...]

cy_rslt_t result;

result = cyhal_opamp_init(&opamp_obj, VPLUS_CHANNEL_0, VREF_CHANNEL_0, VOUT_OPAMP);

if(result != CY_RSLT_SUCCESS)
{
printf("OPAMP configuration failed. Error: %ld\n", (long unsigned int)result);
CY_ASSERT(0);
}

[...]

}

 

When I debug the application I am getting OpAMP Configuration Failed message.

I am not sure what I did wrong here

 

 

0 Likes
1 Solution

Hi, 

Are you using PSoC 063 BLE for your project ? 
it seems like you want to set P9_0 and P9_1 as the input of Op-amp and P10_0 as the output. 
but refer to this diagram bellow, you only can set P9_2 as the output pin. 

Andrisetyabudi_0-1683272799928.png

datasheet 

and from HAL documentation, you can only set the pin ( input - output ) of Op-amp ( OA0 and OA1 )
But if you want to read the output of OP-amp ( OA0 ) through the SAR-ADC, it would be better to use PDL so you can set the OA0 as the buffer or amplifier for ADC. 
Please refer to this repository 

warm regards, 

Andri Setyabudi

 

View solution in original post

0 Likes
4 Replies
Raj_C
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 replies posted

Hi @horiamodran,

The dedicated pins for the OpAMP0 are P9[0] and P9[1]. If Other pins are used, they must be muxed to OA0 using AMUXBUS. Please ensure this setting.

Raj_JC_0-1682588360769.png

 

Please refer to the HAL document for the correct configuration of the OpAMP.

 

Additionally please let us know the device being used and if you still face the issue, please share the project file.

 

Thank you

Best Regards

Raj Chaudhari

lock attach
Attachments are accessible only for community members.
horiamodran
Level 2
Level 2
First like received 5 replies posted 5 questions asked

Hi @Raj_C ,

 

Thank you very much for your reply 🙂 

I had a look on the documentation and tried to change the pins , but is still the same error. I attach the project file

 

Thanks,

Horia Modran

0 Likes

Hi, 

Are you using PSoC 063 BLE for your project ? 
it seems like you want to set P9_0 and P9_1 as the input of Op-amp and P10_0 as the output. 
but refer to this diagram bellow, you only can set P9_2 as the output pin. 

Andrisetyabudi_0-1683272799928.png

datasheet 

and from HAL documentation, you can only set the pin ( input - output ) of Op-amp ( OA0 and OA1 )
But if you want to read the output of OP-amp ( OA0 ) through the SAR-ADC, it would be better to use PDL so you can set the OA0 as the buffer or amplifier for ADC. 
Please refer to this repository 

warm regards, 

Andri Setyabudi

 

0 Likes

Thanks, i will try this 🙂 

0 Likes