Source Documentation

pysamloader module

pysamloader.pysamloader.raw_write_page(samba, page_address, data)[source]
pysamloader.pysamloader.xm_write_page(samba, page_address, data)[source]
pysamloader.pysamloader._page_writer(_writer, samba, device, page_address, bin_file)[source]

Send a single page worth of data from the file to the chip. Returns 1 as long as data remains. Returns 0 when end of file is reached.

pysamloader.pysamloader._file_writer(_writer, samba, device, filename, start_page=0, progress_class=None)[source]
pysamloader.pysamloader.xmodem_sendf(*args, **kwargs)[source]

Function to burn file onto flash using XMODEM transfers

pysamloader.pysamloader.raw_sendf(*args, **kwargs)[source]

Function to burn file onto flash without using XMODEM transfers

pysamloader.pysamloader.write(samba, device, filename, progress_class=None)[source]
pysamloader.pysamloader.verify(samba, device, filename, start_page=0, progress_class=None)[source]

Verify the contents of flash against the contents of the file. Returns the total number of words with errors.

pysamloader.pysamloader.set_boot(samba, device)[source]
pysamloader.pysamloader.read_chipid(*args, **kwargs)[source]
pysamloader.pysamloader.read_flash_descriptors(*args, **kwargs)[source]
pysamloader.pysamloader.read_unique_identifier(*args, **kwargs)[source]
pysamloader.pysamloader._get_device_folder()[source]
pysamloader.pysamloader.get_device(name)[source]
pysamloader.pysamloader.get_supported_devices()[source]

samba module

exception pysamloader.samba.SamBAConnectionError(msg)[source]

Bases: Exception

class pysamloader.samba.SamBAConnection(port='/dev/ttyUSB1', baud=115200, device=None)[source]

Bases: object

Opens the serial port for the SAM-BA connection

ser = Serial<id=0x7efcdb2a9e10, open=False>(port=None, baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)
retrieve_response()[source]

Read a response from SAM-BA, delimited by >

make_connection(auto_baud=False)[source]

Test connection to SAM-BA by reading its version

close()[source]
flush_all()[source]

Flush serial communication buffers

write_message(msg)[source]
write_byte(address, contents)[source]

Write 1 byte at a specific address. Both address and contents expected to be character strings

write_hword(address, contents)[source]

Write 2 bytes at a specific address. Both address and contents expected to be character strings

write_word(address, contents)[source]

Write 4 bytes at a specific address. Both address and contents expected to be character strings

read_byte(address)[source]

Read 1 byte from a specific address. Both address and returned contents are character strings

read_hword(address)[source]

Read 2 bytes from a specific address. Both address and returned contents are character strings

read_word(address)[source]

Read 4 bytes from a specific address. Both address and returned contents are character strings

xm_init_sf(address)[source]

Initialize XMODEM file send to specified address

xm_init_rf(address, size)[source]

Initialize XMODEM file read from specified address

xm_getc(size, timeout=1)[source]

getc function for the xmodem protocol

xm_putc(data, timeout=1)[source]

putc function for the xmodem protocol

efc_wready()[source]

Wait for EFC to report ready

efc_readfrr()[source]
efc_readfmr()[source]
efc_setfmr(mode)[source]
efc_ewp(pno)[source]

EFC trigger write page. Pno is an integer

efc_rstat()[source]

Read EFC status. Returns True if EFC is ready, False if busy.

efc_cleargpnvm(bno)[source]

EFC Fucntion to clear specified GPNVM bit. bno is an integer

efc_setgpnvm(bno)[source]

EFC Fucntion to set specified GPNVM bit. bno is an integer

efc_eraseall()[source]

EFC Function to Erase All

getchipid()[source]
efc_getflashdescriptor()[source]
efc_getuid()[source]

chipid module

class pysamloader.chipid.SamChipID(cidr, exid)[source]

Bases: object

_get_value(bs, be)[source]
version
_defs_eproc = {1: ('ARM946ES', 'ARM946ES'), 2: ('ARM7TDMI', 'ARM7TDMI'), 3: ('CM3', 'Cortex-M3'), 4: ('ARM920T', 'ARM920T'), 5: ('ARM926EJS', 'ARM926EJS'), 6: ('CA5', 'Cortex-A5'), 7: ('CM4', 'Cortex-M4')}
eproc
_defs_nvpsiz = {0: ('NONE', 'None'), 1: ('8K', '8K Bytes'), 2: ('16K', '16K Bytes'), 3: ('32K', '32K Bytes'), 5: ('64K', '64K Bytes'), 7: ('128K', '128K Bytes'), 9: ('256K', '256K Bytes'), 10: ('512K', '512K Bytes'), 12: ('1024K', '1024K Bytes'), 14: ('2048K', '2048K Bytes')}
nvpsiz
nvpsiz2
_defs_sramsiz = {0: ('48K', '48K bytes'), 1: ('1K', '1K bytes'), 2: ('2K', '2K bytes'), 3: ('6K', '6K bytes'), 4: ('24K', '24K bytes'), 5: ('4K', '4K bytes'), 6: ('80K', '80K bytes'), 7: ('160K', '160K bytes'), 8: ('8K', '8K bytes'), 9: ('16K', '16K bytes'), 10: ('32K', '32K bytes'), 11: ('64K', '64K bytes'), 12: ('128K', '128K bytes'), 13: ('256K', '256K bytes'), 14: ('96K', '96K bytes'), 15: ('512K', '512K bytes')}
sramsiz
_defs_arch = {25: ('AT91SAM9xx', 'AT91SAM9xx Series'), 41: ('AT91SAM9XExx', 'AT91SAM9XExx Series'), 52: ('AT91x34', 'AT91x34 Series'), 55: ('CAP7', 'CAP7 Series'), 57: ('CAP9', 'CAP9 Series'), 59: ('CAP11', 'CAP11 Series'), 64: ('AT91x40', 'AT91x40 Series'), 66: ('AT91x42', 'AT91x42 Series'), 85: ('AT91x55', 'AT91x55 Series'), 96: ('AT91SAM7Axx', 'AT91SAM7Axx Series'), 97: ('AT91SAM7AQxx', 'AT91SAM7AQxx Series'), 99: ('AT91x63', 'AT91x63 Series'), 112: ('AT91SAM7Sxx', 'AT91SAM7Sxx Series'), 113: ('AT91SAM7XCxx', 'AT91SAM7XCxx Series'), 114: ('AT91SAM7SExx', 'AT91SAM7SExx Series'), 115: ('AT91SAM7Lxx', 'AT91SAM7Lxx Series'), 117: ('AT91SAM7Xxx', 'AT91SAM7Xxx Series'), 118: ('AT91SAM7SLxx', 'AT91SAM7SLxx Series'), 128: ('SAM3UxC', 'SAM3UxC Series(100 - pin version)'), 129: ('SAM3UxE', 'SAM3UxE Series(144 - pin version)'), 131: ('SAM[3/4]AxC', 'SAM[3/4]AxC Series(100 - pin version)'), 132: ('SAM[3/4]XxC', 'SAM[3/4]3XxC Series(100 - pin version)'), 133: ('SAM[3/4]XxE', 'SAM[3/4]XxE Series(144 - pin version)'), 134: ('SAM[3/4]XxG', 'SAM[3/4]XxG Series(208 / 217 - pin version)'), 136: ('SAM[3/4]SxA', 'SAM[3/4]SxA Series(48 - pin version)'), 137: ('SAM[3/4]SxB', 'SAM[3/4]SxB Series(64 - pin version)'), 138: ('SAM[3/4]SxC', 'SAM[3/4]SxC Series(100 - pin version)'), 146: ('AT91x92', 'AT91x92 Series'), 147: ('SAM3NxA', 'SAM3NxA Series(48 - pin version)'), 148: ('SAM3NxB', 'SAM3NxB Series(64 - pin version)'), 149: ('SAM3NxC', 'SAM3NxC Series(100 - pin version)'), 153: ('SAM3SDxB', 'SAM3SDxB Series(64 - pin version)'), 154: ('SAM3SDxC', 'SAM3SDxC Series(100 - pin version)'), 165: ('SAM5A', 'SAM5A'), 240: ('AT75Cxx', 'AT75Cxx Series')}
arch
_defs_nvptyp = {0: ('ROM', 'ROM'), 1: ('ROMLESS', 'ROMless or on-chip Flash'), 2: ('FLASH', 'Embedded Flash Memory'), 3: ('ROM_FLASH', 'ROM and Embedded Flash Memory'), 4: ('SRAM', 'SRAM emulating ROM')}
nvptyp
fields = [('Version', 'version'), ('Embedded Processor', 'eproc'), ('Nonvolatile Program Size', 'nvpsiz'), ('Second Nonvolatile Program Size', 'nvpsiz2'), ('Internal SRAM Size', 'sramsiz'), ('Architecture Identifier', 'arch'), ('Nonvolatile Program Memory Type', 'nvptyp'), ('CIDR', '_cidr'), ('EXID', '_exid')]

efcdescriptor module

class pysamloader.efcdescriptor.EFCFlashDescriptor(samba)[source]

Bases: object

_read_number()[source]

samdevice module

class pysamloader.samdevice.SAMDevice[source]

Bases: object

EFC_FCR = None
EFC_FSR = None
AutoBaud = None
FullErase = None
WP_COMMAND = None
EWP_COMMAND = None
EA_COMMAND = None
FS_ADDRESS = None
PAGE_SIZE = None
SGP = [0, 0, 0]
WPC
EAC