Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 02:02 15 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 op-amps and comparators

Author Message
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 734
Posted: 12:52am 01 Oct 2020
Copy link to clipboard 
Print this post

Is it possible to access the on chip
op-amps and/or comparators using MMBasic ?
my site
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10582
Posted: 08:59am 01 Oct 2020
Copy link to clipboard 
Print this post

If the pins are available which is the case for one of the opamps (the pins for the other are used for SDRAM access) then you can peek and poke the registers but you will need the H7 reference manual to know what to do
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 734
Posted: 05:36pm 01 Oct 2020
Copy link to clipboard 
Print this post

  matherp said  If the pins are available which is the case for one of the opamps (the pins for the other are used for SDRAM access) then you can peek and poke the registers but you will need the H7 reference manual to know what to do

What info I have found says the default is for external passive components ,
so I shouldn't need peeking or poking .
What I am unable to find is the actual pin numbers (designations ? ) ?
my site
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10582
Posted: 05:49pm 01 Oct 2020
Copy link to clipboard 
Print this post

Pretty certain you will have to do something to enable the opamp - not something I have ever looked at. UPDATE code from the ST H743 sample opamp project below:

void HAL_OPAMP_MspInit(OPAMP_HandleTypeDef *hopamp)
{
 /* Configuration of OPAMP clock */
 __HAL_RCC_OPAMP_CLK_ENABLE();  
}
void OPAMP_Config_Power(uint32_t powermode)
{
 /* Set OPAMP instance */
 OpampHandle.Instance = OPAMP1;

 /*##-1- Deinit  OPAMP    ##################################################*/
 HAL_OPAMP_DeInit(&OpampHandle);

 /*##-2- Configure OPAMP    ##################################################*/
 
 /* Select power mode */  
 if (powermode == OPAMP_POWERMODE_NORMAL)
 {
   OpampHandle.Init.PowerMode = OPAMP_POWERMODE_NORMAL;
 }
 else
 {
   OpampHandle.Init.PowerMode = OPAMP_POWERMODE_HIGHSPEED;
 }

 /* Select FOLLOWER Mode */
 OpampHandle.Init.Mode = OPAMP_FOLLOWER_MODE;  

 /* Select VPx as input for OPAMP */
 OpampHandle.Init.NonInvertingInput = OPAMP_NONINVERTINGINPUT_DAC_CH;
 
 /* Select the factory trimming */
 OpampHandle.Init.UserTrimming = OPAMP_TRIMMING_FACTORY;

 /* Init */
 if(HAL_OK != HAL_OPAMP_Init(&OpampHandle))
 {
   Error_Handler();
 }

 /*##-3- Start OPAMP    #####################################################*/
 /* Enable OPAMP */
 if(HAL_OK != HAL_OPAMP_Start(&OpampHandle))
 {
   Error_Handler();
 }  
}

Been posted many times before but here is the pin allocation
       { NULL,  0, PUNUSED , NULL, 0},                                                         // pin 0
{ NULL,  0, PUNUSED , NULL, 0},                                                         // pin 1 3V3
{ NULL,  0, PUNUSED , NULL, 0},                                                         // pin 2 5V
       { GPIOB,  GPIO_PIN_9,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 3 I2C-SDA
{ NULL,  0, PUNUSED , NULL, 0},                                                         // pin 4 5V
       { GPIOB,  GPIO_PIN_8,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 5 I2C-SCK
       { NULL,  0, PUNUSED , NULL, 0},                                                         // pin 6 GND
       { GPIOC,  GPIO_PIN_1,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC1, ADC_CHANNEL_11},    // pin 7 COUNT1
{ GPIOA,  GPIO_PIN_2,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC2, ADC_CHANNEL_14},    // pin 8 COM1-TX
       { NULL,  0, PUNUSED , NULL, 0},                                                         // pin 9 GND
{ GPIOA,  GPIO_PIN_3,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC1, ADC_CHANNEL_15},    // pin 10 COM1-RX
       { GPIOH,  GPIO_PIN_14,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                            // pin 11 COM2-RX
{ GPIOA,  GPIO_PIN_6,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC2, ADC_CHANNEL_3},     // pin 12 PWM-1A
{ GPIOC,  GPIO_PIN_2,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC3, ADC_CHANNEL_0},     // pin 13 COUNT2,I2S-SDI
       { NULL,  0, PUNUSED , NULL, 0},                                                         // pin 14 GND
{ GPIOC,  GPIO_PIN_3,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC3, ADC_CHANNEL_1},     // pin 15 COUNT3,I2S-SDO
{ GPIOA,  GPIO_PIN_0,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC1, ADC_CHANNEL_16},    // pin 16 COM2-TX
       { NULL,  0, PUNUSED , NULL, 0},                                                         // pin 17 3V3
       { GPIOA,  GPIO_PIN_15,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                            // pin 18 COUNT5 - FAST
       { GPIOB,  GPIO_PIN_5,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 19 SPI-OUT
       { NULL,  0, PUNUSED , NULL, 0},                                                         // pin 20 GND
       { GPIOB,  GPIO_PIN_4,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 21 SPI-IN
       { GPIOA,  GPIO_PIN_7,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC1, ADC_CHANNEL_7},     // pin 22 PWM-1B
       { GPIOB,  GPIO_PIN_3,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 23 SPI-CLK
{ GPIOC,  GPIO_PIN_4,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC1, ADC_CHANNEL_4},     // pin 24 COUNT4
       { NULL,  0, PUNUSED , NULL, 0},                                                         // pin 25 GND
{ GPIOC,  GPIO_PIN_5,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC2, ADC_CHANNEL_8},     // pin 26
       { GPIOB,  GPIO_PIN_7,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 27 I2C2-SDA
       { GPIOH,  GPIO_PIN_11,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                            // pin 28 I2C2-SCK
{ GPIOB,  GPIO_PIN_0,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC2, ADC_CHANNEL_9},     // pin 29 PWM-1C
       { NULL,  0, PUNUSED , NULL, 0},                                                         // pin 30 GND
       { GPIOC,  GPIO_PIN_7,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 31 PWM-2B
       { GPIOI,  GPIO_PIN_8,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 32
       { GPIOI,  GPIO_PIN_3,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 33
       { NULL,  0, PUNUSED , NULL, 0},                                                         // pin 34 GND
       { GPIOB,  GPIO_PIN_14,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                            // pin 35 SPI2-IN
       { GPIOC,  GPIO_PIN_6,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 36 PWM-2A
       { GPIOA,  GPIO_PIN_1,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC1, ADC_CHANNEL_17},    // pin 37 COM1-DE
       { GPIOB,  GPIO_PIN_15,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                            // pin 38 SPI2-OUT
       { NULL,  0, PUNUSED , NULL, 0},                                                         // pin 39 GND
       { GPIOB,  GPIO_PIN_13,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                            // pin 40 SPI2-CLK
       { GPIOB,  GPIO_PIN_12,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                            // pin 41 IR
       { GPIOE,  GPIO_PIN_2,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                             // pin 42 DS18B20
       { GPIOB,  GPIO_PIN_11,  DIGITAL_IN | DIGITAL_OUT , NULL, 0},                            // pin 43 Nunchuck SDA
       { GPIOH,  GPIO_PIN_4,  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN , ADC3, ADC_CHANNEL_15},    // pin 44 Nunchuck SCK

Edited 2020-10-02 04:02 by matherp
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 734
Posted: 06:47pm 01 Oct 2020
Copy link to clipboard 
Print this post

> If the pins are available which is
> the case for one of the opamps

And those pins are ?
- input = pin ?
+ input = pin ?
output  = pin ?

I don't see any reference on your chart ( Thank You ! )
.... But I may be missing something .....
my site
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10582
Posted: 07:03pm 01 Oct 2020
Copy link to clipboard 
Print this post

Your are going to have to do some serious research if you want to make this work - start with the H7 datasheet and the H7 reference manual - no spoon feeding on this one - sorry
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 734
Posted: 08:10pm 01 Oct 2020
Copy link to clipboard 
Print this post

Thank You !
I ' ll probably end up using an external op amp ,
but I will first search awhile .
my site
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025