When trying to program FPGA bitstream to flash using SC18IS606 I've faced a strange problem that manifested itself with FPGA not starting properly from programmed memory.
After looking into the problem and doing some logic-analyzer work I have found that the first byte of bitstream readout was equal to 0xF1. Surprisingly, such value did not occur in a bitstream.
First I thought it's some transmission error on I2C side. However, analyzing it revealed perfectly normal transmission. Then I started recording the whole page write operation, and it turned out that there was an extra byte at the end (it had 261 instead of 260 bytes - 256 bytes of page data + 1 op code + 3 address bytes) with value 0xF1 that due to address wrapping was written at 0-th byte.
The only place where 0xF1 occurred in my code was writing operation (interrupt register clear) just after writing a page that was supposed to check (by getting ACK) that write operation was finished, and if next operation can be performed.
For some reason, this 0xF1 opcode was sent over SPI. It is totally unclear to me why as 0xF1 was sent in a separate I2C operation (see fig.).
Adding a 5 ms delay after writing made a good walkaround. However, I do not understand the behavior here. According to the datasheet:
SC18IS606 will place the data received into a buffer and continue loading the buffer
until a STOP condition is received. After the STOP condition is detected, further
communications will not be acknowledged until the function designated by the Function ID has been completed.
From this I read that if the operation was not finished, the device should NACK. But here, not only it did not NACK (even with top frequency of 1843 kHz should take a bit more than 1ms) but it seems it put this op-code into the buffer.
Am I missing somthing here, or this is not what was expected?
Dear Mikolaj,
possible explanation:
This behavior suggests a race condition or buffer mismanagement in the SC18IS606:
The delay is effective and safe.
With Best Regards,
Jozef
I observed the same issue during a page write sequence to a AT45 flash device.
During the flash write process, the SC18IS606 replies with an ACK despite the SPI communication is fully in progress.
It seems to me that the necessary (and documented!) NACK response for indicating busy mode of the SC18IS606 device doesn't work at all in this situation.
Please see the attached images in order to comprehend the issue.
In my case the behavior of the SC18IS606 also leads to the problem, that further commands are send to the AT45 in order to read its status register for busy mode. These commands are then appended to the data in the SC18IS606 buffer which are then appended in the SPI transfer and result in a flash buffer write overflow (the first bytes of the flash buffer are overwritten with the status register commands). Of course, this creates ton's of garbage data in the flash...
Can you confirm this behaviour of the SC18IS606 chip on your side?
Am I missing some restrictions regarding the end of a SC18IS606 transfer and the beginning of the next one?
Kind regards,
Julian
Dear Julian,
please see below an answer from an application engineer. Please provide requested and answer the questions.
DESCRIPTION
With Best Regards,
Jozef
Dear Julian,
please see below answer with suggestions from the application engineer. Please test as suggested.
DESCRIPTION
Thanks for the information and customer for the detailed information.
With Best Regards,
Jozef
Hello Jozef,
Until now, I did not use the clear interrupt command prior to any transmission, because it is stated optional in case of polling the IC.
I performed several tests with the INT pin also probed and recognized no noteworthy difference in behavior whether I used a clear interrupt command or not.
In my attached usecase, you can see your desired behavior with the clear interrupt command before any write buffer command on my µC to the SC18 IC.
In general, the insertion of the clear interrupt command did not solve my problem.
Please have a look at the attached scope images, where I did a zoom on any important part of the transaction.
The images are numerated and the number increases proportional to the timeline of the sequence. A short explanation of each specific zoom is in the name of each image.
As far as I can tell, there seems to be an issue with the reset of this interrupt, as I can observe a state change of INT without any clear interrupt command (see especially attached image "04 zoom - flash ready SC18 readout - INT clear despite no command was send.png").
I don't know if this correlates with the absence of NACK in the SC18 IC beeing busy.
I think it would be most effective, if you could check this behavior with an evaluation board of the SC18 on your side, in order to see if it behaves different.
If it does, it would be really interesting how this is possible.
Looking forward to hearing from you.
Kind regards,
Julian
Hello Julian,
another application engineer joined the internal conversation and is suggesting to add the 5ms delay after writing, as described in the first message. Have you tested this workaround? If not, please test it.
With Best Regards,
Jozef
Hi Jozef,
I do have a timeout-based workaround. I measured the time the SC18 needs in order to transfer the data with the scope. As far as I can tell, the SC18 takes ~2x the time that should be necessary in order to transfer the data with 1.8MHz via SPI. This is because of a delay between each transferred byte that is as long as the transfer of a single byte itself (see attached image).
Because of this behavior, my timeout can be much smaller than 5ms but is implemented at least long enough to ensure the end of the write transaction on the spi bus.
I implemented this workaround before appending my observation to this thread, as I was in high need of a quick solution. Nevertheless I am very interested in finding the root cause of the error behavior, as I'm really interested in further improving the transfer speed for my application.
Could you verify the same behavior on an evaluation board in the meantime?
Kind regards,
Julian