Header and C files compatibility Errors

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
sualc_2707881
Level 1
Level 1
First like given

Hello,

I need to fix these code errors in this project. Whenever I fix an error, others come up! Please see the attached project.

I am trying to prepare a project to run the Fingerprint Scanner GT-521F32 on CY8CKIT-042 Pioneer Kit.

Thanks,

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

You are just importing programs written for ATMEGA2560 into a project for PSoC4.

So what you need is learn the way how a project for PSoC 4 should be organized and written.

Unless you are planning to pay someone else to write a program for you,

I strongly recommend you to at least watch following video tutorials, it will save you a lot of time later.

http://www.cypress.com/training/psoc-101-video-tutorial-series-how-use-arm-cortex-m0-based-psoc-4

Having written that, as far as I tried with following modification(s),

I could manage to compile your project.

Note: for debug print I added "UART" and to connect with FPS

I added "GT511C3" in the schematic and pins.

=========================

[Project]

=====================

remove following files from the project

avrCommon.h

pins.h

usart.h

pins.c

usart.c

====================

[FPS.h]

comment or remove

#include "usart.h"

#include "pins.h"

add

#include "project.h"

[TopDesign.cysch]

add

UART(SCB mode) as UART 115200 baud (for debug printf)

UART(SCB mode) as GT511C3 9600 baud (for connecting with GT511C3)

[Pins]

FPS_rx: P4[0]

FPS_tx: P4[1]

UART_rx: P0[4]

UART_tx: P0[5]

in AB_STEM_init_FPS()

comment/remove

setDirection(AB_P0,AB_INPUT);

setDirection(AB_P1,AB_OUTPUT);

usartInit(AB_USART_2, AB_B_9600, AB_NONE, AB_ONE_BIT, AB_EIGHT_BIT,AB_USART_INTERRUPT_DISABLE);

add

GT511C3_Start() ;

in SendCommand

comment/remove

sendUData(AB_USART_2,sendbuf,12);

add

GT511C3_SpiUartPutArray(sendbuf, 12);

in RecvResponse

comment/remove

while((UCSR2A & (1<<RXC2)) == 0);  // wait while data is being received

buf = UDR2;

add

while(GT511C3_SpiUartGetRxBufferSize() == 0) ;

buf = GT511C3_SpiUartReadRxData() ;

in RecvData

comment/remove

while((UCSR2A & (1<<RXC2)) == 0); // wait while data is being received

*(data + i) = UDR2;

add

while(GT511C3_SpiUartGetRxBufferSize() == 0u) ; // wait while data is being received

*(data + i) = GT511C3_SpiUartReadRxData() ;

in ClearLine

comment/remove

while((UCSR2A) & (1<<RXC2)); // wait while data is being received

{

    UDR2;

}

add

while (GT511C3_SpiUartGetRxBufferSize())

{

    GT511C3_SpiUartReadRxData();

}

comment/remove whole "int main()"

[main.c]

after #include "project.h"

add

#include <stdio.h>

#include "FPS.h"

in main()

add where /* Place your initialization ... */

UART_Start() ;

port other staff in the main() in FPS.c

refer to the attached project

=========================

At least the project is "compile-able", but as I don't have GT511C3 module

I can not confirm if it works or not.

moto

View solution in original post

0 Likes
3 Replies
Vison_Zhang
Moderator
Moderator
Moderator
First comment on KBA 750 replies posted 250 sign-ins

PSoC4 is much easier to use with excellent IDE PSoC Creator, but transplant is  also needed, you cannot import a AVR Mega128 based project into Creator directly without changing any source code

0 Likes

So now what to do to get these libraries work? Can anyone fix these errors?

0 Likes
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

You are just importing programs written for ATMEGA2560 into a project for PSoC4.

So what you need is learn the way how a project for PSoC 4 should be organized and written.

Unless you are planning to pay someone else to write a program for you,

I strongly recommend you to at least watch following video tutorials, it will save you a lot of time later.

http://www.cypress.com/training/psoc-101-video-tutorial-series-how-use-arm-cortex-m0-based-psoc-4

Having written that, as far as I tried with following modification(s),

I could manage to compile your project.

Note: for debug print I added "UART" and to connect with FPS

I added "GT511C3" in the schematic and pins.

=========================

[Project]

=====================

remove following files from the project

avrCommon.h

pins.h

usart.h

pins.c

usart.c

====================

[FPS.h]

comment or remove

#include "usart.h"

#include "pins.h"

add

#include "project.h"

[TopDesign.cysch]

add

UART(SCB mode) as UART 115200 baud (for debug printf)

UART(SCB mode) as GT511C3 9600 baud (for connecting with GT511C3)

[Pins]

FPS_rx: P4[0]

FPS_tx: P4[1]

UART_rx: P0[4]

UART_tx: P0[5]

in AB_STEM_init_FPS()

comment/remove

setDirection(AB_P0,AB_INPUT);

setDirection(AB_P1,AB_OUTPUT);

usartInit(AB_USART_2, AB_B_9600, AB_NONE, AB_ONE_BIT, AB_EIGHT_BIT,AB_USART_INTERRUPT_DISABLE);

add

GT511C3_Start() ;

in SendCommand

comment/remove

sendUData(AB_USART_2,sendbuf,12);

add

GT511C3_SpiUartPutArray(sendbuf, 12);

in RecvResponse

comment/remove

while((UCSR2A & (1<<RXC2)) == 0);  // wait while data is being received

buf = UDR2;

add

while(GT511C3_SpiUartGetRxBufferSize() == 0) ;

buf = GT511C3_SpiUartReadRxData() ;

in RecvData

comment/remove

while((UCSR2A & (1<<RXC2)) == 0); // wait while data is being received

*(data + i) = UDR2;

add

while(GT511C3_SpiUartGetRxBufferSize() == 0u) ; // wait while data is being received

*(data + i) = GT511C3_SpiUartReadRxData() ;

in ClearLine

comment/remove

while((UCSR2A) & (1<<RXC2)); // wait while data is being received

{

    UDR2;

}

add

while (GT511C3_SpiUartGetRxBufferSize())

{

    GT511C3_SpiUartReadRxData();

}

comment/remove whole "int main()"

[main.c]

after #include "project.h"

add

#include <stdio.h>

#include "FPS.h"

in main()

add where /* Place your initialization ... */

UART_Start() ;

port other staff in the main() in FPS.c

refer to the attached project

=========================

At least the project is "compile-able", but as I don't have GT511C3 module

I can not confirm if it works or not.

moto

0 Likes