Hello, I'm adding external periphery to SPI of an atmega32 controller.
a. bit-bang mode when bitbanging clock and setting mosi / reading miso, everything works fine. ==> my wiring and the external chip are ok. b. using the builtin subsystem. I set mosi and clk to output, and the select pin (PORTC.2) as well. HOWEVER, I found it impossible to set SPCR to the desired values: > hex ok > $53 SPCR c! ok > SPCR c@ . 43 ok The bit $10, which is apparently not set, ist the MSTR bit. That fits the symtoms I'm seeing: "spirw" (available in core/words/spirw.asm) never returns, because SPIF in register SPSR is never set. No wonder, if we are not in master mode to begin with. The bit-bang version never looks at SPSR and SPCR. I found in the datasheet that the behaviour depends on whether /SS is input and externally driven low or not while setting SPCR. However, switching /SS to output does not change the situation. This is the same in amforth 3.4 (where I found my old test), 3.8 or trunk. Ideas? Cheers, Erich ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Amforth-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/amforth-devel
