Hallo,
ich versuche mich gerade daran die Treiber für ein CC3000 WLAN IC/Modul
für einen XMega zu portieren. Aber das gestaltet sich nicht einfach,
weil das nicht so besonders gut dokumentiert ist, wie es am Anfang
schien (oder von TI angepriesen wurde ;) )
Also alle Readoperationen werden anscheinend durch das auslösen des IRQ
Interrupts in Gang gesetzt und auch in dieser IRQ komplett verarbeitet.
Ziemlich ungünstig würde ich meinen, aber TI räumt ein, dass es eine
Blocking Portierung ist, die wohl quick and dirty ist...
egal... ich möchte das erstmal so zum laufen bekommen, wie TI sich das
vorstellt.
Leider gibts hier wohl kleine Unterschiede vom MSP430 zum XMega... =)
Also hier erstmal der Interrupt zum GPIO der IRQ Line vom MSP430:
1 | //*****************************************************************************
|
2 | //
|
3 | //! The IntSpiGPIOHandler interrupt handler
|
4 | //!
|
5 | //! \param none
|
6 | //!
|
7 | //! \return none
|
8 | //!
|
9 | //! \brief GPIO A interrupt handler. When the external SSI WLAN device is
|
10 | //! ready to interact with Host CPU it generates an interrupt signal.
|
11 | //! After that Host CPU has registrated this interrupt request
|
12 | //! it set the corresponding /CS in active state.
|
13 | //
|
14 | //*****************************************************************************
|
15 | #pragma vector=PORT2_VECTOR
|
16 | __interrupt void IntSpiGPIOHandler(void)
|
17 | {
|
18 |
|
19 | if (__even_in_range(P2IFG, BIT6)){
|
20 | P2IFG &= ~BIT6;
|
21 | if (sSpiInformation.ulSpiState == eSPI_STATE_POWERUP)
|
22 | {
|
23 | /* This means IRQ line was low call a callback of HCI Layer to inform on event */
|
24 | sSpiInformation.ulSpiState = eSPI_STATE_INITIALIZED;
|
25 | }
|
26 | else if (sSpiInformation.ulSpiState == eSPI_STATE_IDLE)
|
27 | {
|
28 | sSpiInformation.ulSpiState = eSPI_STATE_READ_IRQ;
|
29 |
|
30 | /* IRQ line goes down - start reception */
|
31 | ASSERT_CS();
|
32 |
|
33 | //
|
34 | // Wait for TX/RX Compete which will come as DMA interrupt
|
35 | //
|
36 | SpiReadHeader();
|
37 |
|
38 | sSpiInformation.ulSpiState = eSPI_STATE_READ_EOT;
|
39 |
|
40 | SSIContReadOperation();
|
41 | }
|
42 | else if (sSpiInformation.ulSpiState == eSPI_STATE_WRITE_IRQ)
|
43 | {
|
44 | SpiWriteDataSynchronous(sSpiInformation.pTxPacket, sSpiInformation.usTxPacketLength);
|
45 |
|
46 | sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
|
47 |
|
48 | DEASSERT_CS();
|
49 | }
|
50 |
|
51 | }
|
52 |
|
53 | //__bis_SR_register(GIE);
|
54 | }
|
Und nun die Funktionen die mich verwirren:
1 | //*****************************************************************************
|
2 | //
|
3 | //! This function enter point for write flow
|
4 | //!
|
5 | //! \param SpiPauseSpi
|
6 | //!
|
7 | //! \return none
|
8 | //!
|
9 | //! \brief The function triggers a user provided callback for
|
10 | //
|
11 | //*****************************************************************************
|
12 |
|
13 | void
|
14 | SpiPauseSpi(void)
|
15 | {
|
16 | SPI_IRQ_PORT &= ~SPI_IRQ_PIN;
|
17 | }
|
18 |
|
19 |
|
20 | //*****************************************************************************
|
21 | //
|
22 | //! This function enter point for write flow
|
23 | //!
|
24 | //! \param SpiResumeSpi
|
25 | //!
|
26 | //! \return none
|
27 | //!
|
28 | //! \brief The function triggers a user provided callback for
|
29 | //
|
30 | //*****************************************************************************
|
31 |
|
32 | void
|
33 | SpiResumeSpi(void)
|
34 | {
|
35 | SPI_IRQ_PORT |= SPI_IRQ_PIN;
|
36 | }
|
Kann es sein, dass man das Portregister beim MSP430 ändert und damit an
diesem (eigentlich) Eingangs Pin den Interrupt auslöst?
So Funktioniert das leider beim XMega nicht, jedenfalls wüsste ich nicht
wie...
Im super tollen TI Wiki steht nur:
SpiResumeSpi
The SpiResumeSpi function is called after the received packet is
processed by the CC3000 host driver code in the context of the receive
handler.
Hier das komplette Wiki:
http://processors.wiki.ti.com/index.php/CC3000_Host_Driver_Porting_Guide
Das eigentliche Problem besteht derzeit darin, dass sich der Source in
einen der vielen Blockingschleifen dreht und wohl auf einen
readinterrupt wartet... daher vermute ich, dass ich diesen Teil noch
falsch umgesetzt habe.
Ich habe mal noch die SPI.c für den MSP angehangen...
Vielleicht kann jemand etwas Licht ins Dunkel bringen...
Schonmal danke...
Grüße
Basti