Better fix for hardware FCS error on JTAG reset

Correct silly error introduced by trying to save two bytes.
This commit is contained in:
David Kopf 2011-11-15 13:24:58 -05:00
parent 63e40d195e
commit fb977cb9ef
3 changed files with 27 additions and 23 deletions

View file

@ -232,13 +232,19 @@ hal_init(void)
// hal_reset_flags();
/*IO Specific Initialization - sleep and reset pins. */
/* Set pins low before they are initialized as output? Does not seem to matter */
// hal_set_rst_low();
// hal_set_slptr_low();
DDR_SLP_TR |= (1 << SLP_TR); /* Enable SLP_TR as output. */
DDR_RST |= (1 << RST); /* Enable RST as output. */
/*SPI Specific Initialization.*/
/* Set SS, CLK and MOSI as output. */
HAL_DDR_SPI |= (1 << HAL_DD_SS) | (1 << HAL_DD_SCK) | (1 << HAL_DD_MOSI);
/* To avoid a SPI glitch, the port register shall be set before the DDR register */
HAL_PORT_SPI |= (1 << HAL_DD_SS) | (1 << HAL_DD_SCK); /* Set SS and CLK high */
HAL_DDR_SPI |= (1 << HAL_DD_SS) | (1 << HAL_DD_SCK) | (1 << HAL_DD_MOSI);
HAL_DDR_SPI &=~ (1<< HAL_DD_MISO); /* MISO input */
/* Run SPI at max speed */
SPCR = (1 << SPE) | (1 << MSTR); /* Enable SPI module and master operation. */
SPSR = (1 << SPI2X); /* Enable doubled SPI speed in master mode. */