OppaErich 25 Posted June 13, 2014 Author Share Posted June 13, 2014 This looks now like some real comm on the line. But still: MFRC522 Version: 0x00 //<- should read 0x91 no card select Quote Link to post Share on other sites
OppaErich 25 Posted June 13, 2014 Author Share Posted June 13, 2014 Here's the looks of the working Energia SPI communication. That looks much different than mine. I've played around with the mode settings but I can't get even close to this. How can I get into this mode ? Quote Link to post Share on other sites
pabigot 355 Posted June 13, 2014 Share Posted June 13, 2014 I'd start by comparing the SPI and GPIO module register configurations in both programs, probably by dumping the register memory for the modules. Also, looking at the analyzer traces the SPI clock in both versions looks odd (I'd expect 8 evenly-spaced pulses per octet transferred, with a slightly larger gap between octets). The ENABLE line is clearly wrong in your program: normally you'd see ENABLE low at any time when there's clock activity. (That it goes high again between octets in the Energia program is unusual but may be appropriate if the slave chip's interface operates on single-octet commands.) Quote Link to post Share on other sites
OppaErich 25 Posted June 13, 2014 Author Share Posted June 13, 2014 ENABLE is done using regular GPIO and I did not change the timing, I've just replaced digitalWrite() with GPIO_PORTA_DATA_R bit modifications. The clock jumped into my eye too but this is done by the SSI module. hmmmm.... Single step through the SPI read and write functions does not really work. CCS gives error messages 'unable to read memory address ...' and loosing connection to the debugger. Thanks, Stephan Quote Link to post Share on other sites
OppaErich 25 Posted June 15, 2014 Author Share Posted June 15, 2014 So, took a break and played a bit with a freescale FRDM board. And...wheeehee...progress ! I wrote down the byte sequence sent at initialisation and checked back with the logic analyzer. I noticed there was an extra 0x00 after each byte. unsigned char SPI_transfer(unsigned char data){ unsigned char rec_data; GPIO_PORTA_DATA_R &= ~chipSelectPin; // !CS = 0 rec_data = sendAfterWaiting(data); // send command // rec_data = sendAfterWaiting(0); !!! d'OH !!! // send nothing, receive byte GPIO_PORTA_DATA_R |= chipSelectPin; // !CS = 1 return rec_data; } And then in the terminal window: MFRC522 Version: 0x91 This looks good. It's still not reading tags but the SPI communication seems to be right now (Freescale mode, SPO=SPH=0) Quote Link to post Share on other sites
OppaErich 25 Posted June 16, 2014 Author Share Posted June 16, 2014 Hmm, now I'm hitting a wall. I tried to debug but get no chance. I can dive one or two layers into the card reading functions and then the debugger crashes. Buttons get greyed out, variables in the watch window turn red and mouse cursor is the spinning wheel. Quote Link to post Share on other sites
OppaErich 25 Posted June 16, 2014 Author Share Posted June 16, 2014 Can someone explain why 'status' gets lost in Nirvana ? It's there and just one line later it's gone and CCS's debugger crashes. Quote Link to post Share on other sites
pabigot 355 Posted June 16, 2014 Share Posted June 16, 2014 I don't use CCS but in general if the instruction pointer is past the last point where a local variable is used, the debugger information may be removed because the stack space or register has been reassigned to another purpose. OppaErich 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.