Debug imx6 SPI Slave kernel driver, pre-commissioning always have to catch up with the Register settings, procedure function calls.
The PRINTK () print statement is used.
1, the use of hardware methods are:
Each pin of the analysis imx6 SPI slave is mainly CLK, CS, Mosi, miso, GND, VCC, connected to the SPI Master (cc1110f32 MCU)
The corresponding pins of each road. Corresponds to the following:
imx6 SPI Slave Machine |
CC1110F32 SPI Host |
Vcc |
Vcc |
Gnd |
Gnd |
Class |
Class |
Cs |
Cs |
Mosi |
Mosi |
Miso |
Miso |
2, the use of the Software method is:
1) The official patch program https://community.freescale.com/docs/DOC-97380
2) can not be directly patched, according to the changes, refer to SPI Datasheet for source analysis, using PRINTK () tracking Data flow
3) Ensure the configuration of Cpol, Cpha, CS, sclk are consistent with the master and slave end use
3. Final Result:
The SPI slave terminal can only correctly receive data from a single byte emitted from the SPI master, and data is dropped after receiving multiple data.
Between each slice, add a similar
for (i=010000; i++);
After the delay was found, when I < 10000, multiple bytes of data received correctly, when I < 5000, multiple bytes of data received only half the correct data.
For example 0 1 2 3 4 5 6 7 8 9 at I < 10000, the SPI slave end received 0 1 2 3 4 5 6 7 8 9
At I < 5000, the SPI Slave end received 0 2 4 6 8
At I < 2000, the SPI slave end received even 0 4 8
Then, after removing the PRINTK () from the kernel, it is found that the receiving end can receive it correctly as long as the delay between each slice is not 100us.
The data from the main SPI end without data loss.
At this point, we come to a conclusion: in the debugging of communication bus, it is possible to send and receive a single byte in the case of PRINTK ().
Once faced with the rapid delivery of the receiving time, PRINTK () Such a debug statement will seriously affect the performance of the bus, after all, PRINTK () occupied the bus communication
Time.
About the performance impact of the PRINTK () on the SPI slave kernel driver