Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 16:55 05 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMite MMBasic V5.07.02 betas

     Page 2 of 2    
Author Message
fred777
Regular Member

Joined: 01/07/2021
Location: United Kingdom
Posts: 57
Posted: 07:54pm 19 Dec 2021
Copy link to clipboard 
Print this post

Hello,
I've just hooked up the picomite's COM1 Port and get strange results.

This simple programme

' Print to COM1
SetPin GP0,GP1,COM1
Open "com1:9600" As #5
Bla:
Print #5,"Howdy ";
GoTo Bla


Produces this strange output:
ydydwoH y ydwoHoH ydwdwoH y ydwoH H ydwdwoH ydydwoH H ydwowoH ydydwoH H ydwoHoH ydwdwoH y ydwoHoH ydwdwoH y ydwoH H ydwowoH ydydwoH H ydwowoH ydwdwoH y ydwoHoH ydwdwoH y ydwoHoH ydwdwoH ydydwoH H ydwowoH ydydwoH H ydwoHoH ydwdwoH y ydwoHoH ydwdwoH y ydwoH H ydwowoH
and so on...

Other baudrates give strange results also, here is the output at 38400
HoHowdydy HoHowdydy HoHowdwdy H Howdwdy H Howdwdy H Howdwdy y Howowdy y Howowdy y Howowdy y HoHowdydy HoHowdydy HoHowdydy HoHowdydy H Howdwdy H Howdwdy H Howdwdy H Howowdy y Howowdy y Howowdydy


Tested with the Pico connected to a CP210x USB to UART Bridge+TeraTerm and MAX232+ Terminal

Hmmm, am I using the COM port wrong or is this a bug?
Using COM2 (SetPin GP4,GP5,COM2) seems to work fine


Cheers,
Fred
Edited 2021-12-20 06:08 by fred777
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 10:41pm 19 Dec 2021
Copy link to clipboard 
Print this post

  Quote  is it possible to switch the console from USB to a COM port so that a serial connection with a specified baudrate could be used as console?

Manual page 73

The other issue I'll test tomorrow
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1098
Posted: 10:48pm 19 Dec 2021
Copy link to clipboard 
Print this post

@fred777

In your loop
bla:
 print #5,"Howdy"
goto bla

you will be executing at around 20uSec per loop so you will be overflowing the Tx buffer many times. Unsure as to why it is different for COM1 versus COM2.
If you put a pause (just for testing) of, say 1 second (pause 1000) on a line after the  print statement, you should then see correct output.

Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1098
Posted: 01:36am 20 Dec 2021
Copy link to clipboard 
Print this post

@matherp

Peter,
In the section of Picomite source serial.c shown below (around line 310), should the highlighted line refer to com2Tx_buf ?


void SerialClose(int comnbr) {

if(comnbr == 1 && com1) {
uart_deinit(uart0);
com1 = false;
com1_interrupt = NULL;
if(UART0RXpin!=99)ExtCfg(UART0RXpin, EXT_NOT_CONFIG, 0);
if(UART0TXpin!=99)ExtCfg(UART0TXpin, EXT_NOT_CONFIG, 0);
if(com1Rx_buf!=NULL){FreeMemory(com1Rx_buf); com1Rx_buf=NULL;}
if(com1Tx_buf!=NULL){FreeMemory(com1Tx_buf); com1Tx_buf=NULL;}
}

else if(comnbr == 2 && com2) {
uart_deinit(uart1);
com2 = false;
com2_interrupt = NULL;
if(UART1RXpin!=99)ExtCfg(UART1RXpin, EXT_NOT_CONFIG, 0);
if(UART1TXpin!=99)ExtCfg(UART1TXpin, EXT_NOT_CONFIG, 0);
if(com2Rx_buf!=NULL){FreeMemory(com2Rx_buf); com2Rx_buf=NULL;}
***>>>> if(com1Tx_buf!=NULL){FreeMemory(com2Tx_buf); com2Tx_buf=NULL;}
}
}


Doug
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 08:00am 20 Dec 2021
Copy link to clipboard 
Print this post

Panky

Thanks - will fix

fredd777

As per the manual page 127 the print statement is supposed to block if the output buffer is full. There is a bug in the code for com1 which I will fix in the next beta. Thanks for the report.

HOWEVER: letting the output block is very bad as this will hold off any interrupts so as per the manual use LOF to check before issuing the PRINT command if the application demands it
Edited 2021-12-20 18:11 by matherp
 
fred777
Regular Member

Joined: 01/07/2021
Location: United Kingdom
Posts: 57
Posted: 09:39am 20 Dec 2021
Copy link to clipboard 
Print this post

  matherp said  Manual page 73

Sorry was using the V5.07.00 Manual, thanks!

But how does one set the Baudrate for the serial console?
I hope I haven't overlooked something in the manual again...
Edited 2021-12-20 19:49 by fred777
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 10:23am 20 Dec 2021
Copy link to clipboard 
Print this post

  Quote  But how does one set the Baudrate for the serial console?


At the moment it is fixed 115200. I'll make it changeable with OPTION BAUDRATE in the next beta
 
fred777
Regular Member

Joined: 01/07/2021
Location: United Kingdom
Posts: 57
Posted: 10:26am 20 Dec 2021
Copy link to clipboard 
Print this post

  matherp said  I'll make it changeable

You are the best!  
 
wolfme
Newbie

Joined: 26/10/2021
Location: Germany
Posts: 29
Posted: 07:17pm 20 Dec 2021
Copy link to clipboard 
Print this post

Hi,

is it possible to add include "file" from sd card (as in c) to PicoMite basic?

Wolfgang
 
TrevorC
Newbie

Joined: 15/07/2020
Location: United Kingdom
Posts: 14
Posted: 04:58pm 22 Dec 2021
Copy link to clipboard 
Print this post

Hi,

  I am having problem with I2C reads on the System bus. When reading a I2C sensor such as a SHT21 or DS1624 the picomite resets with the following message

Error: Invalid address - resetting

Sometimes I get an error message about the array I am storing the read data in.
There is not a problem if I run the program on I2C2 with the appropriate changes made to write and read on I2C2.

I came up with a short program to read from a DS3231 RTC which shows my problem.

' *** DS3231 RTC ***                                                            
Dim As Integer buffer(6)                                                        
'I2C Open 100,1000                                                              
RTC Gettime                                                                    
old_time$ = "12:34:56"                                                          
SetPin GP25,off                                                                
                                                                               
Do While key$ = ""                                                              
  key$ = Inkey$                                                                
  tm$ = Time$                                                                  
  If tm$ <> old_time$ Then                                                    
    ds3231                                                                    
    old_time$ = Time$                                                          
  EndIf                                                                        
Loop                                                                            
SetPin GP25, heartbeat                                                          
End                                                                            
                                                                               
Sub ds3231                                                                      
I2C Write &h68,1,1,0                                                            
I2C Read &H68,0,7,buffer()                                                      
Print Hex$(buffer(2),2);":";                                                    
Print Hex$(buffer(1),2);":";                                                    
Print Hex$(buffer(0),2)                                                        
End Sub                                                                        



Is anyone else having the same problem.

Thanks, Trevor
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 07:05pm 22 Dec 2021
Copy link to clipboard 
Print this post

Thanks for the report, definitely a bug and does happen on I2C2 as well. Can't find it at the moment but will keep looking. Remove the call the RTC GETTIME and it doesn't happen
 
TrevorC
Newbie

Joined: 15/07/2020
Location: United Kingdom
Posts: 14
Posted: 07:39pm 22 Dec 2021
Copy link to clipboard 
Print this post

Hi,
   Thanks for the reply. I have not found a problem with I2C2. I did not think to try removing the call to RTC GETTIME

   I came across this a few weeks ago when displaying I2C sensor data on LCDs and with OPTION AUTO RUN ON  the displays cleared at random times as the picomite reset itself and the program ran again.

   Will try reading the sensors with RTC GETTIME removed.

           Trevor
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 07:57pm 22 Dec 2021
Copy link to clipboard 
Print this post

Found it  

RTC GETTIME was leaving a pointer initialised that I2C READ assumed was set to NULL. Will be fixed in next beta
 
TrevorC
Newbie

Joined: 15/07/2020
Location: United Kingdom
Posts: 14
Posted: 08:27pm 22 Dec 2021
Copy link to clipboard 
Print this post

Thanks for sorting that out.
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024