ROM bootloader WriteMemory fails

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

ROM bootloader WriteMemory fails

跳至解决方案
1,207 次查看
richardmoran
Contributor II

Hi everyone.

I'm trying to program some KL27s using the ROMN bootloader via SPI in a custom circuit and I am unable to write to memory using the WriteMemory command.

I use the FlashEraseUnsecure command then do the WriteMemory command which gets nacked at the first data packet.

Below a a capture of the packets sent over the SPI bus when attempting to set 100 bytes at address 0 to 0xA2

erase cmd                  5A A4 4 0 F6 61 0D                             

ack                             5A A1                                  

Generic response      5A A4 0C 0 54 81 A0 0 0 2 0 0 0 0 0D 0 0 0                  

ack                             5A A1                                  

write cmd                   5A A4 0C 0 6D 3A 4 1 0 2 0 0 0 0 64 0 0 0 0 0                

ack                             5A A1                                  

Generic response      5A A4 0C 0 23 72 A0 0 0 2 0 0 0 0 4 0 0 0                  

ack                           5A A1                                  

data  packet             5A A5 20 0 B4 B0 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2 A2                                 A2 A2 A2 A2 A2 A2 A2 A2 A2

nack                         5A A2     

Does anyone have any ideas what I'm doing wrong?

Cheers,

Rich

标签 (1)
0 项奖励
回复
1 解答
1,030 次查看
richardmoran
Contributor II

Problem solved!.

I had a subtle bug in the calculation of the data packet crc.

Thanks for the help.

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,030 次查看
bobpaddock
Senior Contributor III

What activity is going on, on other ports?  I've had problems with the 27 bootloader loading from USB if there is serial activity on a UART.

0 项奖励
回复
1,030 次查看
richardmoran
Contributor II

There's no other activity going on.  LPUART0 and 1 are not connected to anything at the moment and I'm not using I2C. 

Apart from the SPI, it's all digital I/O which aren't changing states and 1 channel of ADC, which should be disabled in bootloader mode anyway.

0 项奖励
回复
1,031 次查看
richardmoran
Contributor II

Problem solved!.

I had a subtle bug in the calculation of the data packet crc.

Thanks for the help.

0 项奖励
回复