0

I try original O-Scope project (PigOScope) without touchscreen based on STM32F103C8T6 Bluepill board, but got some problem:

I used newest rogerclarkmelbourne/Arduino_STM32 Core and downloaded

pingumacpenguin/STM32-O-Scope sketch. I compiled and uploaded it to the device via UART from 0x08000000 address. Then I started the device. The grid and coordinate lines were displayed on the screen. Also on the screen were displayed inscriptions below 0.0 uS/Sample etc... But any noise or pulse signal from PB1 on my Probe. Why the chart is not drawn? Also I tried to log my steps in Usart in DMA activation code function:

  void takeSamples()
  {
    // This loop uses dual interleaved mode to get the best performance out of 
    the ADCs
    Serial.println("Init DMA");
    dma_init(DMA1);
    dma_attach_interrupt(DMA1, DMA_CH1, DMA1_CH1_Event);
    Serial.println("Enable DMA for ADC");
    adc_dma_enable(ADC1);
    dma_setup_transfer(DMA1, DMA_CH1, &ADC1->regs->DR, DMA_SIZE_32BITS,
                  dataPoints32, DMA_SIZE_32BITS, (DMA_MINC_MODE |      
    DMA_TRNS_CMPLT));// Receive buffer  
    Serial.println("Set DMA transfer");
    Serial.println(maxSamples / 2);
    dma_set_num_transfers(DMA1, DMA_CH1, maxSamples / 2);
    dma1_ch1_Active = 1;
    Serial.println("Enable the channel and start the transfer");
    dma_enable(DMA1, DMA_CH1); // Enable the channel and start the transfer.
    samplingTime = micros();
    Serial.println(samplingTime);
    while (dma1_ch1_Active); // SOME BUG OR WHAT.... PROGRAM STOP HERE!!!
    samplingTime = (micros() - samplingTime);
    Serial.println("Disable DMA");
    dma_disable(DMA1, DMA_CH1); //End of trasfer, disable DMA and Continuous 
   mode.
  }

Event handler for stop interrupt

  static void DMA1_CH1_Event()
  {
    dma1_ch1_Active = 0;
  }

Volatile flag to stop routine

    volatile static bool dma1_ch1_Active = 0;

Program keep crushing on while loop i think... And program does't work beyond takeSamples() function.

Why program does't exit the loop?

JDo
  • 338
  • 1
  • 4
  • 18
  • 1
    There are two Arduino Core implementations for STM32. [STM32duino](https://github.com/stm32duino/Arduino_Core_STM32) and Roger Clark's [Arduino_STM32](https://github.com/rogerclarkmelbourne/Arduino_STM32). If I read the instruction from O-Scope installation, it seems to suggest that it is run on the STM32duino core because it linked to the old STM32duino site. – hcheung Apr 15 '20 at 12:36
  • Thanks for your reply! I try it. I tried some examples with DMA from rogerclarkmelbourne and i got the same problem from rogerclarkmelbourne core . Maybe it's a bug in core... I created issue. – JDo Apr 15 '20 at 12:43
  • Did you try to install the STM32duino instead of Arduino_STM32 to your Arduino IDE? Some of the program written for STM32duino won't works for Arduino_STM32 or vice versa. – hcheung Apr 15 '20 at 12:45
  • Yes - https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json And then I downloaded rogerclarkmelbourne Core which unziped in Arduino -> hardware folder – JDo Apr 15 '20 at 12:47
  • 1
    No. if you use STM32duino, you use STM32 Core from STElectronics. See the instruction https://github.com/stm32duino/wiki/wiki/Getting-Started – hcheung Apr 15 '20 at 12:52
  • I use another Core from Roger Clark repo, PigoOScope use it too. I tried to take their example with DMA and got same problem https://github.com/rogerclarkmelbourne/Arduino_STM32/issues/769 – JDo Apr 18 '20 at 08:08

0 Answers0