Search found 179 matches

by ozcar
Thu Mar 11, 2021 11:03 am
Forum: General discussion
Topic: PlatformIO and Arduino IDE compilation results are different
Replies: 24
Views: 17893

Re: PlatformIO and Arduino IDE compilation results are different

If you really wanted to print the result of the digitalReadFast(), but exclude the time taken for the Serial.print() from your measurement, then you could assign the return value from digitalReadFast() to an int variable, and then print that together with the timecnt value.

Based on the code I saw ...
by ozcar
Thu Mar 11, 2021 6:37 am
Forum: General discussion
Topic: PlatformIO and Arduino IDE compilation results are different
Replies: 24
Views: 17893

Re: PlatformIO and Arduino IDE compilation results are different

leonardo wrote: Thu Mar 11, 2021 6:03 am but the loop is still 1100 microseconds after using this function
Maybe show us your code as it is now. I'm not sure what you are measuring.
by ozcar
Thu Mar 11, 2021 6:30 am
Forum: General discussion
Topic: PlatformIO and Arduino IDE compilation results are different
Replies: 24
Views: 17893

Re: PlatformIO and Arduino IDE compilation results are different

I looked at what the compiler does for statements like these:

if ( GPIOB->IDR & 1 << 10 ) ...;
if ( GPIOB->IDR >> 10 & 1 ) ...;

I thought that potentially the first of those might execute a tad faster than the second, but no, it turns out the compiler is smart enough to generate exactly the ...
by ozcar
Thu Mar 11, 2021 3:17 am
Forum: General discussion
Topic: PlatformIO and Arduino IDE compilation results are different
Replies: 24
Views: 17893

Re: PlatformIO and Arduino IDE compilation results are different


...
Also you're ISR isn't as fast as it can be. This 10 bit shift needs time.
You can use

digitalReadFast(digitalPinToPinName(pin));

and set optimization to fastest (-O3)



if ( GPIOB->IDR & GPIO_IDR_ID10 ) receiver_input1_previous = no

Would obviate 10 bit shift (at execution time ...
by ozcar
Wed Mar 10, 2021 8:35 pm
Forum: General discussion
Topic: PlatformIO and Arduino IDE compilation results are different
Replies: 24
Views: 17893

Re: PlatformIO and Arduino IDE compilation results are different

I don't know what you expect timecnt to be. If you are trying to determine how long the Serial.println(receiver_input1) takes, then you should have just set timecnt = micros(), not timecnt = micros()-timecnt initially.

You probably should have declared receiver_input1 as volatile too, but that ...
by ozcar
Tue Feb 23, 2021 8:04 pm
Forum: General discussion
Topic: STM32L452RE error with HAL_I2C
Replies: 6
Views: 6147

Re: STM32L452RE error with HAL_I2C

I'm not familiar with the internals of this. Maybe there is some clue in the actual values in XFerOptions or Mode when it fails, or perhaps there is some subtle difference between what you do in your code compared to the example.

If it is somehow related to the rate, or just the number of times ...
by ozcar
Sat Feb 20, 2021 6:23 pm
Forum: General discussion
Topic: STM32L452RE error with HAL_I2C
Replies: 6
Views: 6147

Re: STM32L452RE error with HAL_I2C

You're way ahead of me. What makes you think this has anything to do with I2C getting stuck in busy state? When I had that problem, the busy state caused a HAL error code to be generated (after some timeout). I don't remember the details now, and I also don't know how that would surface when using ...
by ozcar
Thu Feb 18, 2021 2:28 am
Forum: General discussion
Topic: STM32L452RE error with HAL_I2C
Replies: 6
Views: 6147

Re: STM32L452RE error with HAL_I2C


I have done some reading around and have found that some people have had problems with the HAL I2C library and the I2C BUSY state in particular, it looks as though it is present in some STM32 erattas too. I found these results by searching "hal i2c busy eratta" into google.

https://electronics ...
by ozcar
Wed Jan 06, 2021 6:37 pm
Forum: General discussion
Topic: Compensate for LSE error
Replies: 12
Views: 12934

Re: Compensate for LSE error

In my travels through RM008 and AN2604 yesterday, I noticed that you can get it to output RTC clock divided by 64 on the "TAMPER" pin (PC13?). If that pin is available, you would not need a very accurate counter to see if the frequency is out by as much as it appears to be.
by ozcar
Tue Jan 05, 2021 8:52 pm
Forum: General discussion
Topic: Compensate for LSE error
Replies: 12
Views: 12934

Re: Compensate for LSE error


...
You say I can compensate for an LSE error in software, but I can't find that in the datasheet. it's a bit hard to find this info if you don't know exactly what to look for. Do you have any clues as to what function or register(s) I need to use?


I have never tried to use the RTC on any STM32 ...

Go to advanced search