Read SPI in Low Level Interrupt

I have written an application to read SPI on EXTINT interrupt. INT0 mapped to GPIO3, interrupt is generated OK. I tried to read SPI bus in Low Level Interrupt handler routine and the adl_busRead() routine report error ADL_RET_ERR_SERVICE_LOCKED which is correct in this mode.

If I make a subscribe with ADL_IRQ_NOTIFY_HIGH_LEVEL, I have the same error !

static s32 MyExtIntIrqHandle;
static s32 MyExtIntHandle;
static s32 MyGPIOHandle;
// ExtInt settings
static adl_extintConfig_t irq_ExtIntSettings;
// ExtInt Capabilities
static adl_extintCapabilities_t irq_ExtIntCapabilities;

static bool MyExtIntIrqHandler ( adl_irqID_e Source, adl_irqNotificationLevel_e NotificationLevel, adl_irqEventData_t * Data )
    u8 tmp;
    u8 value;
    // Increase counter

    ret = adl_busRead(BusHandle, &busData, 1, &value);
    if (ret <0)
         TRACE((1,"Error reading SPI: %d", ret));

    return FALSE;
    MyExtIntIrqHandle =adl_irqSubscribe( MyExtIntIrqHandler,ADL_IRQ_NOTIFY_HIGH_LEVEL,0, 0);
  // Set ExtInt signal sensitivity
  irq_ExtIntSettings.Sensitivity = ADL_EXTINT_SENSITIVITY_FALLING_EDGE;
  // Set ExtInt Filter parameters
  irq_ExtIntSettings.Filter = ADL_EXTINT_FILTER_BYPASS_MODE;
  irq_ExtIntSettings.FilterDuration = 0;
  irq_ExtIntSettings.Pad = 0;
  irq_ExtIntSettings.Context = NULL;
  // Subscribe to the ExtInt service
  MyExtIntHandle = adl_extintSubscribe ( 0, 0, MyExtIntIrqHandle, &irq_ExtIntSettings );

My questions,
Is it possible to read bus in High Level Interrupt handler ?
How is it possible to read it in case of LowLevel Interupt, my interrupt is generated every 5msec by PIC ?
which other possibilities to read bus ?

Q2687 with firmware 7.3a and M2M studio

Thanks in Advance.

I think you should adopt the same approach as you would when writing ISRs in a “normal” microcontroller; ie, the ISR just does the absolute minimum, and as much as possible is done in the “main loop”

I don’t know, but I’d avoid it - see above!
eg, could you just have the High-Level handler set a flag, or maybe an Event…?

You have already determined that it is not possible!

I think you may be stretching it for Open-AT to keep-up with that…

I have a Low Level Spi driver to work on a double UART.

First of all you have to run it ADL_BUS_CMD_SET_ASYNC_MODE and it needs to be ADL_BUS_CMD_LOCK to get in low level.

When running in async mode you have to be very careful not accesses the SPI-bus while it waits for data or end of transmission.

In low level mode the Semaphore service can not be used and you have to make your own.

I don’t think that it is impossible to response to 5 msec interrupt, the problem can be to signal the upper level tasks, where the timer tick is 18,5ms.

I have a problems with speed on my UART driver, I can’t push it to more then 400k-600k baud.
And I think the problem is response time and delay within the SPI-bus.
A bit of a problem when the target is 3,2 m baud :wink:

So here are some questions to all:

Has any find a way to eliminate the delays within SPI read and writes, from the first byte write to the next read or write, the clock stop for 11,7 us to 80 us. See pic

I has also fund delays within write session up 150 us in the middle of the session, see pic.

Is the some way to get below low level, under the GSM irq ?


I doubt that you’re going to be able to preempt the GSM radio firmware - there are some very tight timing specs for the radio, and the GSM network will lock out (blackban) radios that don’t conform.

You may be able to shut off your GSM radio (AT+CFUN=0 perhaps) if you want a bit more time…

ciao, Dave