Search found 31 matches

by wwsheldons
Mon Jun 06, 2016 9:55 am
Forum: General Discussion and Questions
Topic: uncaught Timer
Replies: 4
Views: 4309

Re: uncaught Timer

dhylands wrote:You can get more detailed information on the exception by doing:

Code: Select all

import micropython
micropython.alloc_emergency_exception_buf(100)

what is 'heap is locked'?
by wwsheldons
Mon Jun 06, 2016 2:58 am
Forum: General Discussion and Questions
Topic: uncaught Timer
Replies: 4
Views: 4309

uncaught Timer

def rfid_tick(timer):
if rfid_port.any():
beep_on()
start_ns_delay()
def start_rfid_tick():
tim = pyb.Timer(4,freq=5)
tim.callback(rfid_tick)

uncaught exception in Timer(4) interrupt handler
MemoryError:
by wwsheldons
Mon Jun 06, 2016 2:28 am
Forum: General Discussion and Questions
Topic: Can I use the can.recv(0) in the rxcallback function?
Replies: 11
Views: 13722

Re: Can I use the can.recv(0) in the rxcallback function?

The reason is that you are allocating memory in the callback. tmp = bus.recv(self.fifo) The callback is executing in interrupt mode, and in that mode memory it is not allowed to allocate memory. There has been some discussions about how to solve this. One way is to add soft interrupts like in this ...
by wwsheldons
Sat Jun 04, 2016 3:30 am
Forum: General Discussion and Questions
Topic: about re module
Replies: 6
Views: 5426

Re: about re module

who can tell me why? Me. It is because your second regex tries to match '~0' at the beginning ('^') of the string, but the value of a doesn't match. If you want to match at the beginning of a line , you need the re.MULTILINE flag. Not sure if the micropython re module supports that. https://docs.py...
by wwsheldons
Fri Jun 03, 2016 5:36 pm
Forum: General Discussion and Questions
Topic: about re module
Replies: 6
Views: 5426

Re: about re module

re.match() is anchored to the start of the string. You have to use re.search(), if the pattern is in the middle of the string. And in re.search(), '^' and '$' mean the begin and end of the string, not special characters like \r or \n. the function match and search will get the same rezult. it can n...
by wwsheldons
Fri Jun 03, 2016 11:57 am
Forum: General Discussion and Questions
Topic: about re module
Replies: 6
Views: 5426

about re module

If I run the tmp=re.match('^abc(.*?)cde$','abc123213cde') tmp.group(1) it can print '123213'. but if I run the a=b'\r\nSEND OK\r\nAT+CIPSEND=125\r\n~011200g\x8a\xb0\xd3F\x0b\xc9\x88\x1e\x9d\xaf\x14\x9f\xfb\x9fR\xcb\xc5\xb4"\xf8>\xff\x0ftc t,\x18\xfa\xad\xf7!0V\xb6\xa6Y\xefH8\x0e\x17\xd4\xc8s\x0f\x04...
by wwsheldons
Thu May 26, 2016 6:58 am
Forum: General Discussion and Questions
Topic: Can I use the can.recv(0) in the rxcallback function?
Replies: 11
Views: 13722

Can I use the can.recv(0) in the rxcallback function?

when I use the can.recv(0) in the rxcallback function, it will point that ' uncaught exception in CAN(2) rx interrupt handler MemoryError:' . why? def rec0(self,bus, reason): print('rec0') if reason == 0: print('pending') #print(bus) #print(self.can) #help(bus) tmp = bus.recv(self.fifo) print(tmp[3]...
by wwsheldons
Tue May 17, 2016 8:35 am
Forum: General Discussion and Questions
Topic: OSError 16 about can bus communicate
Replies: 1
Views: 3462

OSError 16 about can bus communicate

when I run the order 'can.send('12345678',0x7ff)' in the commend window, the system return the error : OSError 16. what is it?
by wwsheldons
Sun Apr 17, 2016 2:51 am
Forum: General Discussion and Questions
Topic: uart problem
Replies: 8
Views: 5477

Re: uart problem

thank you very much! :geek: :geek:
by wwsheldons
Sun Apr 17, 2016 12:21 am
Forum: General Discussion and Questions
Topic: uart problem
Replies: 8
Views: 5477

Re: uart problem

dhylands wrote:You can also use select on the uarts.

thanks , and do you give me an example?