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.

Hercules RM42x missing I2C (Sensor Hub)

Other Parts Discussed in Thread: HALCOGEN

Hello guys,

I have a Hercules RM42x board and a TI sensor hub (booster pack for TI lauchpads). 

I Found these two rows on the booster pack page and therefore bought the hercules RM42 tough the primary row would do just fine for my project. 

"Primary header (outer row) compatible with other TI MCU LaunchPads 
Secondary header (inner row) offers additional Tiva C Series-based expansion signals"

Now I cant get it working because it seems that the sensors is only running on the I2C bus and the RM42x MCU dont support that bus. 

Any suggestions how I could proceed? 

  • Hi,

    There is the possibility to implement an I2C master with the N2HET module avaible on the RM42.

    You can find details about this in this Post.

    I hope that helps.

    Best Regards,
    Christian

  • I've posted my experience with porting that example to Hercules here on the e2e web.

    The approach worked for me.

  • Thank you for your answer,

    I have seen your experiment and is testing it but had a hard time make it use other pins. The sensor board is using J2.6 and J2.7 for I2C bus. How can I manipulate my hercules board to use these two pins? 

    THanks 

  • The simplest way is to change line 1 and 2 of the .het code, and define the right direction of the new pins in HALCoGen or your code.

    You can also  change the .het commands in HET_INIT0_PST before calling hetInit() (not tried by me yet) in your C code.

  • Hi,

    As Jan already said, the clean way is to manipulate the .het file and re-assembled it. There are two defines at the top of the file to change the pins: 

    SDA_PIN .equ 0;
    SCL_PIN .equ 2;

    Please note, that the comments in those lines seem to be complete nonsense.

    The other way is to identify all instructions accessing these two pins in the HET program (again in the .het) and overwrite them in the constant HET_INIT0_PST structure.
    There are 4 instructions accessing the SCL_PIN and one for the SDA_PIN.

    Third possibility is to overwrite the het instructions in the HET memory during runtime (HET is not running), the instructions have to be identified as previously explained.

    Please note, that you can access the HET memory via structures like:

    hetRAM1->Instruction[pHET_SDA_SHFT_0].Control = (hetRAM1->Instruction[pHET_SDA_SHFT_0].Control & ~(0x1Ful << 8)) | (SCL_PIN << 8);

    Please note, I haven't verified if above code snippet works correctly!

    In summary either you modify the assembly or program image and thus a static configuration, or you do make it dynamically configurable.

    I hope these explanations help, on how to use and access the HET.

    Best Regards,
    Christian

  • It could look something like:

    	HETPROGRAM0_UN * pHetProgram; // we're going to override the pin assignments in the .het code
    
    	pHetProgram = (HETPROGRAM0_UN *) HET_INIT0_PST;
    
    
    	pHetProgram -> Program0_ST.State2_0.br.pin_select = 8;
    	pHetProgram -> Program0_ST.State6_0.br.pin_select = 10;

    /// ... and so on for all the opcodes that use either SDA_PIN or SCK_PIN hetInit(); // your altered program is now loaded into HET RAM.

    Again, not tried yet. Looking forward to your experience with this :)