Announcements

Robots are revolutionizing our lives in many ways. Join our webinar to learn about Infineon’s broad portfolio of robot building blocks.
Click here to register.

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

XMC™ Forum Discussions

HDTiwari
Level 1
Level 1
5 replies posted 10 sign-ins 5 sign-ins

Respected fellow designers,

I am trying to interface HC-05 bluetooth module with XMC4700 relax kit.

I have the TX and RX running in arduino IDE without any issues.

However, I wish to replicate the same using Modus tool box.

I am able to transmit through the HC-05 module and see the output in my mobile.

However, I am unable to get the receiver working.

I have tried using RX FIFO but could not get any output.

I have shared my project.

Kindly suggest  some method to get  TX and RX working through modus toolbox.

Thank you

0 Likes
11 Replies
ppn
Moderator
Moderator
Moderator
First solution authored First like received 5 replies posted

Hi @HDTiwari ,

Just to confirm whether you made the  connection properly as for the first communication between the pc and XMC you are using USIC0_CH0 where there is already an USB-UART bridge so no necessity of external wire connection but for the communication between the XMC and the HC-05 you are using the USIC1_CH0 where port  2_14 and 2_15 are TXD and RXD there needs to be an jumper wire connections from 2_14 to HC-05 and HC-05 to 2_15.

Coming to code(main.c) there needs to change in the enabling of interrupts as you have Intialised USIC1_CH0 but enabling USIC1_CH1 interrupts. So look into the interrupt part and enable the system timer for communication.

Best Regards

Pradeep

0 Likes
HDTiwari
Level 1
Level 1
5 replies posted 10 sign-ins 5 sign-ins

Respected PPN,

Thanks for the quick and prompt reply.

As you mentioned correctly, in the code I am using both USIC0_CH0 (DEBUG) as well as USIC1_CH0 for HC05. I have cross checked the connection by using a basic uart TX RX code using XMC4700 relax kit and HC05 using Arduino ide. The trick was to initialize Serial as Serial1 and everything happened automatically. For reference I have attached the Aurdino sketch and the communication screenshot.

This code will eventually become a part of state machine where the uart will be polled at certain instances only. Hence repetitive tx and thereby using timer would be futile.

I have corrected the initialization of "USIC1_CH0" and I have uploaded my project again. Kindly help by going through it. I am still not able to get the communication working.

"So look into the interrupt part and enable the system timer for communication." - Kindly suggest the link to material for XMC4700 regarding the same.

On a side note: Which tool chain will be preferred by Infineon in future DAVE or Modus Toolbox.

Thank you for the reply once again.

With regards

 

0 Likes
ppn
Moderator
Moderator
Moderator
First solution authored First like received 5 replies posted

Hi @HDTiwari ,

We support  Modus Toolbox in future so we recommend you to use Modus Toolbox.

Regarding the establishment of communication between the XMC and the HC-05 below are some code examples which you can refer.

Please refer to this link

https://github.com/Infineon/mtb-example-xmc-uart-transmit-receive-fifo-interrupts

https://github.com/Infineon/mtb-example-xmc-uart-transmit

Best Regards 

Pradeep.

 

 

 

0 Likes
HDTiwari
Level 1
Level 1
5 replies posted 10 sign-ins 5 sign-ins

Respected ppn,

I have already tried using "https://github.com/Infineon/mtb-example-xmc-uart-transmit-receive-fifo-interrupts".

As explained if we connect pin6.3 and 6.4 in relax kit the LED turns on. 

However, if I connect 6.3 RXD with TXD of HC05 and 6.4 TXD with RXD of  HC05, I do not see any output in connected mobile app.

The second example "https://github.com/Infineon/mtb-example-xmc-uart-transmit" is just TX and no RX.

I will try re-assigning the pins to 2.15 and 2.14 in relax kit and try to get response.

I however humbly request the team to provide examples such that the arduino pins can be used in modus toolbox especially with basic arduino applications like uart.

Thank you,

with regards

0 Likes
ppn
Moderator
Moderator
Moderator
First solution authored First like received 5 replies posted

Hi
The above code example is based on loop back mode for loop backing data that was received from the transmitter to the transmitter side we are doing this by hardwire connnection between the pin 6.3 ad pin 6.4.
As you are using pin 6.3 and pin 6.4 you need to update the device configurator where you need to assign pin 6.3 to RXD and pin 6.4 to TXD at the USIC configuration,even after the upgrading the device configurator
there is problem in establishing the communication once you need to check at the HC05 end.
Regarding the code example about the arduino pins can be used in modus toolbox at present we don't have and we are considering your suggestion.
Thanks and Regards
Pradeep.

0 Likes
HDTiwari
Level 1
Level 1
5 replies posted 10 sign-ins 5 sign-ins

Respected ppn,

I think we are one step closer to the target.

I used the https://github.com/Infineon/mtb-example-xmc-uart-transmit-receive-fifo-interrupts example.
In the example sited above USIC0 is used and is connected to pins 6.4 and 6.4. I configured USIC1 identical to USIC0 re-assigning the pins to 2.15 and 2.14 in relax kit, checked the loopback. It worked fine.

Then I connected the HC05 to Pins 2.15 and 2.14. Initially there was no response. 

In the sample code the data is sent and received only once.

Hence, I tried to clear the data and send custom data in while loop.

Now I was able to see the output in in mobile app through HC05.

However, the first character of data was not received completely and with every transmit same text is repeated. Kindly see the image attached.

Similarly, there is still no RX.

Using the https://github.com/Infineon/mtb-example-xmc-uart-transmit exampleI tried checking the read operation using of debug port so that later I can change the pins to 2.15 and 2.14.

I saw the solution provided in https://community.infineon.com/t5/XMC/XMC1302-T038X0032-UART-can-send-data-but-cannot-receive-data/t... however it is not working for me. I am attaching both the projects. Kindly have a look and suggest. If the rx can be made to work using debug pins in second project that is based on transmit example, I will make the modification to try with another channel for Arduino compatible pins 2.14 and 2.15. 

Kindly help.

With regards

0 Likes
ppn
Moderator
Moderator
Moderator
First solution authored First like received 5 replies posted

Hi @HDTiwari ,

I went through you code and found that you haven't declared any USIC channel for 'usr_uart_hc05_HW' in the device configurator.
So declare the 'usr_uart_hc05_HW' in the device configurator (ie name the USIC channel you are using to communicate between XMC and HC05 as 'usr_uart_hc05')and then try building it. 

Best Regards
Pradeep.

0 Likes
HDTiwari
Level 1
Level 1
5 replies posted 10 sign-ins 5 sign-ins

Respected ppn,

The RX fifo project has the USIC0_CH1 declared as "usr_uart_hc05" in device configurator. While "UART_Transmit_v01" project does not use usr_uart_hc05 declaration. Kindly let me know which project are you referring to.

As mentioned earlier Using the https://github.com/Infineon/mtb-example-xmc-uart-transmit example I tried checking the read operation using debug port so that later I can change the pins to 2.15 and 2.14.

I saw the solution provided in https://community.infineon.com/t5/XMC/XMC1302-T038X0032-UART-can-send-data-but-cannot-receive-data/t... however it is not working for me. I had attached the project earlier. Kindly have a look and suggest. If the rx can be made to work using debug pins in second project that is based on transmit example, I will make the modification to try with another channel for Arduino compatible pins 2.14 and 2.15. 

Kindly help.

With regards

0 Likes
ppn
Moderator
Moderator
Moderator
First solution authored First like received 5 replies posted

Hi @HDTiwari ,

The project you shared UART_Transmit_Receive_FIFO_Interrupts_v02 ,I imported the project into my MTB and found you haven't declared    USIC0_CH1 so can you share your correct project once again.

Best Regards,
Pradeep.

0 Likes
HDTiwari
Level 1
Level 1
5 replies posted 10 sign-ins 5 sign-ins

Respected ppn,

kindly find the zip file of the project.

Kindly let  me know if there is some specific way to zip the files.

I am straight away making the zip file of the project folder.

Thank you for quick and prompt response.

I really appreciate it

0 Likes
HDTiwari
Level 1
Level 1
5 replies posted 10 sign-ins 5 sign-ins

Respected Pradeep Sir,

Thank you for quick reply.

I have created a new workspace. I recreated the entire project. I have compiled and programmed the XMC4700 with it.

In the example sited above USIC0 is used and is connected to pins 6.4 and 6.4. I configured USIC1 identical to USIC0 re-assigning the pins to 2.15 and 2.14 in relax kit, checked the loopback. It worked fine.

Then I connected the HC05 to Pins 2.15 and 2.14. Initially there was no response. 

In the sample code the data is sent and received only once.

Hence, I tried to clear the data and send custom data in while loop.

Now I was able to see the output in in mobile app through HC05.

However, the first character of data was not received completely and with every transmit same text is repeated. Kindly see the image attached.

Similarly, there is still no RX.

Today I have shared the entire workspace.

Kindly let me know if this is ok.

Thank you once again for the quick response.

With regards

0 Likes
This widget could not be displayed.