Hi,
I'm using HALCoGen 3.6.0 with TMS570LS1227 MCU.
I'm using ADC1 module, is it possible use AD1EVT as GIO?
Thanks
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.
Hi,
I'm using HALCoGen 3.6.0 with TMS570LS1227 MCU.
I'm using ADC1 module, is it possible use AD1EVT as GIO?
Thanks
Enrico,
The ADC_EVT pin can be used has GIO pin. All control register are available to control the direction, In, Out, Set, Clear.
Unfortunately, the Halcogen GIO driver cannot be used on ADC_EVT because of a swap in 2 registers.
Here is the definition and register order for ADC_EVT
uint32 EVTDIR; /**< 0x00FC: Event pin direction register */
uint32 EVTOUT; /**< 0x0100: Event pin digital output register */
uint32 EVTIN; /**< 0x0104: Event pin digital input register */
uint32 EVTSET; /**< 0x0108: Event pin set register */
uint32 EVTCLR; /**< 0x010C: Event pin clear register */
uint32 EVTPDR; /**< 0x0110: Event pin open drain register */
uint32 EVTDIS; /**< 0x0114: Event pin pull disable register */
uint32 EVTPSEL; /**< 0x0118: Event pin pull select register */
Here is the definition of the GIO_Port used in all GIO function:
typedef volatile struct gioPort
{
uint32 DIR; /**< 0x0000: Data Direction Register */
uint32 DIN; /**< 0x0004: Data Input Register */
uint32 DOUT; /**< 0x0008: Data Output Register */
uint32 DSET; /**< 0x000C: Data Output Set Register */
uint32 DCLR; /**< 0x0010: Data Output Clear Register */
uint32 PDR; /**< 0x0014: Open Drain Register */
uint32 PULDIS; /**< 0x0018: Pullup Disable Register */
uint32 PSL; /**< 0x001C: Pull Up/Down Selection Register */
} gioPORT_t;
If you don't use the direct In and Out Register, than you can still use the GIO driver to control the ADC_EVT.
You will have to add a definition like:
#define gioADC1_EVT ((gioPORT_t *)0x0xFFF7C100U)
#define gioADC2_EVT ((gioPORT_t *)0x0xFFF7C300U)
Another option is to define a new gioPORT_t structure that will be only used for ADV_EVT. Just swap in the structure definition the DIN and DOUT register and use this new structure to define your gioADC1_EVT and gioADC2_EVT.
Have a try and let me know.
Hi Jean-March,
Are you sure? I'm using Halcogen 3.6.0.
In the Techincal Reference Manual SPNU515, the ADC control registers for ADC_EVT pin are:
- FCh ADEVTDIR ADC ADEVT Pin Direction Control Register
- 100h ADEVTOUT ADC ADEVT Pin Output Value Control Register
- 104h ADEVTIN ADC ADEVT Pin Input Value Register
and in Halcogen 3.6.0, the ADC control registers are defined as following:
- uint32 EVTDIR; /**< 0x00FC: Event pin direction register */
- uint32 EVTOUT; /**< 0x0100: Event pin digital output register */
- uint32 EVTIN; /**< 0x0104: Event pin digital input register
I noticed that:
A) If I inizialize the ADC_EVT pin ( adcREG1->EVTPDR = 0; adcREG1->EVTSET = 0; adcREG1->EVTDIR = 1; ) before the ADC initialization (init. of Halcogen), the ADC_EVT pin does't work.
B) If I inizialize the ADC_EVT pin after the ADC initialization, the ADC_EVT pin works.
Why?
Regards
Enrico
Enrico,
After a power on reset, all modules are in reset state.
In the startup code, the nPRST is released (Peripheral Reset).
For almost each peripheral module (ADC is part of them) there is a reset bit in the register frame.
For ADC it is in register ADRSTCR bit 0. When the bit is 0, the module is held in reset, and you can't control the ADC_EVT pin.
When the adcInit() is called, the code will release the ADRSTCR bit 0 and now you can control the ADC_EVT pin.
Now to clarify my previous answer, the register definition in Halcogen for ADC is correct.
The problem is the GIO port structure used to control IO pin is different for ADC_DIN and ADC_DOUT.
Also, you mentioned using Halcogen 3.06.00 I highly suggest to update to version 03.09.00. This is the latest release available online.