Problems with bluetooth with HM-10 on KL03Z

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problems with bluetooth with HM-10 on KL03Z

1,244件の閲覧回数
vostropp
Contributor II

Hi all,

I am having trouble interfacing the HM-10 bluetooth module on my FRDM-KL03Z board.

It works wonderfully with my arduino uno using RX/TX, but I would like to send AT commands just using my KL03Z board, but not sure where to start?

I am using KSDK 1.1.

Thanks :smileyhappy:

ラベル(2)
6 返答(返信)

965件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi,

The most update ksdk is 2.3, you can download it from https://mcuxpresso.nxp.com/en/welcome.

There is plenty of UART demo in the package. The path is SDK_2.3_FRDM-KL03Z\boards\frdmkl03z\driver_examples\lpuart

Regards,

Jing

965件の閲覧回数
vostropp
Contributor II

Hi jingpan, I have got the ksdk 2.3 working, but my HM-10 is still not responding with this board. I am using the following code:

#include "board.h"
#include "fsl_lpuart.h"
#include "fsl_device_registers.h"
#include "fsl_debug_console.h"

#include "pin_mux.h"
#include "clock_config.h"
/*******************************************************************************
 * Definitions
 ******************************************************************************/
#define DEMO_LPUART LPUART0
#define DEMO_LPUART_CLKSRC SYS_CLK
#define DEMO_LPUART_CLK_FREQ CLOCK_GetFreq(SYS_CLK)


/*******************************************************************************
 * Variables
 ******************************************************************************/

uint8_t txbuff[] = "AT";
uint8_t rxbuff[100];

/*******************************************************************************
 * Code
 ******************************************************************************/

/*!
 * @brief Main function
 */
int main(void)
{
    lpuart_config_t config;

    
     
    BOARD_InitPins();
    BOARD_BootClockRUN();
    CLOCK_SetLpuart0Clock(0x1U);
     BOARD_InitDebugConsole();

     LPUART_GetDefaultConfig(&config);
    config.baudRate_Bps = 9600;
    config.enableTx = true;
    config.enableRx = true;
    

    LPUART_Init(DEMO_LPUART, &config, DEMO_LPUART_CLK_FREQ);

     
    LPUART_WriteBlocking(DEMO_LPUART, txbuff, sizeof(txbuff) - 1);
     LPUART_ReadBlocking(DEMO_LPUART, rxbuff, sizeof(rxbuff) - 1);
     PRINTF("Response:\n");
     PRINTF("%d\n", rxbuff);

}

But I am not getting any reply (even with "AT\r\n"), and any code after ReadBlocking does not read out.

Do I not also have to specify which pins I am using for RX/TX (PTB2/PTB1)? Not sure how to do that.

Thanks for any response, I am a complete newbie to this.

0 件の賞賛
返信

965件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi,

It seems the code is copy from demo code. It should be ok. So I think the problem is on hardware connect or  the detail of the communication protocol.

The pin config is in the BOARD_InitPins(). It use PB1 and PB2 as UART TX and RX.

regards,

Jing 

965件の閲覧回数
vostropp
Contributor II

Hi Jing,

I can see that the HM-10 is receiving the "AT" command by reading its output with an Arduino. 

The problem now is the LPUART_ReadBlocking command. It cannot read rx. Hmmm. Not sure why.

Thanks for your help again

0 件の賞賛
返信

965件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi,

Can you see the I2C waveform sending from KL03?

0 件の賞賛
返信

965件の閲覧回数
vostropp
Contributor II

I'm afraid I don't how to do that.  But anyway, my project had to be handed in today, so can't work on it anymore.

Though, if anybody has issues in the future, maybe they can continue this thread.

0 件の賞賛
返信