Skip to content

Commit

Permalink
Change the pins activation acording to AFCv4 specifications
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavosr8 authored and augustofg committed Aug 2, 2023
1 parent 2388bcf commit 007cbc5
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions nxpprog.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,27 +464,12 @@ def __init__(self, device, baud, xonxoff=False, control=False):
# this is of course only possible if the signals are connected in
# this way
def isp_mode(self):
self.reset(0)
time.sleep(.1)
self.reset(1)
self.int0(1)
time.sleep(.1)
self.reset(0)
time.sleep(.1)
self.int0(0)

def reset(self, level):
if self.reset_pin == "rts":
self._serial.setRTS(level)
else:
self._serial.setDTR(level)

def int0(self, level):
# if reset pin is rts int0 pin is dtr
if self.reset_pin == "rts":
self._serial.setDTR(level)
else:
self._serial.setRTS(level)
# sequence to put the AFCv4 (https://ohwr.org/project/afc/tree/cti_afc4) into bootloader mode
self._serial.setRTS(1) # set RTS line to 0v
self._serial.setDTR(0) # set DTR line to 3.3v
time.sleep(0.1)
self._serial.setDTR(1) # set DTR line to 0v

def write(self, data):
self._serial.write(data)
Expand Down

0 comments on commit 007cbc5

Please sign in to comment.