This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM437X: Inquiry

Genius 9880 points

Part Number: PROCESSOR-SDK-AM437X

Hi Team,

Good day,

We received inquiry from customer regarding AM437x, below is the inquiry.

"

I want to modify the size of SPI buffer. How can I change this?  and Can I have a 4.1.18 kernel version of SPI driver

"

Regards,

Maynard

  • Hello Maynard,

    Linux Processor SDK 2.00.00.02 used Linux 4.1.18. But please keep these disclaimers in mind:

    * Linux 4.1.18 is too old for us to support on the forums
    * The processors wiki documentation for that SDK has been taken offline. Linux Processor SDK 4.3 is the oldest SDK that still has full documentation online.

    In general, we suggest that customers use more recent versions of the Linux Processor SDK for software development.

    Regards,

    Nick

  • Hi Nick,

    Thank you for your kind response.

    Is there a way our method to modify the size of the SPI buffer? 

    Regards,

    Maynard

  • Hello Maynard,

    Do we have more details about what the customer is looking for? e.g., which SPI driver are they asking about? Why do they need to modify the buffer size?

    Regards,

    Nick

  • Hi Nick,

    Customer is referring to spidev1.0 in AM437X. According to them, when they call the IOCTL interface for SPI double working communication in the application, it will prompt the error: "Message too long". They think maybe the SPI buffer length is small.

    Regards,

    Maynard

  • Hello Maynard,

    Can we get the terminal output that the customer is looking at and the version of software they are using?

    Regards,

    Nick

  • Hi Nick,

    Below is the response provided by the customer.

    "

    1. Kindly provide us the terminal output that you are looking at and
    >  I use ioctl for SPI communication in the application, ret = ioctl (fd, SPI_ IOC_ Message (1), & tr), use" perror” function to print error message and return: "message too long".


    2. the version of software you are using.
    > The Linux version I use is 4.1.18

    Or can you tell me the reason for the mistake?

    I use IOCTL to set spi_mode, spi_bits, spi_speed in my application, it is normal. Only when SPI communication is used to transmit data, this error will occur. Can you help me solve this problem?

    "

    Regards,

    Maynard

  • Hello Maynard,

    Skimming through the AM437x Linux SDK 6.3 code for drivers/spi/spidev.c:

    rx and tx buffers for spidev are size of bufsiz = 4096
    MODULE_PARAM_DESC for bufsiz says it is the number of "data bytes in biggest supported SPI message"
    function spidev_open uses kmalloc(bufsiz, GFP_KERNEL) to create the TX and RX buffers.

    So I assume the customer is trying to write more than 4096 bytes to spidev at once. They could either write fewer bytes at once to spidev, or they could increase bufsiz in the driver.

    Some final notes:
    * spidev is generic Linux code, not TI-specific code. TI does not test or validate it, and we cannot answer questions about it on the forums.
    * It is up to the customer if they want to modify the spidev driver. TI does not answer questions about driver modification on the forums. However, there are resources the customer could use online if they use searches like "spidev increase buffer size"
    * Keep in mind that bufsiz is defined in the driver, but some of the non-TI websites I skimmed through indicated that it might also be set in other locations. So if the customer makes changes but continues to run into a 4096 limit, they may need to search around to see if bufsiz is getting set somewhere else in the kernel as well.

    Regards,

    Nick

  • Hi ,Nick,

    I'm asking the user about this problem. I want to ask, in my terminal, the perror function prints: “message too long”. In what way can I solve this problem?

  • Hello,

    I think I answered your question in my previous post:

    "So I assume the customer is trying to write more than 4096 bytes to spidev at once. They could either write fewer bytes at once to spidev, or they could increase bufsiz in the driver."

    Please reword your question if I did not understand you properly.

    Regards,

    Nick