first impressions and questions

mikroC, mikroBasic and mikroPascal for PRO ARM® MCUs, supporting STM32, Tiva, Kinetis, & CEC devices
Post Reply
Author
Message
r_y_
Posts: 2
Joined: 23 Apr 2019 20:44

first impressions and questions

#1 Post by r_y_ » 23 Apr 2019 20:55

Hi

I started to play with EasyMx PRO v7 for Tiva development board and mikroc compiler.
I decided to test analog comparator functionality on the TM4C129XNCZAD microcontroller.

And some questions arose during this project:

1. I added TivaWare driver library and mikroc compiler could not compile interrupt.c file. It provides error at statement: static __attribute__((section("vtable"))).
Why?

2. I tried to add interrupt capability for analog comparator. However no luck either I used TivaWare
(the function IntMasterEnable() could not compiled)
or mikroc approach
( EnableInterrupt();
NVIC_IntEnable(IVT_INT_COMP0);
void mkcCC() iv IVT_INT_COMP0 ics ICS_OFF {// some code} and
ComparatorConfigure(COMP_BASE, 0,(COMP_TRIG_NONE | COMP_INT_BOTH |COMP_ASRCP_REF | COMP_OUTPUT_NORMAL));
I saw that state of comparator changed however no mkcCC function executed).
Any advice about interrupt usage?

3. I created new project at mikroC IDE. I adjusted Search Paths for sources and headers for TIvaWare library however statement #include "driverlib/comp.h" does not work as soon I explicitly open comp.c file in IDE. And reverse situation: When I once include interrupt.h file and opened interrupt.c file I never could delete it from project even when I close the source file and comment include statement (Remove file from Project menu is disabled).
Any comments?

Of course I prefer to use mikroC compiler and IDE due to availability of the libraries.

4. Is FreeRTOS library from mikorelektronika support TM4C129XNCZAD microcontroller and mikroC compiler?

5. Is FAT32 library from mikorelektronika support TM4C129XNCZAD microcontroller and mikroC compiler?

The mikroC compiler and IDE look interested in general by my opinion and I like to learn it deeply.

Thank you

ry

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: first impressions and questions

#2 Post by petar.suknjaja » 24 Apr 2019 10:11

Hi,

1. TivaWare is peripheral driver library, in cases where you're adding external libraries to the mikroE compiler make sure that syntax matches or you'll have to deal with different kinds of errors and issues.

2. Unless I get the whole code, I can't help you on the fly. You said the state of comparators changed, but the function wasn't executed.
Have you tried to debug? What happens in the interrupt routine?
Regarding the advice about the interrupt usage - I recommend looking at the examples in the compiler.

3. Again, without getting insight in the project I can comment it.
The best way to deal with this is carefully examine the folder structure of the folder and required files.
If you include the files in the project, you don't need to add Search Path. But if you're lacking one or more files in the project, it will surely generate an error.
You can create a video with bandicam and send us here, or better, send us the project with which we could reproduce the issue.
I've tangled with adding external libraries in the past - the most recent one was adding the SimpleLink Wi-Fi CC3100 SDK to the TM4C129 project, if you know the folder structure of the SDK and what files you need to include in project,and which ones to include in the file, it's a job that require 2 minutes of your time, unsure and it takes hours.

4. Not yet. Eventually it will be implemented, but for now, the ARM supported MCU's are : STM32F107,407 and NXP's MK64F.

5. Yes it is from FAT32 version 3.2.2.0
New version v3.2.0.0
- Added support for CEC Microchip (ARM)
- Added support for MSP Tiva (ARM)

r_y_
Posts: 2
Joined: 23 Apr 2019 20:44

Re: first impressions and questions

#3 Post by r_y_ » 24 Apr 2019 16:24

Hi Petar

Thank you for your answers.

I would like to add some more comments/questions:

1. Because TivaWare is official C-base? library from TI I expected full support one in mikroC. Almost everything compiled fine except just one line: static __attribute__((section("vtable"))) in interrupt.c file.
May be someone else make comments who met and solved same issue.

2. I did not run debug. I just run UART.
The code of the program is next:
#include <stdbool.h>
#include <stdint.h>

#include "inc/hw_gpio.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_types.h"
#include "inc/hw_comp.h"


#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/comp.h"
#include "driverlib/sysctl.h"


#define TERM_CHAR 0x0D


char uartBuffer[101];
char* pUartBuffer = &uartBuffer;

bool compReturn;
volatile unsigned int compChange = 0;


void mkcCC() iv IVT_INT_COMP0 ics ICS_OFF {
compChange++;
}


void main() {

// initialize UART
UART2_Init(115200);
Delay_ms(100);

UART2_Write_Text("Initialize UART2");
UART2_Write(TERM_CHAR);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); //enable portC
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOC))
{
}
SysCtlPeripheralEnable(SYSCTL_PERIPH_COMP0); //enable comparator (actually all comparators)
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_COMP0))
{
}

ComparatorRefSet(COMP_BASE, COMP_REF_1_65V); // set reference of the comparator
ComparatorConfigure(COMP_BASE, 0,(COMP_TRIG_NONE | COMP_INT_BOTH |COMP_ASRCP_REF | COMP_OUTPUT_NORMAL)); // configure comparator

Delay_ms(100);

EnableInterrupts(); // Enables the processor interrupt.
Delay_ms(100);
NVIC_IntEnable(IVT_INT_COMP0);
Delay_ms(100);

while (1)
{
compReturn = ComparatorValueGet(COMP_BASE, 0);
UART2_Write_Text("comparator output = ");
if (compReturn)
UART2_Write_Text("HIGH");
else
UART2_Write_Text("LOW");
UART2_Write(TERM_CHAR);


sprintf(pUartBuffer, "comparator change value = %d", compChange);
UART2_Write_Text(pUartBuffer);
UART2_Write(TERM_CHAR);
Delay_ms(1000);
}
}

When I toggle PC7 pin to Vcc/Gnd back and forth I see change of the comparator state but no increment of the compChange variable.

UART session:
Initialize UART2
comparator output = HIGH
comparator change value = 0
comparator output = HIGH
comparator change value = 0
comparator output = HIGH
comparator change value = 0
comparator output = HIGH
comparator change value = 0
comparator output = HIGH
comparator change value = 0
comparator output = LOW
comparator change value = 0
comparator output = LOW
comparator change value = 0
comparator output = LOW
comparator change value = 0
comparator output = HIGH
comparator change value = 0

3. Actually I prefer to have the way just include *.h files and the compiler/linker will do his work implicitly with dependency tree of the code in search path folders. However it looks like the mikroC supports another paradigm if I understood correctly.

4. Are any approximate dates when FreeRTOS could be released for TI microcontrollers?

5. It is great. Will try.

Thank you again

ry

Post Reply

Return to “ARM PRO Compilers”