Can you please provide an example of how to use the gio functionality for dmm pins?
I configured and used the DMM pin DMMDATA[2] with
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.
Can you please provide an example of how to use the gio functionality for dmm pins?
I configured and used the DMM pin DMMDATA[2] with
Hi Thomas,
From the first look of your code, seems that the gioSetBit function is not called properly. Can you try 'gioSetBit(dmmPORT, 4, 1); ' instead of the function call you have used for gioSetbit? The driver for gioSetBit is implemeted in the below syntax:
/** @fn void gioSetBit(gioPORT_t *port, uint32 bit, uint32 value)
* @brief Write Bit
* @param[in] port pointer to GIO port:
* - gioPORTA: PortA pointer
* - gioPORTB: PortB pointer
* @param[in] bit number 0-7 that specifies the bit to be written to.
* - 0: LSB
* - 7: MSB
* @param[in] value binary value to write to bit
In the meanwhile, i shall also give it a try at my end.
Regards,
Praveen
Hello Praveen,
is the address for dmmPORT correct?
Halcogen generates:
#define dmmPORT ((gioPORT_t *)0xFFFFF738U)
In the TRM is DMMDESTxBL2 on address 0xFFFFF738h
Do I have to call dmmInit() before using the dmm Pins as gpio? Do I have to configure the dmm Pins in Halcogen as gpio on the DMM tab?
Regards,
Thomas
Hi Thomas,
Are you checking the dmmPORT definition in reg_dmm.h? I see that it is generated correctly generated at my side.
From reg_dmm.h : "#define dmmPORT ((gioPORT_t *)0xFFFFF770U)" . Can you send me your halcogen project ?
Yes, You have to call the dmmInit() by setting the desired pins as gpio in the DMM tab. This will initialise the dmm pins as gpio before you start using the pins. Once that is done, you can go ahead and set the directions/set,clear the pins. The below sequence should work:
void main(void)
{
/* USER CODE BEGIN (3) */
dmmInit();
gioSetDirection(dmmPORT, 1 << 4);
gioSetBit(dmmPORT, 4, 1);
/* USER CODE END */
}
Attaching the halcogen project for your reference:
http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/312/6011.DMM_5F00_GPIO.hcg
http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/312/6281.DMM_5F00_GPIO.dil
Regards,
Praveen
Hello Praveen,
is the call of dmmInit() also necessary, if DMM is not used?
Regards,
Thomas
Hello Thomas,
The dmmInit() is actually configuring the PC0 register (& other PC* registers as well) which is going to set the pins in GIO mode. So it is required to call that function before using it in GIO mode.
That said, the on-reset default value for the PC0 register is to set the pins in GIO mode, hence dmmInit() may not be required if you are going to use the DMM as GIO pins immediately after reset. But it is good to call the dmmInit() function with your required configuration, so that all your configurations are grouped under one function(You can select all the configurations in the DMM tab in halcogen).
Regards,
Praveen
Hello Praveen,
It works. Thanks for your help.
Thomas
I have attached the hcg file as .txt
In Halcogen I have done:
Enable DMM.
On Pinmux tab select the Pins for DMM functionality.
On the DMM tab select GIO function for DMM pins.
Generate Code.
In Code Composer:
Change dmmPORT address from 0xFFFFF738U into 0xFFFFF770U
main()
{
dmmInit();
gioSetDirection(dmmPORT, 1 << 4);
while(1) gioToggleBit(dmmPORT, 4);
}
Hi Thomas,
Good to hear that you got it working. But, I am still wondering why the dmmPORT address is not correct in your case. I tried the halcogen project you gave and it is generating the right address(in reg_dmm.h) at my side.
Can you try generating the code one more time with the latest halcogen release and let us know if you are still not getting the correct dmmPORT address?
Regards,
Praveen
PS: If this answers your question, please click verify answer to close this thread.
Hello Praveen,
I use HalCoGen 3.08.01 and it generates the address xx738U in reg_dmm.h
Thomas
Hello Praveen,
in the DIL file I found
DRIVER.DMM.VAR.DMM_BASE_PORT.VALUE=0xFFFFF738
and changed it to
DRIVER.DMM.VAR.DMM_BASE_PORT.VALUE=0xFFFFF770
Now, the right address is generated.
I think it is a problem, that the project is generated from an older version of Halcogen. The update to a newer version of Halcogen do not update the DIL file?
Thomas
Hello Thomas,
Glad to know that you were able to locate the issue. I will get in touch with the Halcogen experts to check if the DIL willl get updated. Will keep you posted.
Regards,
Praveen