ChibiOS on Arduino < 1024uS thread interval possible?
Posted: Thu Jun 04, 2015 8:21 pm
Hello,
I'm using ChibiOS on a Arduino Pro Mini 3.3V @ 8MHz. I'm trying to run an SD data logger that logs some I2C sensor data to an SD card every 1.5ms. Using the data logger example as a base I got it all working fine with no overruns, but no matter what I do I can't get it to log faster than 1 sample every 2ms.
I think part of the problem is that I'm using an 8MHz board. Using the example code with it set up like:
Then it actually collects data at a 4ms rate, and when I change intervalTicks to 1 the it collects at a 2ms rate. I can live with having to adjust my code to reflect half of what I want the sample right to be, but I need to collect data at something in between 1 and 2ms
So tried changing the thread sleep function to:
But didn't work either.
I tried playing with the "#define CH_FREQUENCY (F_CPU/16384L)" and "#define CH_TIME_QUANTUM 20" settings in the .h files but no matter what I did it still collects at 2.048ms.
I don't understand where the settings are that make my "intervalTicks" double and more importantly I can't figure out how to set an interval that isn't a multiple of 1024us. It seems like it should be possible.
The reason I'm running at 8MHz is because I need a small, 3.3V compatible arduino board and didn't have at 16MHz. I have a Teensy 3.1 that might also work, but looking at the example file in the ChibiOS_Arm folder it looks like that comment about "intervals of 1024us" is in there also and I don't want to tear my hardware setup all apart if it is going to have the same problem.
Can anybody help point me in the right direction?
Thanks,
Dylan
I'm using ChibiOS on a Arduino Pro Mini 3.3V @ 8MHz. I'm trying to run an SD data logger that logs some I2C sensor data to an SD card every 1.5ms. Using the data logger example as a base I got it all working fine with no overruns, but no matter what I do I can't get it to log faster than 1 sample every 2ms.
I think part of the problem is that I'm using an 8MHz board. Using the example code with it set up like:
Code: Select all
// interval between points in units of 1024 usec
const uint16_t intervalTicks = 2;Then it actually collects data at a 4ms rate, and when I change intervalTicks to 1 the it collects at a 2ms rate. I can live with having to adjust my code to reflect half of what I want the sample right to be, but I need to collect data at something in between 1 and 2ms
So tried changing the thread sleep function to:
Code: Select all
chThdSleepMicroseconds(1500);But didn't work either.
I tried playing with the "#define CH_FREQUENCY (F_CPU/16384L)" and "#define CH_TIME_QUANTUM 20" settings in the .h files but no matter what I did it still collects at 2.048ms.
I don't understand where the settings are that make my "intervalTicks" double and more importantly I can't figure out how to set an interval that isn't a multiple of 1024us. It seems like it should be possible.
The reason I'm running at 8MHz is because I need a small, 3.3V compatible arduino board and didn't have at 16MHz. I have a Teensy 3.1 that might also work, but looking at the example file in the ChibiOS_Arm folder it looks like that comment about "intervals of 1024us" is in there also and I don't want to tear my hardware setup all apart if it is going to have the same problem.
Can anybody help point me in the right direction?
Thanks,
Dylan