Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix name mismatches in bitbang requests #10

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adiv5-swd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def read(port, addr, opt={})
if !opt[:count]
reply = @drv.transfer(req)
else
req[:count] = readcount
req[:val] = readcount
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From looking at cmsis-dap.rb, it seems that :count is the "new" way of passing this information...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should change the bitbang driver to accept :count instead of :val

reply = @drv.transfer_block(req)
end

Expand Down
6 changes: 6 additions & 0 deletions nrf51.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ def mass_erase
sleep 0.01
end

self.ERASEUICR = 1
while !self.READY.ready
Log(:nrf51, 1){ "waiting for UICR erase completion" }
sleep 0.01
end

self.CONFIG.WEN = :REN # enable read

if self.CONFIG.WEN != :REN
Expand Down
5 changes: 4 additions & 1 deletion swd-bitbang.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def transfer(req)
# reads to the AP are posted, so we need to get the result in a
# separate transfer.
if req[:port] == :ap
rdbufret = transfer(dir: :read, port: :dp, addr: Adiv5Swd::RDBUFF)
rdbufret = transfer(op: :read, port: :dp, addr: Adiv5Swd::RDBUFF)
ret[:ack] = rdbufret[:ack]
data = rdbufret[:val]
end
Expand Down Expand Up @@ -109,4 +109,7 @@ def calc_parity(data)
def hexify(str)
str.unpack('C*').map{|e| "%02x" % e}.join(' ')
end

def flush!
end
end