UART on DsPic33FJ256MC710
UART on DsPic33FJ256MC710
Hello,
The Simulink design in attachment works with a DsPic33FJ256GP710 but doesn't work with a DsPic33FJ256MC710.
I tried at 9600 baud and 115200 baud.
Could you peek an eye please?
The Simulink design in attachment works with a DsPic33FJ256GP710 but doesn't work with a DsPic33FJ256MC710.
I tried at 9600 baud and 115200 baud.
Could you peek an eye please?
- Attachments
-
- Source_one_sinus_to_RS_9600_on_MC.mdl
- (25.96 KiB) Downloaded 1687 times
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: UART on DsPic33FJ256MC710
Hi Ender,
I did not see obvious error.
The model However, the model send only 100 bytes / seconds with your configuration (time step of the sinus block is 100Hz, time step for the model is 1KHz.
Do you have an electrical signal on the Tx pin of UART 2 ?
if yes, you should check your quartz configuration.
Otherwise, let me know.
I successfully tested the DsPic33FJ256MC710 at least on UART 1.
Lubin
I did not see obvious error.
The model However, the model send only 100 bytes / seconds with your configuration (time step of the sinus block is 100Hz, time step for the model is 1KHz.
Do you have an electrical signal on the Tx pin of UART 2 ?
if yes, you should check your quartz configuration.
Otherwise, let me know.
I successfully tested the DsPic33FJ256MC710 at least on UART 1.
Lubin
Re: UART on DsPic33FJ256MC710
Hi Lumbin, thank for this quick answer and sorry I didn't work this WE.
I know for the 100Hz and 1KHz, I tried with many speed and I sent you a version with the simulation/solver/fixed_step time constraint at 1Khz and a block with 100hz. But is there a link between the simulation time step and the Dspic compiler work ?
1__Regardless, the code doesn't work with a block at 1Khz too.
2__I use a Explorer 16 Board with a 40Mhz Oscillator, but I didn't change the capacitors close to the Oscillator (am I need to do?). If I use a C code in Mplab to send a ramp of values with your frame, the GUI display the signal. So I think the hardware configuration is fine.
3__I ever saw the same problem on a Dspic33FJ256GP on July, when I installed the licensed version of your blockset, I have changed the C compiler version for the 3.11 too. From that time I work with the 3.10b version. But the next week, I installed a new licensed version of MPLAB Dspic C compiler so Maybe there are compliance problems. I’am using:
Mathlab 2007b, Dspic Blockset2007B licenced and MPLAB_C_dsPICFullv3_10b Licenced: with these the model work at 1khz, 115200baud on a Dspic33FJ256GP710 but doesn’t on Dspic33FJ256MC710.
I’ll change of version and will see.
I know for the 100Hz and 1KHz, I tried with many speed and I sent you a version with the simulation/solver/fixed_step time constraint at 1Khz and a block with 100hz. But is there a link between the simulation time step and the Dspic compiler work ?
1__Regardless, the code doesn't work with a block at 1Khz too.
2__I use a Explorer 16 Board with a 40Mhz Oscillator, but I didn't change the capacitors close to the Oscillator (am I need to do?). If I use a C code in Mplab to send a ramp of values with your frame, the GUI display the signal. So I think the hardware configuration is fine.
3__I ever saw the same problem on a Dspic33FJ256GP on July, when I installed the licensed version of your blockset, I have changed the C compiler version for the 3.11 too. From that time I work with the 3.10b version. But the next week, I installed a new licensed version of MPLAB Dspic C compiler so Maybe there are compliance problems. I’am using:
Mathlab 2007b, Dspic Blockset2007B licenced and MPLAB_C_dsPICFullv3_10b Licenced: with these the model work at 1khz, 115200baud on a Dspic33FJ256GP710 but doesn’t on Dspic33FJ256MC710.
I’ll change of version and will see.
Re: UART on DsPic33FJ256MC710
With Mathlab 2007b, Dspic Blockset2007B licensed and MPLAB_C_3.11 student, the model 1khz_115200 baud:
1___ doesn't work on Dspic33FJ256MC710.
2___ And it doesn’t work with a Dspic33FJ256GP710 too of course I changed the target in Master and I compiled the code every time.
3___The Rs232gui receipt few octets but the graph doesn't display. On the pin 2 of RS232 the signal exists and seems good. With my own Labview RS232 interface, Labview shows a framing error.
1___ doesn't work on Dspic33FJ256MC710.
2___ And it doesn’t work with a Dspic33FJ256GP710 too of course I changed the target in Master and I compiled the code every time.
3___The Rs232gui receipt few octets but the graph doesn't display. On the pin 2 of RS232 the signal exists and seems good. With my own Labview RS232 interface, Labview shows a framing error.
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: UART on DsPic33FJ256MC710
Hi Ender,
I tested the dsPIC_33f_Explorer16.mdl demo (in the demo directory of the blockset) with the explorer16 board equipped with the 33f256GP710 and the original 8Mhz quartz.
It works successfully (Matlab 2008a, gcc version 4.0.3 (dsPIC30, Microchip v3_11) Build date: Jul 16 2008 student version because my license is out of date)
Could you check that the dsPIC is working at a proper frequency (have an I/O blinking and check its frequency, or use a LED at 1Hz for example)
If there is a bug, It may be at the configuration of the UART (but as I tested, I do not think so), or it may be a problem dealing with the clock/timer of the dsPIC.
Lubin
I tested the dsPIC_33f_Explorer16.mdl demo (in the demo directory of the blockset) with the explorer16 board equipped with the 33f256GP710 and the original 8Mhz quartz.
It works successfully (Matlab 2008a, gcc version 4.0.3 (dsPIC30, Microchip v3_11) Build date: Jul 16 2008 student version because my license is out of date)
Could you check that the dsPIC is working at a proper frequency (have an I/O blinking and check its frequency, or use a LED at 1Hz for example)
If there is a bug, It may be at the configuration of the UART (but as I tested, I do not think so), or it may be a problem dealing with the clock/timer of the dsPIC.
Lubin
Re: UART on DsPic33FJ256MC710
I checked your idea the led blink at 1.5s = 0.66Hz instead of 1s.
The width of the start bit on the COM is 25µS and the frame is just litle bit more than 700µs at 115200baud
The widths between to dot are 2.74 ms instead of 1ms.
The width of the start bit on the COM is 25µS and the frame is just litle bit more than 700µs at 115200baud
The widths between to dot are 2.74 ms instead of 1ms.
Re: UART on DsPic33FJ256MC710
Could you build and send to me an .Hex file for 115200baud and an 40Mhz oscillator, please ?
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: UART on DsPic33FJ256MC710
If led blink at 1.5s, widths between dots should be 1.5m instead of 2.74ms ?
Either there is a bug in the code generated by the blockset.
Neither the quartz is not at 40Mhz but oscillate at 26.6Mhz. You could try to declare the quartz as a 26.6Mhz quartz in the Master block...
Attached are the two requested .hex file
Either there is a bug in the code generated by the blockset.
Neither the quartz is not at 40Mhz but oscillate at 26.6Mhz. You could try to declare the quartz as a 26.6Mhz quartz in the Master block...
Attached are the two requested .hex file
- Attachments
-
- dsPIC33f_Explorer16_MC_GP710.zip
- (8.54 KiB) Downloaded 1676 times
Re: UART on DsPic33FJ256MC710
I tried with my C code on MPLAB for 115200baud the start width is 8.5µs and the Gui receipt the dots.
Re: UART on DsPic33FJ256MC710
I declared the quartz as a 26.6Mhz :
Led blink 950mS and Start bit width 15µS ?
Led blink 950mS and Start bit width 15µS ?
Re: UART on DsPic33FJ256MC710
Thanks for the .Hex file.
Same result that me with your dsPIC_33f_Explorer16_GP710.hex file.
The start bit is 23µS width, instead 8.5µS, so it's also doesn't work in Rs232Gui
Same result that me with your dsPIC_33f_Explorer16_GP710.hex file.
The start bit is 23µS width, instead 8.5µS, so it's also doesn't work in Rs232Gui
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: UART on DsPic33FJ256MC710
Hi,
The problem described is weird!
It is still not clear where it comes from :
- Either there is a bug in the blockset, like an overflow that occurs when using high frequency quartz like 40Mhz quartz
- Neither there is a hardware problem on your system.
As no PLL are used, a 40Mhz quartz gives a 20MIPS system, it is quite straight ! The time step should be fine and the blinking led should blink at the required frequency! You could also do a test with the busy flag port in the MASTER block and check the time step with a scope.
Could you compare the code you write with the code generated by the blockset ? (use the simulink report : Simulation ==> Configuration Parameters ==> Real Time workshop ==> HTML report)
The only part to compare is within the main file: timers and UART configuration...
Or send me your "MPLAB" working code that works with your hardware I will have a look.
Lubin
The problem described is weird!
It is still not clear where it comes from :
- Either there is a bug in the blockset, like an overflow that occurs when using high frequency quartz like 40Mhz quartz
- Neither there is a hardware problem on your system.
As no PLL are used, a 40Mhz quartz gives a 20MIPS system, it is quite straight ! The time step should be fine and the blinking led should blink at the required frequency! You could also do a test with the busy flag port in the MASTER block and check the time step with a scope.
In other word, the hardware is Ok!Ender wrote:If I use a C code in Mplab to send a ramp of values with your frame, the GUI display the signal. So I think the hardware configuration is fine.
Could you compare the code you write with the code generated by the blockset ? (use the simulink report : Simulation ==> Configuration Parameters ==> Real Time workshop ==> HTML report)
The only part to compare is within the main file: timers and UART configuration...
Or send me your "MPLAB" working code that works with your hardware I will have a look.
Lubin
Re: UART on DsPic33FJ256MC710
You right Lumbin, I used a example code from Microship which used the PLL.
There is a hardware problem on the oscillator, some time and more when I use the oscilloscope probe the frequency is correct.
I'll replace the capacitors by the new ones to be sure of their values and remove/re-solder the quartz.
If I reuse the original 8Mhz quartz, how the blockset will work if the loop time execution is too long to match with the transfer rate request?
In this case do you use the PLL to increase FCy, the instruction cycle clock, at more than 8Mhz ?
Thanks a lot.
There is a hardware problem on the oscillator, some time and more when I use the oscilloscope probe the frequency is correct.
I'll replace the capacitors by the new ones to be sure of their values and remove/re-solder the quartz.
If I reuse the original 8Mhz quartz, how the blockset will work if the loop time execution is too long to match with the transfer rate request?
In this case do you use the PLL to increase FCy, the instruction cycle clock, at more than 8Mhz ?
Thanks a lot.
Re: UART on DsPic33FJ256MC710
Okay, I found the answer myself in master block description.
http://www.kerhuel.eu/RTWdsPIC/Blocks/Master.html
http://www.kerhuel.eu/RTWdsPIC/Blocks/Master.html
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: UART on DsPic33FJ256MC710
Hi Ender,
To complete the topic :
Lubin
To complete the topic :
Execution continues (i.e. not like the xPC target system behaviour where the execution hang up)Ender wrote:how the blockset will work if the loop time execution is too long to match with the transfer rate request?
This is how it works!Ender wrote:In this case do you use the PLL to increase FCy, the instruction cycle clock, at more than 8Mhz ?
This is the old page and will not be updated anymore. Please use this on : http://www.kerhuel.eu/wiki/Block/MasterEnder wrote:Okay, I found the answer myself in master block description.
http://www.kerhuel.eu/RTWdsPIC/Blocks/Master.html
Lubin
Who is online
Users browsing this forum: No registered users and 11 guests