Search found 75 matches

by Bambo
Thu May 27, 2021 1:18 pm
Forum: General discussion
Topic: SD card write errors with hardware timer?
Replies: 2
Views: 4190

SD card write errors with hardware timer?

Hi, i'm trying to write a program that must write to the SD card 30000 bytes at a time, while the hardware timer collects samples at 16,000Hz. The problem is that the SD card write function returns an error when writing. But it seems that the Sd card fails to write when its interrupted? Does anyone ...
by Bambo
Thu May 27, 2021 11:20 am
Forum: General discussion
Topic: What happens when 2 hardware timers are running?
Replies: 3
Views: 2883

What happens when 2 hardware timers are running?

Hi, i have two HardwareTimer's both configured to 16,000Hz with seperate callbacks.

I'm just wondering what the behaviour of these timers is?

Does one interrupt the other, if so in what order?
by Bambo
Thu May 20, 2021 3:47 pm
Forum: General discussion
Topic: HAL_SAI_Receive() causes hardware timer callback to never exit?
Replies: 4
Views: 3298

Re: HAL_SAI_Receive() causes hardware timer callback to never exit?

Program seems to be overflowing serial buffers, looking at the timestamps, the Serial2.println(elapsed) seems to get called ok, and so should signalWatchdog(), but that function is empty so how do you know its not called ? The serial2.println() is called fine for the first second or so, but the ...
by Bambo
Thu May 20, 2021 2:30 pm
Forum: General discussion
Topic: HAL_SAI_Receive() causes hardware timer callback to never exit?
Replies: 4
Views: 3298

Re: HAL_SAI_Receive() causes hardware timer callback to never exit?

The sound works yeah, but the program halts because the watchdog serial is never signaled.

Code: Select all

void loop() {
	signalWatchdog(); // this is never called
	Serial2.println(elapsed);
}
by Bambo
Thu May 20, 2021 10:37 am
Forum: General discussion
Topic: HAL_SAI_Receive() causes hardware timer callback to never exit?
Replies: 4
Views: 3298

HAL_SAI_Receive() causes hardware timer callback to never exit?

Hi, i'm trying to sample a microphone inside a hardware timer callback, but the program gets stuck when it runs. CPU: STM32L452RE Here is the program: #include <SoftwareSerial.h> #include <Arduino.h> #include <HardwareTimer.h> #include "stm32l4xx.h" #include "stm32l4xx_hal.h" #include "stm32l4xx_hal ...
by Bambo
Fri Apr 23, 2021 7:11 pm
Forum: General discussion
Topic: Help! TIM3 hardware timer is running 10* faster than configured
Replies: 15
Views: 9004

Re: Help! TIM3 hardware timer is running 10* faster than configured

I turned the timer off and thought it was working :twisted: managed to get a sketch to reproduce it though, just gotta figure out whats wrong with this SAI configuration :?:
by Bambo
Fri Apr 23, 2021 3:56 pm
Forum: General discussion
Topic: Help! TIM3 hardware timer is running 10* faster than configured
Replies: 15
Views: 9004

Re: Help! TIM3 hardware timer is running 10* faster than configured

@ABOSTM

How can i determine what TIM's are in use? I'm using HardwareSerial and HardwareTimer at the same time and they are conflicting.

Configuring the hardware timer at TIM6 i get an assertion thrown in file stm32l4xx_hal_tim.c line 3427?

Thanks - Richard
by Bambo
Fri Apr 23, 2021 3:43 pm
Forum: General discussion
Topic: Help! TIM3 hardware timer is running 10* faster than configured
Replies: 15
Views: 9004

Re: Help! TIM3 hardware timer is running 10* faster than configured

Turns out, it was because i set the HardwareTimer to TIM3 when i think it's being used by a serial port somewhere. Switching it to TIM6 fixed it.
by Bambo
Fri Apr 23, 2021 2:55 pm
Forum: General discussion
Topic: Help! TIM3 hardware timer is running 10* faster than configured
Replies: 15
Views: 9004

Re: Help! TIM3 hardware timer is running 10* faster than configured

So i found out that it was actually a call to HAL_SAI_Receive() which is blocking the ISR routine making it run continuously so the main loop() wasn't called. HAL_SAI_Receive() takes 3000us to complete when it should take much much less time.
by Bambo
Fri Apr 23, 2021 10:59 am
Forum: General discussion
Topic: Help! TIM3 hardware timer is running 10* faster than configured
Replies: 15
Views: 9004

Re: Help! TIM3 hardware timer is running 10* faster than configured

Ok so i found that the issue is if i call HAL_StatusTypeDef status = HAL_SAI_Receive(saiHandle, dataBuffer, 2U, 1); Inside the ISR loop, the main loop() is stopped being called after a few ticks. I'm going to try to use the SAI interrupts instead of the polling mode to see if that will help? note ...

Go to advanced search