[En-Nut-Discussion] Memory card issues in EIR
Antti Olavi Ahola
anahola at mail.student.oulu.fi
Mon Oct 20 13:58:03 CEST 2008
I tried to write onto sd card using the sample code on ethernut
webpages but execution halts at:
if (NutRegisterDevice(&devNplMmc0, 0, 0))
I debugged it but could not get "lower" than line 287 on nplmmc.c
286 if ((rc = NplRegisterIrqHandler(&sig_MMCD, NplMmCard0InsIrq,
0)) == 0) {
287 rc = NplRegisterIrqHandler(&sig_NMMCD, NplMmCard0RemIrq, 0);
I can debug into the funtion at line 286 but when I try same at line
287 debug options, except halt, freeze (I'm using eclipse btw)
Maybe this is related to the earlier discussion about irqs and address
spaces at EIR but I didn't understood much about those discussions.
One more thing; the eir example application have hackish initiation
function (see below) which I thought might be the cause but when I
disabled it(and basically all other unrelated code), the application
froze even earlier before any memory card related code.
Ps. Stupid question but I don't want to break the house of cards that
is my environment: is it safe to update nut/os just by copying new
sources over old ones and rerunning the nutconfigure?
------------------------------------------------------------------
/* Enable peripherals. */
outr(PIOA_ASR, inr(PIOA_ASR)
| _BV(PA12_SPI0_MISO_A)
| _BV(PA13_SPI0_MOSI_A)
| _BV(PA14_SPI0_SPCK_A)
| _BV(PA30_IRQ1_A));
/* Disable PIO lines used for peripherals. */
outr(PIOA_PDR, _BV(PA12_SPI0_MISO_A)
| _BV(PA13_SPI0_MOSI_A)
| _BV(PA14_SPI0_SPCK_A)
| _BV(PA30_IRQ1_A));
/* Chip selects are manually controlled. */
/* Enable XCS control. */
outr(PIOA_PER, _BV(VS10XX_XCS_BIT));
outr(PIOA_SODR, _BV(VS10XX_XCS_BIT));
outr(PIOA_OER, _BV(VS10XX_XCS_BIT));
/* Enable XDCS control. */
outr(PIOB_PER, _BV(VS10XX_XDCS_BIT));
outr(PIOB_SODR, _BV(VS10XX_XDCS_BIT));
outr(PIOB_OER, _BV(VS10XX_XDCS_BIT));
/* Release reset line. */
outr(PIOB_PER, _BV(VS_XRESET_BIT));
outr(PIOB_SODR, _BV(VS_XRESET_BIT));
outr(PIOB_OER, _BV(VS_XRESET_BIT));
/* DataFlash chip select. */
outr(PIOA_PER, _BV(PA11_SPI0_NPCS0_A));
outr(PIOA_SODR, _BV(PA11_SPI0_NPCS0_A));
outr(PIOA_OER, _BV(PA11_SPI0_NPCS0_A));
/* Enable clocks. */
outr(PMC_PCER, _BV(SPI0_ID) | _BV(IRQ1_ID) | _BV(PIOA_ID) |
_BV(PIOB_ID) | _BV(PIOC_ID));
/* SPI enable and reset. */
outr(SPI0_CR, SPI_SPIEN | SPI_SWRST);
outr(SPI0_CR, SPI_SPIEN);
---------------------------------------------------------------------
More information about the En-Nut-Discussion
mailing list