Browse Source

ispprog2: keep ISP_RESET (/SS) as output

ISP_RESET is /SS pin of mega328p.
In master mode, the /SS pin must be configured as output.
If configured as input it must held high to ensure Master SPI operation.
master
Olaf Rempel 7 years ago
parent
commit
798fa7fbb1
  1. 6
      ispprog.c

6
ispprog.c

@ -86,13 +86,13 @@
#define ISP_SCK PORTB5 /* to target */
#define RESET_IN PORTB1 /* low active */
#define ISP_INACTIVE() { /* ISP_SCK, ISP_MOSI and ISP_RESET are inputs */ \
DDRB &= ~((1<<ISP_SCK) | (1<<ISP_MOSI) | (1<<ISP_RESET)); \
#define ISP_INACTIVE() { /* ISP_SCK, ISP_MOSI are inputs, set ISP_RESET high */ \
DDRB &= ~((1<<ISP_SCK) | (1<<ISP_MOSI)); \
PORTB |= (1<<ISP_RESET); \
};
#define ISP_ACTIVE() { /* ISP_SCK, ISP_MOSI and ISP_RESET are outputs, set ISP_RESET low */ \
DDRB |= ((1<<ISP_SCK) | (1<<ISP_MOSI) | (1<<ISP_RESET)); \
DDRB |= ((1<<ISP_SCK) | (1<<ISP_MOSI)); \
PORTB &= ~(1<<ISP_RESET); \
};

Loading…
Cancel
Save