[libmaple] Black F407VET6

Limited support for STM32F4 Discovery, Nucleo and custom F4 boards
acronis
Posts: 142
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] Black F407VET6

Post by acronis » Sun Oct 15, 2017 12:43 pm

Steven Thank you.

This error is gone , but there were other

dc_read:412: error: base operand of '->' has non-pointer type 'const adc_dev'

on line

dataPoints[j+1] = ADC2->regs->DR & ADC_DR_DATA;


Code: Select all

void fetch() {  

//  const adc_dev *dev = PIN_MAP[analogInPin].adc_device;

  int channel = PIN_MAP[analogInPin].adc_channel;

  adc_set_sample_rate(&ADC1, ADC_SMPR_1_5); // ADC_SMPR_13_5, ADC_SMPR_1_5

  adc_set_sample_rate(&ADC2, ADC_SMPR_1_5); // ADC_SMPR_13_5, ADC_SMPR_1_5

  adc_set_reg_seqlen(&ADC1, 1);

  adc_set_reg_seqlen(&ADC2, 1);

  ADC1->regs->SQR3 = channel;

  ADC2->regs->SQR3 = channel;
  
    ADC1->regs->CR1 |= 0x70000; // ADC_CR1_FASTINT;

  ADC1->regs->CR2 |= ADC_CR2_CONT | ADC_CR2_SWSTART;

  ADC2->regs->CR2 |= ADC_CR2_CONT | ADC_CR2_SWSTART;

  ADC2->regs->CR1 |= 0x70000; // ADC_CR1_FASTINT;

  nvic_globalirq_disable();

//  uint32_t t = micros();

  // .584 uS

  for (int j = 0; j < maxSamples ; j+=2 )

  {

    while (!(ADC1->regs->SR & ADC_SR_EOC))

        ;

    dataPoints[j] = ADC1->regs->DR & ADC_DR_DATA;

    while (!(ADC2->regs->SR & ADC_SR_EOC))

        ;

    dataPoints[j+1] = ADC2->regs->DR & ADC_DR_DATA;

  }

  nvic_globalirq_enable();
}

stevestrong
Posts: 1749
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [libmaple] Black F407VET6

Post by stevestrong » Sun Oct 15, 2017 4:10 pm

Oh well, I see your point, there are many places which use ADC as a pointer and not as the structure address.
The ideal solution would be to change the ADC module of F4 to be compatible with F1.
Till then, you can replace ADCx by (&ADCx).

acronis
Posts: 142
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] Black F407VET6

Post by acronis » Sun Oct 15, 2017 11:32 pm

Hello Steven !

I hear You.
You did a great job by adding support STM32F4.
I really hope that You will be able to add support for ADC on this Board.

acronis
Posts: 142
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] Black F407VET6

Post by acronis » Thu Oct 19, 2017 11:37 am

Hello Steven

Rewrote all the code in &ADCx, but the error persists



dataPoints[j+1] = &ADC2->regs->DR & ADC_DR_DATA;

base operand of '->' has non-pointer type 'const adc_dev'


In this line, correct the code ?

stevestrong
Posts: 1749
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [libmaple] Black F407VET6

Post by stevestrong » Thu Oct 19, 2017 12:13 pm

Use the brackets correctly:

Code: Select all

dataPoints[j+1] = (&ADC2)->regs->DR & ADC_DR_DATA;

acronis
Posts: 142
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] Black F407VET6

Post by acronis » Fri Oct 20, 2017 11:54 am

Hello Steven.

I was able to do as you told me.
The error no longer exists.

But ADC is not working correctly, the values are constantly jumping (subject to change).
I tried to connect the ADC pin to GND and VCC, the values still vary over a wide range.
Tried using analogRead () all the same - value jump from the lower to the upper limit.

Why doesn't ADC ?
It is possible as that to solve ?

stevestrong
Posts: 1749
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [libmaple] Black F407VET6

Post by stevestrong » Fri Oct 20, 2017 12:01 pm

acronis wrote:
Fri Oct 20, 2017 11:54 am
It is possible as that to solve ?
Very probable that it can be solved.
Just the necessary time is missing...

acronis
Posts: 142
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] Black F407VET6

Post by acronis » Fri Oct 20, 2017 12:05 pm

Thank You for Your tremendous work.
You have so much done !!!
You're probably only ADC !
We will wait for a quick solution.

Thank You again.

acronis
Posts: 142
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] Black F407VET6

Post by acronis » Mon Oct 23, 2017 3:06 pm

stevestrong thank you very much for the help !
It worked on another pine !

acronis
Posts: 142
Joined: Thu Mar 02, 2017 12:32 pm

Re: [libmaple] Black F407VET6

Post by acronis » Wed Nov 08, 2017 12:35 pm

Hello steven.
Not if You managed to adapt the I2C for this Board?

Post Reply