2017-07-18 06:53 AM
Hello guys,
I have problem with reading CPUID base register. I am beginer with STM32, be patient please.
My code seq. look like this:
I am using soft. I2C from ATMEGA 1280
START I2C
write slave adress for write (0x7C) //got ack bite
write HByte command for read registers (0x11)
//got ack bite
write L Byte command for read registers (0xEE)
//got ack bite
STOP I2C
START I2C
write slave adress for read (0x7C)
//got ack bite
read ACK1 FRAME //my answer nack bite
STOP I2C
-> here I got ACK FRAME (0x79)... so code is ok
START I2C
write slave adress for write
//got ack bite
write HByte1 of register (0xE0)
//got ack bite
write HByte2
of register
(0x00) //got ack bite
write HByte3
of register
(0xED) //got ack bite
write LByte4
of register
(0x00)
//got ack bitewrite checksum of this registers
(0x0D)
// checksum =HByte1^HByte2^HByte3^LByte4 = 13 = 0x0D
STOP I2C
START I2C
write slave adress for read
//got ack bite
read ACK2 FRAME
//my answer nack bite
STOP I2C
-> here I should get ACK2 FRAME(0x79), but I got NACK2 FRAME (0x1F)...
I really dont know where can be mistake.
I am using commands GET, GET Version, GET ID with this sequnce:
Send 2 byte command ->
get ACK FRAME ->
read any numbers of bytes ->
GOT ACK FRAME
And everything is ok.
Thank you for your help.