0

Use UART DFU implementation in Atmel for upload to nRF51

lubos.pejchal gravatar image

asked 2017-07-11 09:13:51 +0100

updated 2017-07-17 10:29:45 +0100

Hi. I would like upload firmware from Atmel microcontroller to nRF51822 with SD130. I suppose that I have to use single_bank_serial_s130 in nRF51822AA, but what I have to do on other side (Atmel side) ? I found this document, but I don't know if it is relevant for central device using SDK11 and SD130. Does exist any application for PC using bootloader over UART ?

edit retag flag offensive close delete report spam

1 answer

Sort by » oldest newest most voted
0
bjorn-spockeli gravatar image

answered 2017-07-11 10:56:42 +0100

We use our pc-nrfutil tool to perform serial DFU from a PC. The source code is available here.

edit flag offensive delete publish link more

Comments

Thx. I found older version and this version is little bit complicated and I don't see start packet. I don't understand why you shift sequence number about 3bits in packet header. It should be ack in this position according Bluetooth Core 4.2...How Can I run and debbug this application ? What is about that documentation ?

Jackxl ( 2017-07-11 12:24:37 +0100 )editconvert to answer

You should be able to debug it using the Python Debugger, here is the link, but I have not tried it myself. It appears that the first byte in our documentation is written from MSBto LSB and not LSB to MSB as in the Core spec.

Bjørn Spockeli ( 2017-07-11 13:15:48 +0100 )editconvert to answer

I finally found documentation of UART HCI protocol for SDK11. There is right PacketHeader in this document (match with core 4.2), but it doesn't match with implementation in nrfutil.

Jackxl ( 2017-07-11 14:44:29 +0100 )editconvert to answer

Looking at the source for nrfutil v0.5.2 it appears that the byte order is in compliance with the core spec.

def slip_parts_to_four_bytes(seq, dip, rp, pkt_type, pkt_len):
    """
    Creates a SLIP header.

    For a description of the SLIP header go to:
    http://developer.nordicsemi.com/nRF51_SDK/doc/7.2.0/s110/html/a00093.html

    :param int seq: Packet sequence number
    :param int dip: Data integrity check
    :param int rp: Reliable packet
    :param pkt_type: Payload packet
    :param pkt_len: Packet length
    :return: str with SLIP header
    """
    ints = [0, 0, 0, 0]
    ints[0] = seq | (((seq + 1) % 8) << 3) | (dip << 6) | (rp << 7)
    ints[1] = pkt_type | ((pkt_len & 0x000F) << 4)
    ints[2] = (pkt_len & 0x0FF0) >> 4
    ints[3] = (~(sum(ints[0:3])) + 1) & 0xFF
Bjørn Spockeli ( 2017-07-11 16:01:16 +0100 )editconvert to answer

seq = 0, dip = 1, rp = 1, pkt_type = 0xE,pkt_len = 4: I get ints[0] = 0b11001000 = 0xC8 instead 0b11000001 = 0xC1

Jackxl ( 2017-07-11 16:15:36 +0100 )editconvert to answer

Sorry, I agree, it is not in compliance with the Core spec. A bit late in the day for bitwise arithmetics.

Bjørn Spockeli ( 2017-07-11 16:26:53 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

Question Tools

1 follower

Stats

Asked: 2017-07-11 09:13:51 +0100

Seen: 83 times

Last updated: juli 17