SparkFun Forums 

Where electronics enthusiasts find answers.

Topics pertaining to the Arduino Core & software used with the Artemis module and Artemis development boards.
User avatar
By turbostew
#245504
I have an Stimer capture ISR that is simple and quick. I toggle an IO pin in the ISR. Capture input is driven with a 5KHz square wave. With the scoped hooked up I can see once in a while I miss a capture IRQ, I tracked it down to coinciding with an SPI transmission. I am using Artemis ATP with Arduino IDE with latest Apallo3 2.2.1 library. I am running 2 threads with the mbed rtos. One is a 5ms thread that does the SPI master stuff, the other is a 50ms thread doing I2C and serial stuff. It seems the SPI transfer func is responsible, I have eliminated other things like beginTransaction and whatnot. I have change the capture ISR priority from 0 to 7 with no change. Tried many things, been looking inside the mbed lib and not seeing anything with am_hal_iom not seeming to touch timer ISR regs.... Any ideas? I am an embedded controls engineer for 25 years so I am not a newbie.
By paulvha
#245526
SPI in the Apoll0 library 2.2.1 is NOT using interrupts. It is using the hal-function am_hal_iom_spi_blocking_fullduplex(). The IOM interrupts are disabled and the data is gathered by polling the IOM-FIFO in a while() loop.
From other projects I did, I know that MBED brings a HUGE overhead. Many of the time-critical programs are not working (stable) on V2.x.x. like Software Serial(https://github.com/paulvha/apollo3/tree ... wareSerial) , OneWire(https://github.com/paulvha/apollo3/tree ... re_on_uart ) You could try with v1.x.x, but it does not support threads.
User avatar
By turbostew
#245615
Thanks all for the suggestions, I did track it down to a slow fall time. For whatever reason, the IRQ didn't happen during SPI transmission, but by putting a schmitt trigger on the input to drastically increase the slew-rate, I now have no missing pulses...... Go figure.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum