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.

RM48 SPI4 Loopback Problem

Other Parts Discussed in Thread: HALCOGEN, RM48L950, NOWECC

Hello,

I'm using the RM48L950 PGE with HALCoGen and IAR and I can't seem to get the loopback test for SPI4 to work.

I can transmit out of SPI4, verified with the oscilloscope but when I either solder the MOSI and MISO lines together or enable the Digital Loopback, the only thing I receive (polling method), is 0xFF.

Any suggestions?

Regards,

Griswald Brooks

  • Griswald ,

    Thanks for your post. We will look into this and get back to you

     

    Regards,

    Herules support forum

  • Griswald,

    On RM48L950 the SPI4 is multiplexed with NHET1 pins.
    Out of reset, the default function is NHET1, so in order to use the SPI4 you have to program the Pin Mux Module.

    This is available in HalCoGen using the tab "PINMUX"
    On the top of the screen you will see an Enable/Disable Peripheral check boxes. You will have to check the box for SPI4.
    It is always recommended to click on the List Conflicts button to check that your configuration is valid.

    Of course once the SPI4 is used, the corresponding NHET pins are no more usable as NHET.

  • Jean-Marc,

    That was one of the first things I checked. Hence why I have transmit working.

    To reiterate, in HALCoGen, I have the SPI4 peripheral checkbox checked under the PINMUX tab.

    Regards,

    Griswald Brooks

  • Jean-Marc,

    Any further ideas?

    Regards,

    Griswald Brooks

  • Jean-Marc,

    I've done an SPI loopback on the RM48 HDK board using the SPI2 code for SD cards.

    I've nearly copied the spiInit() code for SPI2 into SPI4's init on my board, making adjustments for the different clocks on each board, yet when I connect the MOSI and MISO lines together and use the SPI_send command the only thing I get back is 0xFF.

    I've again verified on the scope that I see the transmit data on the microcontroller pin ( pin 31 on the RM48L950 PGE )

    Any help?

    Regards,

    Griswald Brooks

  • Jean-Marc,

    What happens during spiInit() if the SPI4ENA pin is not driven low?

    Regards,

    Griswald Brooks

  • Griswald,

    The state of the spi pins have no effect on the spiInit().

    In HalCoGen, to use multiple SPI/MIBSPI, you have to check box the one you plan to use in Driver Enable tab.
    Than HalcoGen will generate the spiInit() routine. There is only one spiInit() routine that will take care of all the SPI/MIBSPI you plan to use in your application.

  • Jean-Marc,

    SPI4 in checked under the Driver Enable tab in HALCoGen and the spiInit() is being used.

    Regards,

    Griswald Brooks

  • Jean-Marc,

    I've also now reproduced the problem on the HDK. I set the spiInit settings for SPI4, set the SPI4 pinmux using the sample code functions, changed the SPI_send() function to use SPI4, and commented out the hetInit.

    I jumpered NHET102 to NHET105 on the HDK, SPI4SIMO and SPI4MOSI respectively, checked the transmission with the oscilloscope to see that I was sending 0xA2, and what I get in response is 0xFF. I even try this loop 10000 times and it's always 0xFF

    Regards,

    Griswald Brooks

  • Jean-Marc,

    Attached is the code that I've been running, for your edification.

    5751.RM48 Hercules Demo.zip

    Regards,

    Griswald Brooks

  • Hello Jean-Marc,

    The customer has contacted us stating that he still needs assistance with this inquiry.

    Any assistance you can provide is greatly appreciated.

     

    Best regards,

    James Rose Jr.

  • Hi,

    Quick question , what version of HDK are you using RevD or RevE.

    I am guessing you are using "Rev D" In which LED2 ( Tricolour) is controlled with ( NHET1 pin 2, 5 and 20) unfortunately NHET1 Pin 2 and 5 are muxed with SPI4 SIMO and SOMI. Could this be any reason for your failure ? Please check.

    Regards
    Prathap

  • Prathap,

    I'm not at the office right now, I will check on Monday. When I do, how will I tell which Rev it is? Where is it documented?

    Also, I know that the SPI4 is pinmuxed with the HET. This is in the RM48 ZWT documentation as such. In the code I uploaded I disable the hetInit() and after all the other initializations I set the SPI4 mux setting with the Gladiator commands.

    Is there somewhere else I need to change mux settings? Gladiator_PINMUX_DEFAULT() is not run in the sys_main (unless it's in some other function of course).

    Regards,

    Griswald Brooks

  • Hi Griswald,

    The Rev info is printed on the Board. Check right side of " Hercules Texas Instruments" silk screen.

    From where did you get this peice of code ( Demo) ? Did you download form TI website?

    You can use HALCoGen 3.01.01, which will help you to resolve your problem quicker.

    Regards
    Prathap

     

  • Prathap,

    I can't tell you the exact directory structure right now, but this is supposed to be the source code for the Hercules Safety MCU demo. I either downloaded it or it came on the CD with the HDK.

    I've tried using HALCoGen 3.01.01 and CCSv5.1 with the HDK and I either get a memory loading error or when I use any of the .cmd files with the project (either the sys one from HALCoGen, or the RM4 or TMS570 ones from the TI folders) I get overlapping memory errors.

    Regards,

    Griswald Brooks

  • Thanks Griswald

    On HALCoGen I have following comments

    1) If you try to build the prject in Thumb mode, there is a limitation in 3.01.01 -- See forum post for workarounds. This is addressed in future versions (3.02.00) http://e2e.ti.com/support/development_tools/compiler/f/343/p/167227/627690.aspx#627690

    2) Create a fresh HALCoGen project and generate code.

    3) SInce ECC is used by default in start up, Add the post build configuration in CCS to append ECC in the .out.. Follw the steps in the snapshot below.

     

     

  • Prathap,

    I am not trying to build the project in Thumb mode. Is this something I have to change to make in build in Arm mode? I get the impression that Arm mode is the default.

    I performed the following steps:

    1) Created new project in CCSv5

    2) Make new project in HALCoGen in the same directory and generated code

    3) Deleted main.c

    4) Included the include folder made by HALCoGen

    5) Added the line C:\Program Files\Texas Instruments\nowECC\v2.17\nowECC.exe -F021 16M_ADD --le -R4 -a "${BuildArtifactFileName}" in the post build steps

    This compiles fine, but when I load it I get a flash error, and then once it does load, the program immediately stops as shown here:

    CortexR4: GEL Output: Memory Map Setup for Flash @ Address 0x0
    CortexR4: Flash operation timed out waiting for the algorithm to complete. Operation cancelled.
    CortexR4: Flash Programmer: Error initializing device.
    CortexR4: Flash Programmer: Error erasing Flash memory.


    No source available for "C$$EXIT() at C:\Users\CRRL\workspace_v5_1\rm48SPI\Debug\rm48SPI.out:{3} 0x4f54{4}"

    00004f51: 0051 LSL R1, R2, #0x1
    00004f53: 0000 LSL R0, R0, #0x0
    loader_exit, C$$EXIT:
    00004f54: BF00 NOP
    00004f56: 4770 BX R14
    abort: <-------------------------
    00004f58: B508 PUSH {R3, LR}
    00004f5a: F7FFFFFB BL loader_exit

    Regards,

    Griswald Brooks

  • Hi Griswald,

    I do not see any problem with your CCS project, except one "it is -le not --le" in post build options.

    Try with below post build setup.

    C:\Program Files\Texas Instruments\nowECC\v2.17\nowECC.exe -F021 16M_ADD -le -R4 -a "${BuildArtifactFileName}" in

    Regards
    Prathap

     

  • Prathap,

    I had tried it both with the "-" and "--" with the same results.

    I have now also tried:

    C:\Program Files\Texas Instruments\nowECC\v2.17\nowECC.exe -F021 16M_ADD -le -R4 -a "${BuildArtifactFileName}" in

    With the same results.

    Regards,

    Griswald Brooks

  • Hi Griswald

    1) Check if the nowECC post build really worked. Basically see the Console window in CCS at the end of Build Project. (Copy the contents after Linker and send it to me).

    2) How does your "Section" definition in sys_lnk.cmd file look? . Does it look like below? If not try replacing yours with below.  

    /*----------------------------------------------------------------------------*/
    /* Section Configuration                                                      */

    SECTIONS
    {
        .intvecs : palign(32), fill =0xffffffff {} > VECTORS
        .text    : palign(32), fill =0xffffffff {} > FLASH0 | FLASH1
        .const   : palign(32), fill =0xffffffff {} > FLASH0 | FLASH1
        .cinit   : palign(32), fill =0xffffffff {} > FLASH0 | FLASH1
        .pinit   : palign(32), fill =0xffffffff {} > FLASH0 | FLASH1
        .bss     : {} > RAM
        .data    : {} > RAM

    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

  • Prathap,

    This was the output from the build:

    C:/ti/ccsv5/utils/bin/gmake --no-print-directory post-build
    C:\Program Files\Texas Instruments\nowECC\v2.17\nowECC.exe -F021 16M_ADD -le -R4 -a "rm48SPI.out" in
    'C:\Program' is not recognized as an internal or external command,
    operable program or batch file.
    gmake[1]: [post-build] Error 1 (ignored)
    ' '

    **** Build Finished ****

    I then put the C:\Program Files\Texas Instruments\nowECC\v2.17\nowECC.exe -F021 16M_ADD -le -R4 -a "rm48SPI.out" in in double quotes, which did not work, then single quotes which produced this:

    C:/ti/ccsv5/utils/bin/gmake --no-print-directory post-build
    'C:\Program Files\Texas Instruments\nowECC\v2.17\nowECC.exe -F021 16M_ADD -le -R4 -a "rm48SPI.out" in'
    process_begin: CreateProcess(NULL, "C:\Program Files\Texas Instruments\nowECC\v2.17\nowECC.exe -F021 16M_ADD -le -R4 -a \"rm48SPI.out\" in", ...) failed.
    make (e=2): The system cannot find the file specified.

    gmake[1]: [post-build] Error 2 (ignored)
    ' '

    **** Build Finished ****

    Not really sure about this one. nowECC.exe is clearly there when I look.

    My SECTIONS looked like this:

    SECTIONS
    {
     .intvecs : {} > VECTORS
     .text : {} > FLASH0 | FLASH1
     .const : {} > FLASH0 | FLASH1
     .cinit : {} > FLASH0 | FLASH1
     .pinit : {} > FLASH0 | FLASH1
     .bss : {} > RAM
     .data : {} > RAM

    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

    So I took out the post-build line and replaced the SECTIONS with yours, with no change in symptoms.

    Regards,

    Griswald Brooks

  • Griswald

    Copy and paste this in the post buid. ( now.ecc path and ${BuildArtifactFileName} should be in seperate quotes. )

    "C:\Program Files\Texas Instruments\nowECC\v2.17\nowECC.exe" -F021 16M_ADD -le -R4 -a "${BuildArtifactFileName}"

    Regards
    Prathap

  • Prathap,

    With the correct quotes I get the following message:

    C:/ti/ccsv5/utils/bin/gmake --no-print-directory post-build
    "C:\Program Files\Texas Instruments\nowECC\v2.17\nowECC.exe" -F021 16M_ADD -le -R4 -a "rm48SPI.out"
    This is nowECC Version 2.17

    Mapping: F021-16MB

    ECC calculation from 0x00000000 to 0x0000523F

    *** Appending ECC section to file -> rm48SPI.out

    No Errors

    ' '

    **** Build Finished ****

    But when loading I get 

    This error occurs with either SECTION definition. Do I need to try these suggestions with both SECTION definitions?

    (Also, what is the hot key for block comments in CCSv5?)

    Regards,

    Griswald Brooks

  • Griswald,

    In your linker command file, please try the following:

    /*----------------------------------------------------------------------------*/
    /* Section Configuration                                                      */

    SECTIONS
    {
        .intvecs : palign(32), fill =0xffffffff {} > VECTORS
        .text    : palign(32), fill =0xffffffff {} > FLASH0
        .const   : palign(32), fill =0xffffffff {} > FLASH0
        .cinit   : palign(32), fill =0xffffffff {} > FLASH0
        .pinit   : palign(32), fill =0xffffffff {} > FLASH0
        .bss     : {} > RAM
        .data    : {} > RAM

    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }


    Regards,


    Jean-Marc

  • Grsiwald,

    Can you send me your out file so I can try to program on my setup?

    Regards,

    Jean-Marc

  • Jean-Marc,

    Without the FLASH1 the load still fails as before.

    Regards,

    Griswald Brooks

  • Sorry Jean-Marc,

    I'd missed the post you made about the out file. Attached is the zipped debug folder, as it wouldn't let me attach the out file, due to its filetype.

  • Sorry Jean-Marc,

    I'd missed the post you made about the out file. Attached is the zipped debug folder, as it wouldn't let me attach the out file, due to its filetype.

    6811.Debug_08AUG12.zip

    Also, can we talk about the SPI4 problem? I attached the code previously, but I will attach it again here.

    0434.RM48 Hercules Demo.zip

    It is a modified version of the Hercules Demo, swapping SPI4 for SPI2.

    Regards,

    Griswald Brooks

  • Hello Jean-Marc,

     

    The customer has called in asking for further assistance with this inquiry.

    Any assistance you can provide is greatly appreciated.

     

    Best regards,

    James Rose Jr.

  • Hello,

    The SPI4 terminals on RM48x are multiplexed inputs. That is, there are multiple input paths for the SPI4 terminals which need to be selected.

    Signal Name        Control A        Control B

    SPI4SIMO             PINMMR5[9]   PINMMR23[16]
    SPI4SOMI             PINMMR5[17] PINMMR23[24]
    SPI4CLK              PINMMR5[1]    PINMMR23[8]
    SPI4NENA           PINMMR4[17]  PINMMR24[0]

    SPI4NCS             PINMMR4[25]  PINMMR24[8]

    The input to a module comes from the multiplexed pin when the condition [ A and not(B) ] = TRUE.
    The input to a module comes from the dedicated pad when the condition [ not(A) or (A and B) ] = TRUE.

    Regards,

    Sunil

  • One more thing: you need to configure the controls to enable the multiplexed input path for all the SPI4 terminals.

    Regards, Sunil

  • Sunhil,

    It would be nice if I could just speak to one person about this problem as the case history here seems to have been lost.

    The code that I have been using was a modified version of the Hercules Demo which I have posted and will again post here:

    1205.RM48 Hercules Demo.zip

    The code initializes all the things in the demo except the HET (just for good measure).

    The spiInit() has been modified from SPI2 to SPI4 (I think this is what you mean by configuring the controls to enable the multiplexed input paths).

    Then, the pinmuxes are set using the Gladiator code (found in pinmux.c) to pinmux SPI4. (PINMMR24 bits were not set according to your previous instruction but I have since enabled those with no affect).

    FInally, using the SPI_send function (from SDCard.c), modified to use SPI4, I attempt to do a loopback test by jumpering NHET pins 102 and 105 (as seen on the HDK silkscreen), which returns all 0xFF.

    When doing this test using SPI2, the loopback done in this fashion worked perfectly.

    I have verified with the oscilloscope that the correct bytes are being transmitted but the receive just doesn't seem to be coming through.

    Please have a look at my code and get back to me.

    Regards,

    Griswald Brooks

  • Griswald,

    I've looked at your modified code, and I've found an issue.

    Here is the modified version for SPI4 pin mux (In and Out)

    void Gladiator_PINMUX_SPI4_MUX_PINS()
    {
    /*Default pins also available*/
     *(int *) 0xFFFFEB24  = 0x01020202; //P5 //SPI4SOMI,SPI4SIMO,SPI4CLK
     *(int *) 0xFFFFEB20  = 0x02020101; //P4 //SPI4NCS[0],SPI4NENA
     *(int *) 0xFFFFEB6C  = 0x00000001; //P23 //INPUT Control
     // Added 08/30/12
     *(int *) 0xFFFFEB70  = 0x01010000; //P24 //INPUT Control
    }

    I've checked on my own test case and it is working.

    Please let me know.

  • Griswald,

    In my last reply, I've forgot to mention that Halcogen (3.02.02) does not generate the code for SPI4 multiplexing correctly.

    I've open a ticket for this problem. It will be fixed in the next release.

  • Jean-Marc,

    Thank you. I've tried this on my HDK and have gotten a successful loopback.

    Before I mark this issue resolved, perhaps you can explain something to me.

    I've been looking at the RM48 Technical Reference (page 238) and I fail to understand how the code you sent me is congruent with what the reference says.

    Regards,

    Griswald Brooks

  • Griswald,

    A new version of the TRM for TMS570RM48 has been release today.

    On page 224 you will find additional information to program and set-up the input mux for multiplexed balls.

    Please let me know if this is helpful.

  • Jean-Marc,

    So just to be clear, the reason that the pinmux code that you sent me works is because PINMMR4 and PINMMR5 sets bits, and PINMMR23 and PINMMR24 clear bits

    ie:

    PINMMR5[9] = set

    PINMMR5[17] = set

    PINMMR5[1] = set

    PINMMR4[17] = set

    PINMMR4[25] = set

    PINMMR23[16] = clear

    PINMMR23[24] = clear

    PINMMR23[8] = clear

    PINMMR24[0] = clear

    PINMMR24[8] = clear

    Regards,

    Griswald Brooks

  • Griswald,

    Yes, if you look Figure 4-3. Input Multiplexing Example SPI4CLK is used as example.

    The point here is, at one point, SPI4 has dedicated pins and multiplexed pins. (Depending on the package used)
    In your case, only multiplexed ball can be used for SPI4. So it is necessary to select the correct input path.
    This is what is done by combining PINMMR5 with PINMMR23 and PINMMR4 and PINMMR24.

    To make it simpler for the end user, Halcogen was suppose to do this setup. Unfortunately, there is a bug.

    Again this will be fixed in the next release.




  • Jean-Marc,

    Thank you. I completely understand now and we have tested it on multiple hardware now verifying the functionality.

    Regards,

    Griswald Brooks