• 0

Question

Hi there,

I am trying to connect my Pro MX7 to my PC.

1.I like to program the board using MPLAB IDE.

2.I can see the ProMX7 is connecting to COM port 9.I am not able to see the board in the MPLAB IDE.(attacehd photo)

Thanks for the help

H

Capture.PNG

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Hi @Hendrik,

Do you have the usb cable connected to the debug connection and the board set to debug on J3? Also here is the Pro MX7 reference manual. Here is the resource page as well.

cheers,

Jon 

Edited by jpeyron

Share this post


Link to post
Share on other sites
  • 0

Very helpful...Thanks you ,I am trying to run my blinky LED now (blink led on pin 51(RD3) of the ProMX7.)...the program compile and load it seem to me I have something wrong with my SFR config.

See code below

Any quick tips?

#include <xc.h>          // Load the proper header for the processor

void delay(void);

int main(void) {
  //TRISD = 0xFFFC;        // Pins 0 and 1 of Port F are LED1 and LED2.  Clear   or =0b1111111111111100
  TRISD = 0xFFFB;                       //enable RD1 ,RD2 and RD3 to be output bins or using 0b1111111111111000
                         // bits 0 and 1 to zero, for output.  Others are inputs.
  LATDbits.LATD0 = 0;    // Turn LED1 on and LED2 off.  These pins sink current
  LATDbits.LATD3 = 1;    // on the NU32, so "high" (1) = "off" and "low" (0) = "on"

  while(1) {
    delay();
    LATDINV = 0x0003;    // toggle LED1 and LED2; same as LATFINV = 0x3;
  }
  return 0;
}

void delay(void) {
  int j;
  for (j = 0; j < 1000000; j++) { // number is 1 million
    while(!PORTDbits.RD7) {
        ;   // Pin D7 is the USER switch, low (FALSE) if pressed.
    }
  }
}

 

Share this post


Link to post
Share on other sites
  • 0

Hi @Hendrik,

I found some code that might be helpful here one in C and the other in assembly. I do not believe this is for the Pro MX7 so you will need to make sure you have the right registers.


#include <p32xxxx.h>
/ **
 * To blink a light bulb on the leg pic32 RD10 (chipKIT # 8).
 * /

/ **
 * Configure I / O pins and a timer.
 * /
Void setup () {
    // output mode for the foot RD10 - set the bit PORTD [10] to 0
    TRISDCLR = 1 << 10;

    // enable the timer
    T1CON = 0x8030;
}

/ **
 * Launch an endless loop with a flashing.
 * /
Void blink () {
    While (1) {
        // set the value - turn on the light bulb
        PORTDSET = 1 << 10;

        // wait
        TMR1 = 0;
        While (TMR1 <0xffff) {
        }

        // clear the value - turn off the light bulb
        PORTDCLR = 1 << 10;

        // wait
        TMR1 = 0;
        While (TMR1 <0xffff) {
        }
}
}

Void main () {
    Setup ();

    Blink ();
}
#include <p32xxxx.h>
################################################## ##################
# Light a light bulb on the RD10 leg (chipKIT # 8) by assembler
Main: .global main # Mark the label main as global

    # Set foot RD10 as output - set bit TRISD [10] to 0 - send 0x400 to TRISDCLR

    Li t1, 1 << 10
    La t2, TRISDCLR # 0xBF8860C4
    Sw t1, 0 (t2)
    
    # Set the value 1 on the foot RD10 - set the bit LATD [10] to 1 - send 0x400 to the LATDSET
    Li t1, 1 << 10
    La t2, LATDSET # 0xBF8860E8
    #la t2, LATDCLR # 0xBF8860E4
    Sw t1, 0 (t2)
cheers,

 

Jon

Share this post


Link to post
Share on other sites
  • 0

Thank you Jon...very helpful.

My objective is to communicate with the board using Matlab.My program was written in MPLAB and the board was programmed over the debug USB port.

Now I want Matlab to communicate with the board using the PIC32 UART3 how do I do this?Do I  need to move the cable back to the UART USB port?

By the way if the cable is connected to the debug USB port and I then  connect to the PC I don't see a COM port assignment.

If I use the UART USB port on the board  and then connect to the PC I see COM9.(Don't seem to be able to change any of he com parameters,why?)

Next,I am trying to figure out how to connect to the ProMX7 board from my Ubuntu virtual machine(guest OS).The Ubuntu is a virtual machine running on Virtual box on my host PC(Windows 10).

When I connect the board to my PC using the UART USB port(Promx7 board) I see the board at COM9.I then go into virtual box and set the serial port for Ubuntu to COM1 and the serial port for the host PC to COM9.(everything is enabled ). I then fire up Ubuntu and use the following command to check COM ports. $ dmesg |grep tty  but I don't see the board where do I go wrong?

Thanks again for the support.

H

 

 

 

Seem  to be tricky.

Thanks

Hendrik

Share this post


Link to post
Share on other sites
  • 0

Hi @Hendrik,

We do not have matlab. Unfortunately, I have no experience connecting a microcontroller to matlab. Hopefully one of the more experienced forum members might be able to give some input into this. Have you tried reaching out to microchip's forums as well hereThis thread should help with the set up of the serial terminal in ubuntu.  

thank you,

Jon

 

Share this post


Link to post
Share on other sites
  • 0

Hi Jon,

This does not have to be in Matlab.

The basic question is say I want my script to communicate with the ProMX7. UART3

To what physical port do I need to be connected, the port labeled UART or DEBUG?

(I did program the board over the DEBUG port using MPLAB)

How can I test comms between the PROMX7 and my PC when using MPLAB as the IDE.

 

 

Additional info below:
 

Programming with MPIDE:

The bootloader on the PIC32 installed  my PC see the board at COM9 this is great and is working fine.

Programming with MPLAB:

If I use the debug port (jumper is set for debug as well) I program the board no errors.When I run the 'mode' command at the cmd prompt in Windows10 I don't see a comport assigned.When I do the same step on the USB port I also see nothing.What is wrong do I need a special driver?

Thanks,

Hendrik

Share this post


Link to post
Share on other sites
  • 0

Hi @Hendrik,

Here is a link to some uart code for MPLAB and the Pro MX7. Here is a link to the learn website. I have not used this code but it might be helpful. Note that early versions of the Microchip PIC32MX5XX/6XX/7XX Family Data Sheet refer to UART1 as UART1A and UART2 as UART3A as discussed Here in the reference manual. So i believe you would be using uart2.  One option is once you have programmed the Pro MX7 you can change the power jumper and the usb  cable from debug to uart. The program should restart since it is in flash and the uart would be functional then. Another option is to use two different usb cables and another would be to externally power the Pro MX7 and change cables as needed.  Here is the resource page for the Basys MX3 that has a lot of mplabx documentation and coursework that was just recently released. This material should be very helpful as well as the code from github HereHere is the uart demo. You will need to change some pin assignment as well as some of the configuration to reflect the Pro MX7. If you opt to use the code form the learn site the first course work in the Basys MX3  has a link to get the plib.h library if you do not have it yet.

cheers,

 

Jon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now