Compatibility nxp K82, stm32.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Compatibility nxp K82, stm32.

2,098 次查看
mesdouaabderraz
Contributor III

hello,
On my project I must connect a fingerprint of crossematch, the TouchChip TCESC4K swipe module, with frdm-k82f nxp kit. to do a Fingerprint recognition,
But the sample code Supplied with the SDK of the fingerprint is specific to stm32, Usable on uVision 4, with a connection uart or spi.


Is there a way to use them on kinetis or mcuxpresso with the k82 ?.


I used the fingerprint reader as a slave in: sdk82\boards\frdmk82f\driver_examples\dspi\interrupt_transfer. but it does not work.
Also, I tried with :sdk82\boards\frdmk82f\driver_examples\lpuart\interrupt_transfer. without results.
The sample code to make grab with the fingerprint reader is attached.
If someone has something to suggest to me it will not be refused.


Best regards,

Original Attachment has been moved to: main.c.zip

Original Attachment has been moved to: description.txt.zip

5 回复数

1,522 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

As your description the TouchChip TCESC4K swipe module provides SPI/UART communication port for MCUs.

I would recommend customer to set up the communication via SPI/UART with TouchChip TCESC4K swipe module at first.

After the communication interface setup, customer need to write TouchChip TCESC4K swipe module related dirver to get data and handle with those data.

I think the STM32 project also includes TouchChip TCESC4K swipe module driver, customer just need porting the HAL level driver from STM32 to Kinetis K82 product.

Wish it helps.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,522 次查看
mesdouaabderraz
Contributor III

Hello Ma Hui,
Thank you for your reply, recently i received a mail from a croosmatch engineer, He said to me that it is necessary to change just a file in the sdk provided with the fingerprint With similar functions compatible with k82.

The code is as follows: 

* @file spi.c
* Low layer for a communication with TCD50 using a spi interface.
*
* Copyright (C) 2001-2011 AUTHENTEC, Inc.
*
*/

#include "stm32f10x_lib.h" // Definitions of the STM32 library
#include "configuration.h" // Definition of a platform
#include "spi.h" // Spi functions header
#include "tfmerror.h" // Error codes
#include "timer.h"
#include "defines.h"

#define DMA_CHANNEL_ENABLE 0x00000001
#define DMA_CHANNEL_DISABLE 0xFFFFFFFE


/* Function initializes an Spi layer.
*/
PT_STATUS SpiInitialize(void){

//set an SS (CS) pin to 0
GPIO_ResetBits(SPI_CS_SIGNAL_GPIO, SPI_CS_SIGNAL_PIN);

return PT_STATUS_OK;
}

/* Spi layer destructor.
*/
void SpiDestroy(void)
{

}

/** Function tests, if an AWAKE signal is low. If so, a device is considered to be awake.
* @return TRUE, if awake; FALSE otherwise.
**/
bool8 SpiIsAwake(void)
{
bool8 isWake = FALSE;

isWake = (GPIO_ReadInputDataBit(SPI_AWAKE_SIGNAL_GPIO, SPI_AWAKE_SIGNAL_PIN) == COMM_AWAKE_ACTIVE_STATE);
return isWake;
}

/** Function produces a short (approx. 3ms) impulse on a CS line causing a hardware wake up of a TCD device.
**/
void SpiWakeUp()
{
#if (COMM_AWAKE_ACTIVE_STATE == 0)
GPIO_SetBits(SPI_CS_SIGNAL_GPIO, SPI_CS_SIGNAL_PIN);
PT_TimerDelayMilliseconds (3);
GPIO_ResetBits(SPI_CS_SIGNAL_GPIO, SPI_CS_SIGNAL_PIN);
#else
GPIO_ResetBits(SPI_CS_SIGNAL_GPIO, SPI_CS_SIGNAL_PIN);
PT_TimerDelayMilliseconds (3);
GPIO_SetBits(SPI_CS_SIGNAL_GPIO, SPI_CS_SIGNAL_PIN);
#endif //#if (COMM_AWAKE_ACTIVE_STATE == 0)
}


/** Function sends a miniframe(9-bytes) over a spi bus. It set a CS signal to high, starts a clock, transmits a miniframe, stops a clock, and sets a CS signal to low.
* @param pSendBuffer Buffer containing miniframe data sent on a SPI bus (input, size of SPI_PACKET_SIZE).
* @param pReceiveBuffer Buffer, where data comming on a SPI bus are stored (output, size of SPI_PACKET_SIZE).
* @return PT_STATUS_OK.
**/
PT_STATUS SpiSendAndReceiveMiniframe(IN void *pSendBuffer, OUT void *pReceiveBuffer)
{
PT_STATUS status = PT_STATUS_OK;

//set an SS (CS) pin to COMM_AWAKE_ACTIVE_STATE
#if (COMM_AWAKE_ACTIVE_STATE == 0)
GPIO_SetBits(SPI_CS_SIGNAL_GPIO, SPI_CS_SIGNAL_PIN);
#else
GPIO_ResetBits(SPI_CS_SIGNAL_GPIO, SPI_CS_SIGNAL_PIN);
#endif //#if (COMM_AWAKE_ACTIVE_STATE == 0)


#if !defined(TCD50D_TCS1_TCS2)
//wait approx. 10us
PT_TimerDelayMicroseconds(10);
#endif //if !defined(TCD50D_TCS1_TCS2)

//start DMA transfer (Rx direction)
//set memory dst address
DMA1_Channel4->CMAR = (uint32)pReceiveBuffer;

//set buffer size
DMA1_Channel4->CNDTR = SPI_PACKET_SIZE;

//enable DMA1 channel4
DMA1_Channel4->CCR |= DMA_CHANNEL_ENABLE;

//start DMA transfer (Tx direction)
//set memory dst address
DMA1_Channel5->CMAR = (uint32)pSendBuffer;

//set buffer size
DMA1_Channel5->CNDTR = SPI_PACKET_SIZE;

//enable DMA1 channel4
DMA1_Channel5->CCR |= DMA_CHANNEL_ENABLE;

//wait till whole miniframe is received
while(DMA1_Channel4->CNDTR != 0)
{
;
}


// Reset a chip select signal
#if (COMM_AWAKE_ACTIVE_STATE == 0)
GPIO_ResetBits(SPI_CS_SIGNAL_GPIO, SPI_CS_SIGNAL_PIN);
#else
GPIO_SetBits(SPI_CS_SIGNAL_GPIO, SPI_CS_SIGNAL_PIN);
#endif //#if (COMM_AWAKE_ACTIVE_STATE == 0)

// Clear pending DMA RX transfer
DMA1_Channel4->CCR &= DMA_CHANNEL_DISABLE;

// Clear pending DMA TX transfer
DMA1_Channel5->CCR &= DMA_CHANNEL_DISABLE;

return status;
}

I try as well as I can to find the similar function for the k82, But without result until now.

So if you can suggest me some referenceon this topic to advance

thank you

0 项奖励
回复

1,522 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I checked the above code to detect SPI chip select status and using DMA to transfer/receive data via SPI interface.

The K82 product has SPI module, which also support TX/RX data via DAM module.

I would recommend customer to refer below threads about DSPI(SPI) module works with DMA module:

[Kinetis] DMA-SPI examples for L2K and K60 

https://community.nxp.com/docs/DOC-100304 

Wish it helps.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,522 次查看
mesdouaabderraz
Contributor III

Hello, bmwhui

thank you for your replay, but i can't access to the first link that you sent mepastedImage_1.png 

can you please Provide me another link,

Also, I have always the problem of connection SPI interface on my fingerprint tcesc4k, i can't  configure him as SPI bus slave (CPOL = 0, CPHA = 0).

because I do not find the equivalent of the following functions on the k82 :

  • GPIO_ResetBits
  • GPIO_ClearPinsInterruptFlags
  • GPIO_ReadInputDataBit
  • GPIO_SetBits
  • DMA1_Channel4 (Clear pending DMA RX transfer)
  • DMA1_Channel5 (Clear pending DMA TX transfer)

thank you,

Best regards 

0 项奖励
回复

1,522 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Please refer attached DSPI DMA example code .

About you mentioned functions on the K82 chip, I would recommend customer to refer Kinetis 100MHz bare-metal software or MCUXpresso SDK software for K82.

Using the MCUXpresso SDK provided module driver for K82 could be a good start.

Wish it helps.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------