Author Topic: SATA Scrambling Algorithm  (Read 5381 times)

0 Members and 1 Guest are viewing this topic.

Offline ArchyTopic starter

  • Newbie
  • Posts: 2
  • Country: us
SATA Scrambling Algorithm
« on: February 27, 2025, 07:52:53 pm »
Encountered the following issue while implementing a SATA3 controller on an FPGA: the scrambling algorithm sometimes encodes data into primitives (ALIGN, EOF, etc.).

Setup:

1) Board: ZCU102.

2) Vivado 2019.2.

3) Transceiver configured via "UltraScale FPGAs Transceiver Wizard" with the preset "GTH: SATA (Pre-Production)".

4) All protocol layers (Command, Transport, Link) are custom implementations.

5) The controller is fully functional (initialization, read/write operations work without errors).

6) The scrambling algorithm was copied from outputlogic.com.

Issue Description:

During a write operation (DMA WRITE EXT command, 16 sectors of 512 bytes each), a 32-bit counter is written from 32'h8EF50800 (32'd2398423040) to 32'h8EF50FFF (32'd2398425087). However, at the 1524th word (value 32'h8EF50DF3 (32'd2398424563)), the data is scrambled into an ALIGN primitive (32'h7B4A4ABC). The scrambled data is then sent directly to the transceiver core. The drive does not report an error in response to this command, but when reading back the written data, a CRC error occurs. The ILA shows that the received data is "corrupted" starting exactly from the 1524th word.

Questions:

1) Am I correct in understanding that during reading, the transceiver core interprets the "encoded" ALIGN primitive not as data, causing desynchronization (after the 1524th word, I see garbage data)?

2) How can this behavior be avoided?


I attach .txt file with data sequences (the exact data being sent to the drive) with primitives and c++ program that generates this output in case someone is interested.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 6962
  • Country: li
Re: SATA Scrambling Algorithm
« Reply #1 on: February 27, 2025, 09:40:21 pm »
I've put your issue "as is" into the chatgpt (including the two files) and it proposed to me a new scramble_qword() function with several fixes in it..
Readers discretion is advised..
 

Offline ArchyTopic starter

  • Newbie
  • Posts: 2
  • Country: us
Re: SATA Scrambling Algorithm
« Reply #2 on: February 27, 2025, 10:17:33 pm »
This is my first time on this forum. Is it standard practice to send people to chatgpt in response to a problem, or are you racking up stats on replies to posts?
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 2704
  • Country: au
    • Halestrom
Re: SATA Scrambling Algorithm
« Reply #3 on: February 27, 2025, 11:45:13 pm »
iMo: LLM's are very unreliable at solving problems, if you send someone to those then they'll be back with 10 problems.

Archy: if you do not get any good answers on this forum then I'd suggest an OS dev forum, there is a good likelihood you will find someone who has written SATA interface code in one of those.
 
The following users thanked this post: Archy

Offline Langdon

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: ca
    • My website + My software
Re: SATA Scrambling Algorithm
« Reply #4 on: March 03, 2025, 02:22:27 pm »
I'm sure some BSD or something has an open-source SATA controller.
"It's a small world, but not if you have to clean it."—Barbara Kruger
 

Offline TomS_

  • Frequent Contributor
  • **
  • Posts: 861
  • Country: gb
Re: SATA Scrambling Algorithm
« Reply #5 on: April 14, 2025, 06:54:43 am »
This is my first time on this forum. Is it standard practice to send people to chatgpt in response to a problem, or are you racking up stats on replies to posts?

I think for some people that is just the answer to everything.

Some of us don't use AI products, so dropping an answer like that with nothing further is practically useless.
 

Offline Langdon

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: ca
    • My website + My software
Re: SATA Scrambling Algorithm
« Reply #6 on: April 14, 2025, 02:05:10 pm »
What about SATA 1 and 2?

I think SATA controllers are backwards-compatible.

What is your desired goal?
"It's a small world, but not if you have to clean it."—Barbara Kruger
 

Offline asmi

  • Super Contributor
  • ***
  • Posts: 3377
  • Country: ca
Re: SATA Scrambling Algorithm
« Reply #7 on: April 14, 2025, 02:09:07 pm »
Is it standard practice to send people to chatgpt in response to a problem <...>?
Absolutely not. I personally think such responses are rude and ignore them.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->