Thank you, we used another level translator the next day and it just worked. It was just an electrical issue.
I have another question. We are communicating via spi with a wireless module. The module generates an interrupt when data is received or when data is ready to be transmitted. I have initialized the EXT driver, and it reacts on an interrupt. In this interrupt callback function, an interrupt handler for the wireless module is called. In this handler, an interrupt register is readed over spi, and the intterupt status is saved in a temporary variable. But after sending the register address to the module, the spiSend function doesn't return, and the receive function isn't called. It looks like the whole os is frozen.
The interrupt pin is connected to GPIOC 6. An interrupt is generated on the falling edge.
The following code is the configuration of the EXT driver:
Code: Select all
static const EXTConfig extcfg = {
{
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART, extcb1},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
},
EXT_MODE_EXTI(0,
0,
0,
0,
0,
0,
EXT_MODE_GPIOC,
0,
0,
0,
0,
0,
0,
0,
0,
0)
};
The callback function extcb1 is shown below:
Code: Select all
static void extcb1(EXTDriver *extp, expchannel_t channel)
{
(void)extp;
(void)channel;
palSetPad(GPIOC, 9); // led on
chSysLockFromIsr();
mrf_interrupt_handler(&SPID2);
chSysUnlockFromIsr();
}
The spi read function is shown below:
Code: Select all
uint8_t mrf_read_short (SPIDriver *spip, uint8_t address)
{
uint8_t receive;
uint8_t send = (address<<1 & 0b01111110);
spiSelect (spip);
spiSend (spip, 1, &send);
palClearPad(GPIOC, 9); // led off
spiReceive (spip, 1, &receive);
spiUnselect (spip);
return receive;
}
The led is not turned off in the mrf_read_short function, so the function spiSend wont return. Am i doing something wrong here?
Stellaris
EDIT:
I attached an image of the logic analyzer I used.