FRDM-KL46Z serial_LDD problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM-KL46Z serial_LDD problem

Jump to solution
1,974 Views
r58737
NXP Employee
NXP Employee


Hello ,

I just get my first Kinetis and I'm trying to initiate serial communication with a Real term.

I start a new project with Processor expert and select the UART0 as a serial_LDD components and  I set all the parameters ( Pin affectation, baud rate , interrupt disabled for polling and automatic code generation).

Then I generate the code and modify the main code with the components example , here below  the code associated  :

With this code I cannot get any communication with my real term and the AS2 seems to return a ERR_BSUY.

Could you explain me what I'm doing wrong and How could I get communication running between my real term and the Kinetis micro.

Thanks for your help

Rgds

Philippe

KL46Z_bis.png



0 Kudos
1 Solution
1,132 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Philippe Calmettes,

    As you said, I use the PE make a project.Select the UART0 as a serial_LDD components to communicate with the serial terminal, the baud rate is 9600bps.

   The function is when receive"e",then send "Hello world\n", and brink the red led on the KL46 board.

   I already test it, and the result is correct!

   The attachment is my project, for your reference!

   I wish it helps you!

Best regards!

Jing

View solution in original post

0 Kudos
10 Replies
1,133 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Philippe Calmettes,

    As you said, I use the PE make a project.Select the UART0 as a serial_LDD components to communicate with the serial terminal, the baud rate is 9600bps.

   The function is when receive"e",then send "Hello world\n", and brink the red led on the KL46 board.

   I already test it, and the result is correct!

   The attachment is my project, for your reference!

   I wish it helps you!

Best regards!

Jing

0 Kudos
1,132 Views
r58737
NXP Employee
NXP Employee

Hello Jing,

Thanks for the support.

I have tried your example and it works .

Best Regards

Philippe

0 Kudos
1,131 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Philippe,

    You are welcome!

Best regards!

Jing

0 Kudos
1,132 Views
russellsher
Contributor III

Hi Jing thank-you for your help - I have also tried your helpful code.

Can I ask you please:

If I send:  error = AS1_SendBlock(MySerialPtr, OutData, sizeof(OutData)); /* Send block of characters */

It prints the "Hello world" correctly

If I want to send another Hello World straight after this, I can't just send another AS1_Sendblock...

(It only shows the first one) -- must I wait for completion using AS1_OnBlockSent(LDD_TUserData *UserDataPtr);

I'm not quite sure to use it.

regards

Russell

0 Kudos
1,131 Views
BlackNight
NXP Employee
NXP Employee

Hi Russel,

enable interrupts and buffers in the component:

pastedImage_0.png

That way you can send a block up to the buffer size.

otherwise check the return code/value of SendBlock(): if not ERR_OK, then you would need to resend it because buffers were full.

Or check the number of characters in the Tx buffer first with GetCharsInTxBuf().

Erich

0 Kudos
1,132 Views
russellsher
Contributor III

Thanks Erich

0 Kudos
1,132 Views
russellsher
Contributor III

Hi Erich

(I'm finally back after being away)  I tried your suggestion to enable the interrupts -- forgive my ignorance, but I can't see the Output buffer size option after selecting enable :

What have I forgotten?

pastedImage_1.png

When I enable interrupts and compile, I get this: (no doubt due the incorrect configuration in my uart):

pastedImage_3.png

can you advise please? - thanks as always

Russell

0 Kudos
1,132 Views
BlackNight
NXP Employee
NXP Employee

Hi Russel,

have you generated code? That AS1_Main is used only if you are in polling mode.

The buffer size should show up. Are you already in Advanced/Expert mode?

Erich

0 Kudos
1,132 Views
russellsher
Contributor III

Ok - so I hadn't generated code (somehow thought that building would take care of this at build/compile time)

Now that explains why I got the error but I'm still not seeing the input buffer size: Am I using the wrong uart component:

pastedImage_0.png

components window shows:

pastedImage_0.png

0 Kudos
1,132 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Philippe Calmettes,

      Could you upload your project? I would like to help you to test it!

     And I want to know what the real term is ? I think you can communicate with the serial terminal at first.

Best regards!

Jing

0 Kudos