Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
A
ast2050-flashrom
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • Raptor Engineering Public Development
  • ast2050-flashrom
  • Issues
  • #3

Closed
Open
Opened Apr 27, 2020 by Ali Mashtizadeh@mashtizadeh
  • Report abuse
  • New issue
Report abuse New issue

Flashrom negotiation issue with Blackbird II from FreeBSD

It seems that I consistently (100%) of the time receive a null byte before I receive "\r\n\r\n$ " twice.

Snippet from ast2400.c:
494 >------->-------// Detect baud rate
495 >------->-------sp_flush_incoming();
496 >------->-------ast2400_serialport_write("\r\n", 2);
497 >------->-------programmer_delay(500);
498 >------->-------sp_flush_incoming();
499 >------->-------ast2400_serialport_write("\r\n", 2);
500 >------->-------unsigned char read_buffer[48];
501 >------->-------memset(read_buffer, 0, sizeof read_buffer);
502 >------->-------if (!serialport_read_nonblock(read_buffer, 2 + 3, 2000, NULL)) {
503 >------->------->-------if (read_buffer[(2 + 3) - 1] == '$') {
504 >------->------->------->-------msg_pinfo("Detected 115200 baud interface\n");
505 >------->------->------->-------detected_rate = 1;
506 >------->------->-------}
507 >------->-------}

The problem is Line 3279 in the truss below:

Truss:
   3266 3.145134065 ioctl(3,TIOCGETA,0x7fffffffe038)>--- = 0 (0x0)
   3267 3.145153299 ioctl(3,TIOCFLUSH,0x7fffffffe0ac)>-- = 0 (0x0)
   3268 3.145168546 write(3,"\r\n",2)>-->------->------- = 2 (0x2)
   3269 3.145696125 ioctl(3,TIOCFLUSH,0x7fffffffe0ac)>-- = 0 (0x0)
   3270 3.145709282 write(3,"\r\n",2)>-->------->------- = 2 (0x2)
   3271 3.145720779 fcntl(3,F_GETFL,)>-->------->------- = 2 (0x2)
   3272 3.145732446 fcntl(3,F_SETFL,O_RDWR|O_NONBLOCK)>- = 0 (0x0)
   3273 3.145743798 read(3,0x7fffffffe1b0,6)>--->------- ERR#35 'Resource temporarily unavailable'
   3274 3.146742863 read(3,0x7fffffffe1b0,6)>--->------- ERR#35 'Resource temporarily unavailable'
   3275 3.147733389 read(3,0x7fffffffe1b0,6)>--->------- ERR#35 'Resource temporarily unavailable'
   3276 3.148644933 read(3,0x7fffffffe1b0,6)>--->------- ERR#35 'Resource temporarily unavailable'
   3277 3.149532203 read(3,0x7fffffffe1b0,6)>--->------- ERR#35 'Resource temporarily unavailable'
   3278 3.150478227 read(3,0x7fffffffe1b0,6)>--->------- ERR#35 'Resource temporarily unavailable'
   3279 3.151513033 read(3,"\0",6)>----->------->------- = 1 (0x1)
   3280 3.152556256 read(3,0x7fffffffe1b1,5)>--->------- ERR#35 'Resource temporarily unavailable'
   3281 3.153571833 read(3,0x7fffffffe1b1,5)>--->------- ERR#35 'Resource temporarily unavailable'
   3282 3.154625244 read(3,0x7fffffffe1b1,5)>--->------- ERR#35 'Resource temporarily unavailable'
   3283 3.155519161 read(3,0x7fffffffe1b1,5)>--->------- ERR#35 'Resource temporarily unavailable'
   3284 3.156376675 read(3,0x7fffffffe1b1,5)>--->------- ERR#35 'Resource temporarily unavailable'
   3285 3.157201498 read(3,0x7fffffffe1b1,5)>--->------- ERR#35 'Resource temporarily unavailable'
...
   3478 3.349096788 read(3,0x7fffffffe1b1,5)>--->------- ERR#35 'Resource temporarily unavailable'
   3479 3.350119665 read(3,0x7fffffffe1b1,5)>--->------- ERR#35 'Resource temporarily unavailable'
   3480 3.350978839 read(3,"\r\n\r\n$",5)>------>------- = 5 (0x5)
   3481 3.351002131 fcntl(3,F_SETFL,O_RDWR)>---->------- = 0 (0x0)
   3482 3.351024514 write(1,"Detected 115200 baud interface\n",31) = 31 (0x1f)

I'm wondering if the delay isn't enough or you need to scan for the first "\r\n\r\n$" received. As a hack I just replaced the constant (2 + 3) with (2 + 4) and my read/write of the SPI appears to work as expected. Maybe this is a regression from the recent patch?

Edited Apr 27, 2020 by Ali Mashtizadeh
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Reference: raptor-engineering-public/ast2050-flashrom#3

Powered by Integricloud