Has anyone gotten the flexcan_uart demo to run on a TWR-K64F120m?
I have a FRDMK64F that I've successfully built the TWR demo for. I know the FRDM board doesn't have a CAN transceiver but I was at hoping to at least see some activity on the can0_tx pin.
Everything looks like it is working, but I don't see activity on PTB18. I tried modifying the configure_gpio_pins() function to configure pins 18 and 19 on portb to use their alt2 functionality but that didn't make any difference.
FLEXCAN_DRV_Send() times out waiting on the irqSync semaphore.
Solved! Go to Solution.
Ok. mine is sending something throughout the CAN0_TX.
I think your problem is that you don't have the RX line pulled up.
On the Flex uart demo code :
void configure_can_pins(uint32_t instance)
{
/* Affects PORTB_PCR19 register */
PORT_HAL_SetMuxMode(PORTB_BASE,19u,kPortMuxAlt2);
/* Affects PORTB_PCR18 register */
PORT_HAL_SetMuxMode(PORTB_BASE,18u,kPortMuxAlt2);
}
PTB 19 AND 18, so in the K64Fis on J1 header pins 1 and 3 according with the Quick Ref. Card.
Hope helps, I was lost too.
Take a look at pin_mux.c
the configurations are different
for FRDM the UART0 is used at PTB16 and PTB17
for TW the UART1 is used PTC3 and PTC4.
you will have to change the configuration in order to the sample work on FRDM.
Thanks, but it's not the UART that is the problem, that part is working fine. I can't seem to trigger any activity on the CAN side.
Ok. mine is sending something throughout the CAN0_TX.
I think your problem is that you don't have the RX line pulled up.
So I went back and looked at everything, and I had a copy/paste error. Where I thought I was enabling the pullup on PORTB pin 19, I was actually doing it to PORTA. As soon as I fixed that, I started seeing activity.
Thanks for your help!
I have the RX line internally pulled up. I also tried loopback mode. Obviously I wouldn't see anything on the pin, but I was hoping I might not get the same return failure from FLEXCAN_DRV_Send(), but I did.
Mine is working. when i try to transmit K i get an error. because anyone ack the data and i am able to view
at the oscilloscope data being transmitted.
what i have done was. delete all files in the board folder and substitute them for the files in a FRDM sample.
*********FlexCAN : SCI2CAN demo *********
Message format: Standard (11 bit id)
Message buffer 8 used for Rx.
Message buffer 9 used for Tx.
OSJTAG Port used for Serial Console.
Interrupt Mode: Enabled
Operation Mode: TX and RX --> Normal
*****************************************
Please select local node as A or B:
Node:AA
k
Transmit send configuration failed. result: 0x5
FlexCAN demo failed!!
I would like to know what 0x5 error means i have searched but in the doc. they only say 0 ok not 0 error.
I can tell you exactly what it means. FLEXCAN_DRV_Send() is waiting on a semaphore that is supposed to be released by a flexCAN interrupt. The wait on the semaphore times out, and the function returns kStatus_FLEXCAN_TimeOut(0x5).
So even though you are getting the same error, you see transmit activity on a scope?
Yes. at first i was not able to see anything at tx line. looking around i realized that my rx line was low. then as soon as i pulled it up. and sent a character through serial. i can see some data being sent at tx line. the data is periodic and have the same format I can't say if its right or not. I need to study more about can.
Ok thanks a lot! At least I know that the demo works on a TWR board so now it's just a matter of finding what's not configured right for the FRDM board.
Larry,
do you actually knows where the interrupt handles are?
Or how they are installed.
I have been searching throughout the code. but i was not able to find.
This KSDK is too much fragmented and docs don't help very much.
I'm mostly new to freescale and completely new to KSDK so I don't completely understand everything yet, but the interrupt handler and the interrupts are registered in
platform/can/drivers/fsl_flexcan_driver.c
I did some more debug and now i can track wich interrupt is being generated.
It happens in my case that as i am transmiting and noone ack the message an error interrupt is generated
reading the CAN0_ESR1 register i got 0x44042
ACKERR
Acknowledge Error
This bit indicates that an Acknowledge Error has been detected by the transmitter node, that is, a
dominant bit has not been detected during the ACK SLOT.
0 No such occurrence.
1 An ACK error occurred since last read of this register
And the same message is being retransmited forever.
looks like it is working. know i need another FRDM and a CAN driver to see if it is really working.
Yes. thats why sometimes it gets confuse.
the interrupt handle is ther at platform/can/drivers/fsl_flexcan_driver.c
but in my case platform\drivers\can\fsl_flexcan_irq.c where the interrupts should be defined are not active due to defines. so the compiler should not know where it is.
Here is what i see
Luiz,
I had already done that, as I mentioned in my original post.
Have you gotten the demo to run successfully?
Thanks,
Larry
Hello Larry,
You can refer to the <C:\Freescale\KSDK_1.0.0\doc\Kintes SDK Demo Applicaiion User's Guide> for "FlexCAN and UART communication Demo" .
Hope it helps
Alice
Hi Alice,
No, that document wasn't at all helpful.